Struct numa_gpu::runtime::cpu_affinity::CpuAffinity
source · [−]pub struct CpuAffinity { /* private fields */ }
Implementations
sourceimpl CpuAffinity
impl CpuAffinity
sourcepub fn from_slice(affinity_list: &[u16]) -> Self
pub fn from_slice(affinity_list: &[u16]) -> Self
Takes a slice containing CPU core affinities.
sourcepub fn from_file(path: &Path) -> Result<Self>
pub fn from_file(path: &Path) -> Result<Self>
Reads a list of CPU core affinities from a file.
CPU core affinities should be listed in a single line and separated with spaces. E.g.:
0 2 4 6 1 3 5 7
Lines that start with ‘#’ are ignored as comments.
sourcepub fn thread_to_cpu(&self, tid: u16) -> Option<u16>
pub fn thread_to_cpu(&self, tid: u16) -> Option<u16>
Maps a thread ID to a CPU core ID.
Returns a CPU core ID, or None
if the thread ID is out-of-bounds.
Core IDs are guaranteed to be in the order given on construction.
sourcepub fn set_affinity(&self, tid: u16) -> Result<()>
pub fn set_affinity(&self, tid: u16) -> Result<()>
Binds the current thread to the CPU core by the given thread ID.
Core IDs are guaranteed to be in the order given on construction.
Trait Implementations
sourceimpl Clone for CpuAffinity
impl Clone for CpuAffinity
sourcefn clone(&self) -> CpuAffinity
fn clone(&self) -> CpuAffinity
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl RefUnwindSafe for CpuAffinity
impl Send for CpuAffinity
impl Sync for CpuAffinity
impl Unpin for CpuAffinity
impl UnwindSafe for CpuAffinity
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more