make it more or less work with 'warning_level=everything'

This commit is contained in:
2026-07-02 13:19:42 +02:00
parent 1d2095261f
commit 4858feb4c7
11 changed files with 44 additions and 25 deletions

View File

@@ -37,7 +37,8 @@ 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);
c->ptotal = (float)(curr.energy - prev.energy) / (float)timespec_diff_us(&curr.ts, &prev.ts);
const uint64_t tdiff_us = timespec_diff_us(&curr.ts, &prev.ts);
c->ptotal = (float)(curr.energy - prev.energy) / (float)tdiff_us;
prev = curr;
if (c->ptotal > 500.0f || c->ptotal < 0.0f)
c->ptotal = 0.0f;