sanityy check
This commit is contained in:
@@ -37,11 +37,11 @@ void cpu_update(struct cpu_sensors_t *c) {
|
||||
clock_gettime(CLOCK_MONOTONIC, &curr.ts);
|
||||
fast_read_num_u64("/sys/class/powercap/intel-rapl:0/", "energy_uj", buf, &curr.energy, 1);
|
||||
|
||||
const uint64_t tdiff_us = timespec_diff_us(&curr.ts, &prev.ts);
|
||||
c->ptotal = (float)(curr.energy - prev.energy) / (float)tdiff_us;
|
||||
prev = curr;
|
||||
c->ptotal = (float)(curr.energy - prev.energy) / (float)timespec_diff_us(&curr.ts, &prev.ts);
|
||||
if (c->ptotal > 500.0f || c->ptotal < 0.0f)
|
||||
c->ptotal = 0.0f;
|
||||
else
|
||||
prev = curr;
|
||||
|
||||
// lots of reads but still faster than reading /proc/cpuinfo
|
||||
c->avg_freq = 0;
|
||||
|
||||
Reference in New Issue
Block a user