Merge pull request #585 from hodgesds/topo-node-cores

scx_utils: Add cores helper to node topology
This commit is contained in:
Daniel Hodges 2024-08-29 14:07:38 -04:00 committed by GitHub
commit 36e81f81d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -265,6 +265,17 @@ impl Node {
cpus 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. // Get the map of all GPUs for this NUMA node.
pub fn gpus(&self) -> &BTreeMap<GpuIndex, Gpu> { pub fn gpus(&self) -> &BTreeMap<GpuIndex, Gpu> {
&self.gpus &self.gpus