unify fastReadNum
This commit is contained in:
14
src/cpu.cpp
14
src/cpu.cpp
@@ -50,14 +50,14 @@ void update(cpuSensors* c) {
|
||||
|
||||
// commented out unused values so its faster
|
||||
if (c->zenpower) {
|
||||
utils::fastReadNumDiv<1000>(c->hwmon + "/temp1_input", buf, c->tdie);
|
||||
utils::fastReadNumDiv<1000>(c->hwmon + "/temp2_input", buf, c->tctl);
|
||||
utils::fastReadNumDiv<1000>(c->hwmon + "/temp3_input", buf, c->tccd1);
|
||||
utils::fastReadNumDiv<1000>(c->hwmon + "/in1_input", buf, c->vcore);
|
||||
utils::fastReadNumDiv<1000>(c->hwmon + "/in2_input", buf, c->vsoc);
|
||||
utils::fastReadNum<1000>(c->hwmon + "/temp1_input", buf, c->tdie);
|
||||
utils::fastReadNum<1000>(c->hwmon + "/temp2_input", buf, c->tctl);
|
||||
utils::fastReadNum<1000>(c->hwmon + "/temp3_input", buf, c->tccd1);
|
||||
utils::fastReadNum<1000>(c->hwmon + "/in1_input", buf, c->vcore);
|
||||
utils::fastReadNum<1000>(c->hwmon + "/in2_input", buf, c->vsoc);
|
||||
} else {
|
||||
utils::fastReadNumDiv<1000>(c->hwmon + "/temp1_input", buf, c->tctl);
|
||||
utils::fastReadNumDiv<1000>(c->hwmon + "/temp3_input", buf, c->tccd1);
|
||||
utils::fastReadNum<1000>(c->hwmon + "/temp1_input", buf, c->tctl);
|
||||
utils::fastReadNum<1000>(c->hwmon + "/temp3_input", buf, c->tccd1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
12
src/gpu.cpp
12
src/gpu.cpp
@@ -26,10 +26,10 @@ void detectHwmon(gpuSensors* target, const std::string& pci) {
|
||||
/* some metrics are missing in gpu_metrics, we always fill them from fs, unused metrics are commented out */
|
||||
void fillMissingMetrics(gpuSensors* g) {
|
||||
static char buf[32];
|
||||
utils::fastReadNumDiv<1000>(g->hwmon + "/in0_input", buf, g->vcore);
|
||||
utils::fastReadNum<1000>(g->hwmon + "/in0_input", buf, g->vcore);
|
||||
// g->fan_pwm = std::stoi(readFile(g->hwmon + "/pwm1", 4)) * 100 / 256;
|
||||
utils::fastReadNum(g->hwmon + "/fan1_input", buf, g->fan_speed);
|
||||
utils::fastReadNumDiv<1000000>(g->hwmon + "/power1_cap", buf, g->power_cap);
|
||||
utils::fastReadNum<1000000>(g->hwmon + "/power1_cap", buf, g->power_cap);
|
||||
// utils::fastReadNum(g->hwmon + "/power1_cap_max", g->power_cap_max) / 1000000;
|
||||
utils::fastReadNum(g->hwmon + "/../../mem_info_vram_used", buf, g->vram_used);
|
||||
// utils::fastReadNum(g->hwmon + "/../../mem_info_vram_total", g->vram_total);
|
||||
@@ -38,10 +38,10 @@ void fillMissingMetrics(gpuSensors* g) {
|
||||
/* get sensors for pre-vega cards (rx480/580) */
|
||||
void updateFromFs(gpuSensors* g) {
|
||||
static char buf[32];
|
||||
utils::fastReadNumDiv<1000000>(g->hwmon + "/freq1_input", buf, g->clock_core);
|
||||
utils::fastReadNumDiv<1000000>(g->hwmon + "/freq2_input", buf, g->clock_mem);
|
||||
utils::fastReadNumDiv<1000000>(g->hwmon + "/power1_input", buf, g->power_avg);
|
||||
utils::fastReadNumDiv<1000>(g->hwmon + "/temp1_input", buf, g->temp_edge);
|
||||
utils::fastReadNum<1000000>(g->hwmon + "/freq1_input", buf, g->clock_core);
|
||||
utils::fastReadNum<1000000>(g->hwmon + "/freq2_input", buf, g->clock_mem);
|
||||
utils::fastReadNum<1000000>(g->hwmon + "/power1_input", buf, g->power_avg);
|
||||
utils::fastReadNum<1000>(g->hwmon + "/temp1_input", buf, g->temp_edge);
|
||||
utils::fastReadNum(g->hwmon + "/../../gpu_busy_percent", buf, g->usage_core);
|
||||
}
|
||||
|
||||
|
||||
@@ -81,5 +81,5 @@ void sys::updateSensors(sysSensors* s) {
|
||||
static char buf[8];
|
||||
utils::fastReadNum(s->hwmon + "/fan2_input", buf, s->fan_speed[0]);
|
||||
utils::fastReadNum(s->hwmon + "/fan7_input", buf, s->fan_speed[1]);
|
||||
utils::fastReadNumDiv<1000>(s->hwmon + "/temp5_input", buf, s->t_sensor);
|
||||
utils::fastReadNum<1000>(s->hwmon + "/temp5_input", buf, s->t_sensor);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user