scx_utils: Add cores helper to node topology

Add a helper for getting the cores per node.

Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com>
This commit is contained in:
Daniel Hodges 2024-08-29 05:21:56 -07:00
parent cc3f696c4b
commit f0c9a3932d

View File

@ -265,6 +265,17 @@ impl Node {
cpus
}
/// Get the map of all Cores for this NUMA node.
pub fn cores(&self) -> BTreeMap<usize, Core> {
let mut cores = BTreeMap::new();
for (_, llc) in &self.llcs {
for (core_id, core) in llc.cores() {
cores.insert(*core_id, core.clone());
}
}
cores
}
// Get the map of all GPUs for this NUMA node.
pub fn gpus(&self) -> &BTreeMap<GpuIndex, Gpu> {
&self.gpus