45 lines
1.0 KiB
C++
45 lines
1.0 KiB
C++
#ifndef GPU_HPP
|
|
#define GPU_HPP
|
|
|
|
#include <cstdint>
|
|
#include <fstream>
|
|
#include <print>
|
|
#include <string>
|
|
#include <utils.hpp>
|
|
|
|
#define REL_METRICS_PATH = "/../../gpu_metrics"
|
|
|
|
struct gpu_t {
|
|
uint16_t fan_speed = 0;
|
|
uint16_t core_clock = 0;
|
|
uint16_t mem_clock = 0;
|
|
double vcore = 0;
|
|
uint16_t power_avg = 0;
|
|
uint16_t power_cap = 0;
|
|
uint16_t power_max = 0;
|
|
uint8_t fan_pwm = 0;
|
|
uint8_t edge_temp = 0;
|
|
uint8_t hotspot_temp = 0;
|
|
uint8_t mem_temp = 0;
|
|
uint8_t gfx_vrm_temp = 0;
|
|
uint8_t soc_vrm_temp = 0;
|
|
uint8_t mem_vrm_temp = 0;
|
|
uint64_t vram_used = 0;
|
|
uint64_t vram_total = 0;
|
|
uint8_t core_usage = 0;
|
|
uint8_t media_usage = 0;
|
|
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);
|
|
gpu_t getGpu(std::string hw, bool hasMetrics);
|
|
GpuMetricsHeader_t getGpuMetricsHeader(std::string path);
|
|
|
|
#endif |