use the new macro

This commit is contained in:
Drath
2025-11-02 12:38:03 +01:00
parent d7c12ca14d
commit 702fc5387d

View File

@@ -23,22 +23,24 @@ void detectHwmon(gpuSensors* target, 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) {
g->vcore = std::stol(readFile(g->hwmon + "/in0_input", 4)) / 1000.0f;
static char buf[32];
fastReadNum(g->hwmon + "/in0_input", g->vcore) / 1000.0;
// g->fan_pwm = std::stoi(readFile(g->hwmon + "/pwm1", 4)) * 100 / 256;
g->fan_speed = std::stol(readFile(g->hwmon + "/fan1_input", 4));
g->power_cap = std::stol(readFile(g->hwmon + "/power1_cap", 16)) / 1000000;
// g->power_cap_max = std::stol(readFile(g->hwmon + "/power1_cap_max", 16)) / 1000000;
g->vram_used = std::stoul(readFile(g->hwmon + "/../../mem_info_vram_used", 16));
// g->vram_total = std::stoul(readFile(g->hwmon + "/../../mem_info_vram_total", 16));
fastReadNum(g->hwmon + "/fan1_input", g->fan_speed);
fastReadNum(g->hwmon + "/power1_cap", g->power_cap) / 1000000;
// fastReadNum(g->hwmon + "/power1_cap_max", g->power_cap_max) / 1000000;
fastReadNum(g->hwmon + "/../../mem_info_vram_used", g->vram_used);
// fastReadNum(g->hwmon + "/../../mem_info_vram_total", g->vram_total);
}
/* get sensors for pre-vega cards (rx480/580) */
void updateFromFs(gpuSensors* g) {
g->clock_core = std::stoll(readFile(g->hwmon + "/freq1_input", 16)) / 1000000;
g->clock_mem = std::stoll(readFile(g->hwmon + "/freq2_input", 16)) / 1000000;
g->power_avg = std::stol(readFile(g->hwmon + "/power1_input", 16)) / 1000000;
g->temp_edge = std::stol(readFile(g->hwmon + "/temp1_input", 2));
g->usage_core = std::stoi(readFile(g->hwmon + "/../../gpu_busy_percent"));
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);
}
/* get sensors for vega and newer (rx5700xt, rx7800xt [*]) */