Skip to main content

ProcessorFacts

Struct ProcessorFacts 

Source
pub struct ProcessorFacts<'a> {
    pub id: ProcessorId,
    pub online: bool,
    pub core: Option<&'a Domain>,
    pub simultaneous_multithreading: Observed<bool>,
    pub efficiency_class: Observed<u8>,
    pub parked: Observed<bool>,
    pub allocated_to_this_process: Observed<bool>,
    pub memory_domain: Observed<&'a Domain>,
}
Expand description

Everything this crate knows about one processor, with each absence named.

Produced by MachineMemoryTopology::shard_set. Deliberately not a second copy of Processor: that type is the platform’s own record, while this is the assembled answer to “may this processor host work, and where does it allocate from” – gathered from both Win32 sources plus the derived relations.

§No sentinels, anywhere

Every optional field is an Observed, so “the platform said zero” and “nobody asked” are different values rather than the same one. The field this exists to replace, Processor::capacity, spells three facts as 0 – offline, in no core, and efficiency class zero – and the third is every processor on every non-hybrid machine.

Fields§

§id: ProcessorId

The processor’s identity, always (group, number) and never flattened (D-7): a Windows affinity is a GROUP_AFFINITY, so a bare index names a different processor in every group.

§online: bool

Whether the slot is active. An offline slot exists and counts toward its group’s maximum, so planning work onto one is planning a thread that cannot run.

§core: Option<&'a Domain>

The core relation this processor belongs to, if any names it.

None is a firmware gap the crate tolerates by design, not a contradiction – see Self::efficiency_class, which is Observed::NotObserved in exactly that case rather than 0.

§simultaneous_multithreading: Observed<bool>

Whether the owning core has more than one logical processor.

§efficiency_class: Observed<u8>

The scheduler’s efficiency class for the owning core.

Observed::NotObserved when no core names this processor – which is the distinction Processor::capacity cannot make. On a hybrid part Windows orders class 0 as the least performant, so an unknown processor reported as 0 is indistinguishable from an efficiency core: a policy excluding efficiency cores silently drops a possible performance core, and one tiering them mis-tiers it. Neither fails a functional test.

§parked: Observed<bool>

Whether the scheduler is currently avoiding this processor.

Observed::NotObserved when the CPU-set enumeration was not consulted, which is any topology not produced by MachineMemoryTopology::discover. Parked is not offline: the processor is active and the scheduler is merely avoiding it.

§allocated_to_this_process: Observed<bool>

Whether this processor is allocated to this process.

A planner ignoring it places work on processors the process may not use, which is a wrong plan rather than a slow one.

Measured to carry no information on Windows 11 25H2 (D-23): the whole AllFlags byte reads 0x00 for every processor even after CPU sets are successfully allocated to this process, so Known(false) here reports a byte the kernel did not write.

It also does not mean what its name suggests – allocation is the explicit SetProcessDefaultCpuSets kind, not “may we run here”. Do not branch on it; see CpuSet::allocated_to_target_process.

§memory_domain: Observed<&'a Domain>

The memory domain this processor allocates from, or Observed::NotObserved for the unplaced case, which has no honest fallback – see MachineMemoryTopology::memory_domain_of.

Trait Implementations§

Source§

impl<'a> Clone for ProcessorFacts<'a>

Source§

fn clone(&self) -> ProcessorFacts<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for ProcessorFacts<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> PartialEq for ProcessorFacts<'a>

Source§

fn eq(&self, other: &ProcessorFacts<'a>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a> StructuralPartialEq for ProcessorFacts<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for ProcessorFacts<'a>

§

impl<'a> RefUnwindSafe for ProcessorFacts<'a>

§

impl<'a> Send for ProcessorFacts<'a>

§

impl<'a> Sync for ProcessorFacts<'a>

§

impl<'a> Unpin for ProcessorFacts<'a>

§

impl<'a> UnsafeUnpin for ProcessorFacts<'a>

§

impl<'a> UnwindSafe for ProcessorFacts<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.