This commit is contained in:
2026-05-11 12:11:15 +00:00
parent 07a8ecddf9
commit 00656d4ba3
2 changed files with 3 additions and 3 deletions

View File

@@ -39,7 +39,7 @@ void cpu_update(struct cpu_sensors_t *c) {
// read power from intel-rapl? works on amd too, btop uses this trick, seems accurate
// it tracks with "socket power" in hwinfo on windows, its actually the same thing i had in lcdsmartie
clock_gettime(CLOCK_MONOTONIC, &curr.ts);
fast_read_num_u64("/sys/class/powercap/intel-rapl:0", "energy_uj", buf, &curr.energy, 1);
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);
prev = curr;
@@ -49,7 +49,7 @@ void cpu_update(struct cpu_sensors_t *c) {
char p[128];
for (uint8_t i = 0; i < c->num_cores; i++) {
uint64_t t = 0;
sprintf(p, "/sys/devices/system/cpu/cpu%d/cpufreq", i);
sprintf(p, "/sys/devices/system/cpu/cpu%d/cpufreq/", i);
fast_read_num_u64(p, "cpuinfo_avg_freq", buf, &t, 1000);
c->avg_freq += t;
}