From 00656d4ba32471d9e6df37287d24e18ce3e3d43b Mon Sep 17 00:00:00 2001 From: Drath Date: Mon, 11 May 2026 12:11:15 +0000 Subject: [PATCH] oops bug --- src/cpu.c | 4 ++-- src/sys.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cpu.c b/src/cpu.c index e4622f6..de1cace 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -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; } diff --git a/src/sys.c b/src/sys.c index 56039c1..210b77a 100644 --- a/src/sys.c +++ b/src/sys.c @@ -58,7 +58,7 @@ void sys_get_network(struct network_t *network) { static char buf[32]; static struct _net_t prev; struct _net_t current = {}; - snprintf(path, sizeof(path), "/sys/class/net/%s/statistics", network->device); + snprintf(path, sizeof(path), "/sys/class/net/%s/statistics/", network->device); clock_gettime(CLOCK_MONOTONIC, ¤t.ts); fast_read_num_u64(path, "rx_bytes", buf, ¤t.rx, 1);