several sanity checks added
This commit is contained in:
@@ -49,7 +49,10 @@ void update(cpuSensors* c) {
|
||||
utils::fastReadNum<1000>("/sys/devices/system/cpu/cpu" + std::to_string(i) + "/cpufreq/cpuinfo_avg_freq", buf, t);
|
||||
c->avg_freq += t;
|
||||
}
|
||||
c->avg_freq /= c->num_cores;
|
||||
c->avg_freq /= (c->num_cores > 1) ? c->num_cores : 1;
|
||||
|
||||
if (c->hwmon.empty())
|
||||
return;
|
||||
|
||||
// commented out unused values so its faster
|
||||
if (c->module == zenpower) {
|
||||
|
||||
@@ -102,12 +102,15 @@ void updateFromMetrics(gpuSensors* g) {
|
||||
|
||||
/* reads values from system and updates the target gpu::sensors struct */
|
||||
void update(gpuSensors* g) {
|
||||
fillMissingMetrics(g);
|
||||
const bool hwmon_valid = !g->hwmon.empty();
|
||||
if (hwmon_valid)
|
||||
fillMissingMetrics(g);
|
||||
|
||||
if (g->hasGpuMetrics)
|
||||
updateFromMetrics(g);
|
||||
else
|
||||
updateFromFs(g);
|
||||
if (hwmon_valid)
|
||||
updateFromFs(g);
|
||||
|
||||
if (g->fan_speed > 9999) g->fan_speed = 9999; // sanity check fan speed
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user