pub struct CpuSet {Show 13 fields
pub id: u32,
pub group: u16,
pub logical_processor_index: u8,
pub core_index: u8,
pub last_level_cache_index: u8,
pub numa_node_index: u8,
pub efficiency_class: u8,
pub parked: bool,
pub allocated: bool,
pub allocated_to_target_process: bool,
pub real_time: bool,
pub scheduling_class: u8,
pub allocation_tag: u64,
}Expand description
One processor as the CPU-set API describes it.
Field-for-field what the record carries, with the two bitfield unions decoded. Nothing is interpreted and nothing is cross-checked against the relationship walk – see this module’s note on why reconciling here would destroy the only thing a second observer is for.
Fields§
§id: u32The CPU set’s id, which is what SetThreadSelectedCpuSets takes. Not a
processor number, and not interchangeable with one.
group: u16The processor group.
logical_processor_index: u8The processor’s number within its group.
core_index: u8Windows’s index for the owning core.
last_level_cache_index: u8Windows’s own last-level-cache grouping: processors sharing a value share an LLC in the scheduler’s view. Deliberately kept even though the relationship walk also reports caches, because this is the OS’s opinion rather than a partition derived from firmware records, and the two are answers to different questions.
numa_node_index: u8Windows’s index for the owning NUMA node.
efficiency_class: u8The scheduler’s efficiency class. Carried as reported, with no sentinel:
a processor absent from this enumeration has no record at all rather
than a record holding a stand-in value. Contrast
Processor::capacity, which uses 0 for
both “class zero” and “not known”.
parked: boolThe processor is parked, so the scheduler is currently avoiding it.
Measured to carry no information on Windows 11 25H2 – see
Self::allocated_to_target_process and D-23 in DESIGN-NOTES.md.
allocated: boolThe processor is allocated to some process through the CPU-set API.
Measured to carry no information on Windows 11 25H2 – see
Self::allocated_to_target_process.
allocated_to_target_process: boolThe processor is allocated to this process through the CPU-set API.
§This is not “may we run here”, and it is not populated
Two corrections, both established by experiment rather than reasoning
(D-23 in DESIGN-NOTES.md).
It does not mean the process may use the processor. It means the CPU set
was explicitly allocated through SetProcessDefaultCpuSets or
SetThreadSelectedCpuSets, which a process that never called them has
not done – so false is the ordinary answer for an ordinary process on
every processor it is perfectly free to run on.
And on Windows 11 25H2 (10.0.26200.9168, AMD64) it is not populated at
all. Calling SetProcessDefaultCpuSets successfully, and confirming
with GetProcessDefaultCpuSets that the allocation stuck, still leaves
the whole AllFlags byte reading 0x00 for every processor – under a
null handle, the current-process pseudo-handle, and a real OpenProcess
handle alike.
So do not branch on this. A reader of false is reading a byte the
kernel did not write, not a fact about the machine.
real_time: boolThe processor is marked real-time.
Measured to carry no information on Windows 11 25H2 – see
Self::allocated_to_target_process.
scheduling_class: u8The scheduling class, which shares its union with a reserved u32, so
confirm its meaning against current SDK documentation before relying on
it rather than treating this field as self-describing.
allocation_tag: u64The allocation tag.