Skip to main content

discover_cpu_topology

Function discover_cpu_topology 

Source
pub fn discover_cpu_topology() -> Result<CpuTopology, CpuTopologyError>
Expand description

Discover the process-visible CPU and NUMA topology.

Linux uses /sys/devices/system/node intersected with the process affinity mask. Other platforms, and Linux systems without readable NUMA node files, expose only the all-allowed execution domain.

§Examples

let topology = tenferro_cpu::discover_cpu_topology()?;
assert!(!topology.allowed_cpus().is_empty());

§Errors

Returns CpuTopologyError when the process affinity or NUMA topology cannot be read or contains inconsistent CPU domains.