diff --git a/src/cpu.c b/src/cpu.c index 92e448e..9bfe7cd 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -40,6 +40,8 @@ void cpu_update(struct cpu_sensors_t *c) { c->ptotal = (float)(curr.energy - prev.energy) / (float)timespec_diff_us(&curr.ts, &prev.ts); prev = curr; + if (c->ptotal > 500.0f || c->ptotal < 0.0f) + c->ptotal = 0.0f; // lots of reads but still faster than reading /proc/cpuinfo c->avg_freq = 0;