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: ProcessorIdThe 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: boolWhether 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>
impl<'a> Clone for ProcessorFacts<'a>
Source§fn clone(&self) -> ProcessorFacts<'a>
fn clone(&self) -> ProcessorFacts<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more