gotta need to fix this at some point
This commit is contained in:
21
src/gpu.cpp
21
src/gpu.cpp
@@ -120,13 +120,14 @@ auto getGpuMetrics(GpuMetricsHeader_t h, std::string path) {
|
||||
// clean abstraction of gpu_metrics + extra metrics from fs, works with rx7800xt
|
||||
gpu_t getGpu(GpuMetricsHeader_t header, std::string hw) {
|
||||
gpu_t gpu;
|
||||
uint8_t hw_num = 4;
|
||||
|
||||
// these are always read from fs
|
||||
gpu.fan_speed = std::stol(readFile(hw + "/hwmon/hwmon2/fan1_input"));
|
||||
gpu.vcore = std::stod(readFile(hw + "/hwmon/hwmon2/in0_input")) / 1000.0;
|
||||
gpu.power_cap = std::stol(readFile(hw + "/hwmon/hwmon2/power1_cap", 6));
|
||||
gpu.power_max = std::stol(readFile(hw + "/hwmon/hwmon2/power1_cap_max", 6));
|
||||
// gpu.fan_pwm = std::stoi(readFile(hw + "/hwmon/hwmon2/pwm1")); // not super useful
|
||||
gpu.fan_speed = std::stol(readFile(hw + "/hwmon/hwmon" + std::to_string(hw_num) + "/fan1_input"));
|
||||
gpu.vcore = std::stod(readFile(hw + "/hwmon/hwmon" + std::to_string(hw_num) + "/in0_input")) / 1000.0;
|
||||
gpu.power_cap = std::stol(readFile(hw + "/hwmon/hwmon" + std::to_string(hw_num) + "/power1_cap", 6));
|
||||
gpu.power_max = std::stol(readFile(hw + "/hwmon/hwmon" + std::to_string(hw_num) + "/power1_cap_max", 6));
|
||||
// gpu.fan_pwm = std::stoi(readFile(hw + "/hwmon/hwmon" + std::to_string(hw_num) + "/pwm1")); // not super useful
|
||||
gpu.vram_used = std::stoul(readFile(hw + "/mem_info_vram_used"));
|
||||
gpu.vram_total = std::stoul(readFile(hw + "/mem_info_vram_total"));
|
||||
|
||||
@@ -147,11 +148,11 @@ gpu_t getGpu(GpuMetricsHeader_t header, std::string hw) {
|
||||
gpu.mem_vrm_temp = metrics.temperature_vrmem;
|
||||
gpu.power_avg = metrics.average_socket_power;
|
||||
} else {
|
||||
gpu.core_clock = std::stol(readFile(hw + "/hwmon/hwmon2/freq1_input", 6));
|
||||
gpu.mem_clock = std::stol(readFile(hw + "/hwmon/hwmon2/freq2_input", 6));
|
||||
gpu.vcore = std::stod(readFile(hw + "/hwmon/hwmon2/in0_input")) / 1000.0;
|
||||
gpu.power_avg = std::stol(readFile(hw + "/hwmon/hwmon2/power1_input", 6));
|
||||
gpu.edge_temp = std::stol(readFile(hw + "/hwmon/hwmon2/temp1_input", 3));
|
||||
gpu.core_clock = std::stol(readFile(hw + "/hwmon/hwmon" + std::to_string(hw_num) + "/freq1_input", 6));
|
||||
gpu.mem_clock = std::stol(readFile(hw + "/hwmon/hwmon" + std::to_string(hw_num) + "/freq2_input", 6));
|
||||
gpu.vcore = std::stod(readFile(hw + "/hwmon/hwmon" + std::to_string(hw_num) + "/in0_input")) / 1000.0;
|
||||
gpu.power_avg = std::stol(readFile(hw + "/hwmon/hwmon" + std::to_string(hw_num) + "/power1_input", 6));
|
||||
gpu.edge_temp = std::stol(readFile(hw + "/hwmon/hwmon" + std::to_string(hw_num) + "/temp1_input", 3));
|
||||
gpu.core_usage = std::stoi(readFile(hw + "/gpu_busy_percent"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user