rename funcs, move get_val

This commit is contained in:
2025-12-14 14:45:06 +01:00
parent cd94018426
commit a271711441
5 changed files with 28 additions and 29 deletions

View File

@@ -16,7 +16,7 @@ void detectHwmon(cpuSensors* target, std::string pci) {
log(LOG::ERR, "cpu::detectHwmon", "NO CPU HWMON KERNEL MODULE DETECTED");
return;
}
target->zenpower = readFile((target->hwmon + "/name"), 128) == "zenpower";
target->zenpower = readFileToStr((target->hwmon + "/name"), 128) == "zenpower";
log(LOG::INF, "cpu::detectHwmon", "Detected module \"{}\" in path \"{}\"", target->zenpower ? "zenpower" : "k10temp", target->hwmon);
}
@@ -37,7 +37,7 @@ void update(cpuSensors* c) {
// lots of reads but still faster than reading /proc/cpuinfo
c->avg_freq = 0;
for (uint8_t i = 0; i < N_CPU; i++) {
readFile2("/sys/devices/system/cpu/cpu" + std::to_string(i) + "/cpufreq/cpuinfo_avg_freq", buf, sizeof(buf));
readFile("/sys/devices/system/cpu/cpu" + std::to_string(i) + "/cpufreq/cpuinfo_avg_freq", buf, sizeof(buf));
c->avg_freq += strtol(buf, NULL, 10) / 1000;
}
c->avg_freq /= N_CPU;