rename gpu struct

This commit is contained in:
Drath
2025-09-22 21:11:42 +02:00
parent f4fc1e1dc7
commit 1998fb6953
3 changed files with 9 additions and 9 deletions

View File

@@ -6,7 +6,7 @@
namespace gpu {
/* takes pointer to a target gpu::sensors struct and updates its hwmon path and detects gpu_metrics */
void detectHwmon(sensors* target, std::string pci) {
void detectHwmon(gpuSensors* target, std::string pci) {
target->hwmon = getFirstDir("/sys/bus/pci/devices/" + pci + "/hwmon");
std::println("[gpu::detectHwmon] Detected path \"{}\"", target->hwmon);
@@ -18,7 +18,7 @@ void detectHwmon(sensors* target, std::string pci) {
}
/* some metrics are missing in gpu_metrics, we always fill them from fs */
void fillMissingMetrics(sensors* g) {
void fillMissingMetrics(gpuSensors* g) {
g->vcore = std::stol(readFile(g->hwmon + "/in0_input", 4)) / 1000.0f;
g->fan_pwm = std::stoi(readFile(g->hwmon + "/pwm1", 4)) * 100 / 256;
g->fan_speed = std::stol(readFile(g->hwmon + "/fan1_input", 4));
@@ -29,7 +29,7 @@ void fillMissingMetrics(sensors* g) {
}
/* get sensors for pre-vega cards (rx480/580) */
void updateFromFs(sensors* g) {
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;
@@ -38,7 +38,7 @@ void updateFromFs(sensors* g) {
}
/* get sensors for vega and newer (rx5700xt, rx7800xt [*]) */
void updateFromMetrics(sensors* g) {
void updateFromMetrics(gpuSensors* g) {
char raw_metrics[MAX_METRICS_LENGTH];
if (!readFile2(g->hwmon + REL_METRICS_PATH, raw_metrics, sizeof(raw_metrics))) return;
@@ -87,7 +87,7 @@ void updateFromMetrics(sensors* g) {
}
/* reads values from system and updates the target gpu::sensors struct */
void update(sensors* g) {
void update(gpuSensors* g) {
fillMissingMetrics(g);
if (g->hasGpuMetrics)