Skip to content

Commit

Permalink
Merge pull request #132 from hubblo-org/fix-#20-diff-between-total-ho…
Browse files Browse the repository at this point in the history
…st-power-and-sum-of-processes

fix: excluding extra cpu time metrics from total for each process
  • Loading branch information
bpetit authored Nov 9, 2021
2 parents 685e63e + e40c853 commit 6a7350f
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/sensors/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,22 +516,23 @@ impl ProcessRecord {
pub fn total_time_jiffies(&self) -> u64 {
let stime = self.process.stat.stime;
let utime = self.process.stat.utime;
let cutime = self.process.stat.cutime as u64;
let cstime = self.process.stat.cstime as u64;
let guest_time = self.process.stat.guest_time.unwrap_or_default();
let cguest_time = self.process.stat.cguest_time.unwrap_or_default() as u64;
let delayacct_blkio_ticks = self.process.stat.delayacct_blkio_ticks.unwrap_or_default();
let itrealvalue = self.process.stat.itrealvalue as u64;
//let cutime = self.process.stat.cutime as u64;
//let cstime = self.process.stat.cstime as u64;
//let guest_time = self.process.stat.guest_time.unwrap_or_default();
//let cguest_time = self.process.stat.cguest_time.unwrap_or_default() as u64;
//let delayacct_blkio_ticks = self.process.stat.delayacct_blkio_ticks.unwrap_or_default();
//let itrealvalue = self.process.stat.itrealvalue as u64;

trace!(
"ProcessRecord: stime {} utime {} cutime {} cstime {} guest_time {} cguest_time {} delayacct_blkio_ticks {} itrealvalue {}",
stime, utime, cutime, cstime, guest_time, cguest_time, delayacct_blkio_ticks, itrealvalue
"ProcessRecord: stime {} utime {}", //cutime {} cstime {} guest_time {} cguest_time {} delayacct_blkio_ticks {} itrealvalue {}",
stime,
utime //, cutime, cstime, guest_time, cguest_time, delayacct_blkio_ticks, itrealvalue
);

// not including cstime and cutime in total as they are reported only when child dies
// child metrics as already reported as the child processes are in the global process
// list, found as /proc/PID/stat
stime + utime + guest_time + cguest_time + delayacct_blkio_ticks + itrealvalue
stime + utime //+ guest_time + cguest_time + delayacct_blkio_ticks + itrealvalue
}
}

Expand Down

0 comments on commit 6a7350f

Please sign in to comment.