#[non_exhaustive]pub enum Affinity {
Disabled,
Cpu,
Core,
Soft,
}Expand description
CPU affinity of worker threads.
Workers are placed on one logical CPU of each physical core first, spread across NUMA nodes and shared L3 caches, and on the remaining SMT siblings after that. On hybrid CPUs, performance cores are used before efficiency cores. When there are more workers than CPUs, the placement starts over.
The default is Soft on Windows and Core on
other platforms. Affinity is supported on Windows, Linux and Android, other
platforms ignore it.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Disabled
Worker threads are not pinned, the OS scheduler places them.
Cpu
Pins each worker to one logical CPU.
Core
Pins each worker to the logical CPUs of one physical core.
The scheduler can move the worker between the SMT siblings of its
core. Works like Cpu on CPUs without SMT.
Soft
Sets the preferred CPU of each worker without pinning it.
On Windows, this sets the ideal processor of the worker thread. The
scheduler runs the worker there when that CPU is free, and on another
CPU otherwise. On machines with several processor groups, the worker is
also kept in the group of its CPU. Other platforms have no such hint,
there it works like Core.
Trait Implementations§
impl Copy for Affinity
impl Eq for Affinity
impl StructuralPartialEq for Affinity
Auto Trait Implementations§
impl Freeze for Affinity
impl RefUnwindSafe for Affinity
impl Send for Affinity
impl Sync for Affinity
impl Unpin for Affinity
impl UnsafeUnpin for Affinity
impl UnwindSafe for Affinity
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.