Skip to content

cdcdx/cores_ext

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cpu cores extend

Quote

[dependencies]
cores_ext = { git = "https://github.com/cdcdx/cores_ext", branch = "master" }

Usage

    // Bind half of the CPU cores to the current process
    let cpu = cores_ext::CPU::new();
    let bind_start = cpu.execution_units - cpu.physical_cores*cpu.sockets;
    let bind_end = cpu.execution_units;
    cores_ext::bind_cpu_ids(bind_start,bind_end);

    // Get the CPU cores bound to the current process
    let cpus = cores_ext::get_cpu_ids("test");
    println!("cpus:{} {:?}", cpus.len(), cpus);