Skip to content

Commit

Permalink
chore: loop to get informations about cores and sockets
Browse files Browse the repository at this point in the history
  • Loading branch information
bpetit committed Oct 6, 2023
1 parent 8a2149e commit 197c84f
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions src/sensors/msr_rapl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,18 +395,32 @@ impl Sensor for MsrRAPLSensor {
warn!("Couldn't get cpuinfo");
}
}
for i in 0..5 {
match cpuid.get_extended_topology_info() {
Some(info) => {
warn!("Got CPU topo info {:?}", info);
for t in info {
if t.level_type() == TopologyType::Core {
logical_cpus_from_cpuid = t.processors()
for i in 0..logical_cpus.len() {
match core_affinity::get_core_ids() {
Some(core_ids) => {
for c in core_ids {
if c.id == i as usize {
core_affinity::set_for_current(c);
warn!("Set core_affinity to {}", c.id);
match cpuid.get_extended_topology_info() {
Some(info) => {
warn!("Got CPU topo info {:?}", info);
for t in info {
if t.level_type() == TopologyType::Core {
logical_cpus_from_cpuid = t.processors()
}
}
},
None => {
warn!("Couldn't get cpu topo info");
}
}
break;
}
}
}
},
None => {
warn!("Couldn't get cpu topo info");
warn!("Could'nt get core ids from core_affinity.");
}
}
}
Expand Down

0 comments on commit 197c84f

Please sign in to comment.