pub struct CpuTopology {
pub logical_cpus: Option<usize>,
pub caches: Vec<CacheLevel>,
pub heterogeneous_cores: Option<bool>,
}Expand description
The measured shape of the host machine.
Every field is optional because an unmeasured value must stay visibly absent rather than silently defaulted.
Fields§
§logical_cpus: Option<usize>Logical CPUs usable by this process, honouring CPU affinity.
caches: Vec<CacheLevel>Data and unified cache levels, ascending by level.
heterogeneous_cores: Option<bool>Whether cores have differing capability (P/E cores, Snapdragon X).
None means undetermined, which is not the same as Some(false).
Even work splitting is wrong on a heterogeneous machine, so the
distinction matters.
Implementations§
Source§impl CpuTopology
impl CpuTopology
Sourcepub fn detect() -> CpuTopology
pub fn detect() -> CpuTopology
Detect the host’s shape. Unavailable values stay None.
Sourcepub fn cache_bytes(&self, level: u8) -> Option<usize>
pub fn cache_bytes(&self, level: u8) -> Option<usize>
Bytes in the given cache level, if measured.
Sourcepub fn last_level_bytes(&self) -> Option<usize>
pub fn last_level_bytes(&self) -> Option<usize>
Bytes in the largest measured cache level.
Sourcepub fn line_bytes(&self) -> Option<usize>
pub fn line_bytes(&self) -> Option<usize>
Cache line size, if measured.
Trait Implementations§
Source§impl Clone for CpuTopology
impl Clone for CpuTopology
Source§fn clone(&self) -> CpuTopology
fn clone(&self) -> CpuTopology
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CpuTopology
impl Debug for CpuTopology
Source§impl Default for CpuTopology
impl Default for CpuTopology
Source§fn default() -> CpuTopology
fn default() -> CpuTopology
Returns the “default value” for a type. Read more
Source§impl PartialEq for CpuTopology
impl PartialEq for CpuTopology
impl Eq for CpuTopology
impl StructuralPartialEq for CpuTopology
Auto Trait Implementations§
impl Freeze for CpuTopology
impl RefUnwindSafe for CpuTopology
impl Send for CpuTopology
impl Sync for CpuTopology
impl Unpin for CpuTopology
impl UnwindSafe for CpuTopology
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more