unify fastReadNum

This commit is contained in:
2026-01-02 12:24:33 +01:00
parent a54b89bce8
commit c0af0dee95
4 changed files with 21 additions and 23 deletions

View File

@@ -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);
}