Skip to content

Commit

Permalink
feat: adding dram to sum of sockets PKG in host total power, when psy…
Browse files Browse the repository at this point in the history
…s is unavailable, on windows
  • Loading branch information
bpetit committed Jan 5, 2024
1 parent 839d660 commit 402fdac
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/sensors/msr_rapl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,18 +176,28 @@ impl RecordReader for Topology {
if let Some(psys_record) = record {
Ok(psys_record)
} else {
let mut res: u64 = 0;
let mut res: u128 = 0;
debug!("Topology: I have {} sockets", self.sockets.len());
for s in &self.sockets {
match s.read_record() {
Ok(rec) => {
debug!("rec: {:?}", rec);
res += rec.value.parse::<u64>()?;
res += rec.value.trim().parse::<u128>()?;
}
Err(e) => {
error!("Failed to get socket record : {:?}", e);
}
}
let dram_filter: Vec<&Domain> = s
.get_domains_passive()
.iter()
.filter(|d| d.name == "dram")
.collect();
if let Some(dram) = dram_filter.first() {
if let Ok(val) = dram.read_record() {
res += val.value.trim().parse::<u128>()?;
}
}
}
Ok(Record {
timestamp: current_system_time_since_epoch(),
Expand Down

0 comments on commit 402fdac

Please sign in to comment.