make cpu wayyy cleaner

This commit is contained in:
drath
2025-09-14 11:03:55 +02:00
parent 89a94b1822
commit 2ebc62d063
3 changed files with 862 additions and 187 deletions

View File

@@ -1,14 +1,19 @@
#ifndef GPU_HPP
#define GPU_HPP
/* see which we actually need now */
#include <cstdint>
#include <fstream>
#include <print>
#include <string>
#include <utils.hpp>
#define REL_METRICS_PATH = "/../../gpu_metrics"
#include <gpu_structs.hpp>
#define REL_METRICS_PATH "/../../gpu_metrics"
#define MAX_METRICS_LENGTH 512
/* should refactor this struct so its a little cleaner and closer to gpu_metrics */
struct gpu_t {
uint16_t fan_speed = 0;
uint16_t core_clock = 0;
@@ -31,15 +36,8 @@ struct gpu_t {
uint8_t umc_usage = 0;
};
struct GpuMetricsHeader_t {
uint16_t structure_size = 0;
uint8_t format_revision = 0;
uint8_t content_revision = 0;
};
std::string detectGpuHwmon(std::string pci);
gpu_t getGpu(GpuMetricsHeader_t header, std::string hw);
bool checkForMetrics(std::string hwmon);
gpu_t getGpu(std::string hw, bool hasMetrics);
GpuMetricsHeader_t getGpuMetricsHeader(std::string path);
#endif
#endif