get rid of macro, use inline func
This commit is contained in:
18
src/gpu.cpp
18
src/gpu.cpp
@@ -24,23 +24,23 @@ 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];
|
||||
fastReadNum(g->hwmon + "/in0_input", g->vcore) / 1000.0;
|
||||
g->vcore = fastReadNum(g->hwmon + "/in0_input", buf) / 1000.0;
|
||||
// g->fan_pwm = std::stoi(readFile(g->hwmon + "/pwm1", 4)) * 100 / 256;
|
||||
fastReadNum(g->hwmon + "/fan1_input", g->fan_speed);
|
||||
fastReadNum(g->hwmon + "/power1_cap", g->power_cap) / 1000000;
|
||||
g->fan_speed = fastReadNum(g->hwmon + "/fan1_input", buf);
|
||||
g->power_cap = fastReadNum(g->hwmon + "/power1_cap", buf) / 1000000;
|
||||
// fastReadNum(g->hwmon + "/power1_cap_max", g->power_cap_max) / 1000000;
|
||||
fastReadNum(g->hwmon + "/../../mem_info_vram_used", g->vram_used);
|
||||
g->vram_used = fastReadNum(g->hwmon + "/../../mem_info_vram_used", buf);
|
||||
// fastReadNum(g->hwmon + "/../../mem_info_vram_total", g->vram_total);
|
||||
}
|
||||
|
||||
/* get sensors for pre-vega cards (rx480/580) */
|
||||
void updateFromFs(gpuSensors* g) {
|
||||
static char buf[32];
|
||||
fastReadNum(g->hwmon + "/freq1_input", g->clock_core) / 1000000;
|
||||
fastReadNum(g->hwmon + "/freq2_input", g->clock_mem) / 1000000;
|
||||
fastReadNum(g->hwmon + "/power1_input", g->power_avg) / 1000000;
|
||||
fastReadNum(g->hwmon + "/temp1_input", g->temp_edge) / 1000;
|
||||
fastReadNum(g->hwmon + "/../../gpu_busy_percent", g->usage_core);
|
||||
g->clock_core = fastReadNum(g->hwmon + "/freq1_input", buf) / 1000000;
|
||||
g->clock_mem = fastReadNum(g->hwmon + "/freq2_input", buf) / 1000000;
|
||||
g->power_avg = fastReadNum(g->hwmon + "/power1_input", buf) / 1000000;
|
||||
g->temp_edge = fastReadNum(g->hwmon + "/temp1_input", buf) / 1000;
|
||||
g->usage_core = fastReadNum(g->hwmon + "/../../gpu_busy_percent", buf);
|
||||
}
|
||||
|
||||
/* get sensors for vega and newer (rx5700xt, rx7800xt [*]) */
|
||||
|
||||
Reference in New Issue
Block a user