Expand description

This crate manages CPU affinities.

Example

This example shows how create a thread for each available processor and pin each thread to its corresponding processor.

use libafl_bolts::core_affinity;

// Retrieve the IDs of all active CPU cores.
let core_ids = core_affinity::get_core_ids().unwrap();

// Create a thread for each active CPU core.
let handles = core_ids.into_iter().map(|id| {
    thread::spawn(move || {
        // Pin this thread to a single CPU core.
        id.set_affinity();
        // Do more work after this.
    })
}).collect::<Vec<_>>();

for handle in handles.into_iter() {
    handle.join().unwrap();
}

This file is a fork of https://github.com/Elzair/core_affinity_rs

Structs

Functions

  • This function tries to retrieve information on all the “cores” active on this system.
  • Parses core binding args from user input. Returns a Vec of CPU IDs.