#ifndef GPU_HPP #define GPU_HPP #include #include #include #include #include #include #define REL_METRICS_PATH "/../../gpu_metrics" // gpu_metrics path relative to hwmon path #define MAX_METRICS_LENGTH 512 // length of the metrics buffer /* should refactor this struct so its a little cleaner and closer to gpu_metrics */ /* clean abstraction for gpu_metrics or metrics in filesystem in sane units */ namespace gpu { struct gpuSensors { std::string hwmon = ""; bool hasGpuMetrics = false; float vcore = 0.0f; uint16_t clock_core = 0; uint16_t clock_mem = 0; uint8_t fan_pwm = 0; uint16_t fan_speed = 0; uint16_t power_avg = 0; uint16_t power_cap = 0; uint16_t power_cap_max = 0; uint8_t temp_edge = 0; uint8_t temp_hotspot = 0; uint8_t temp_mem = 0; uint8_t temp_vrm_gfx = 0; uint8_t temp_vrm_soc = 0; uint8_t temp_vrm_mem = 0; uint8_t usage_core = 0; uint8_t usage_media = 0; uint8_t usage_umc = 0; uint64_t vram_used = 0; uint64_t vram_total = 0; }; void detectHwmon(gpuSensors* target, std::string pci); void update(gpuSensors* g); } // namespace gpu // class ThrottleStatus(IntFlag): // # linux/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h // PPT0 = 1 << 0 // PPT1 = 1 << 1 // PPT2 = 1 << 2 // PPT3 = 1 << 3 // SPL = 1 << 4 // FPPT = 1 << 5 // SPPT = 1 << 6 // SPPT_APU = 1 << 7 // TDC_GFX = 1 << 16 // TDC_SOC = 1 << 17 // TDC_MEM = 1 << 18 // TDC_VDD = 1 << 19 // TDC_CVIP = 1 << 20 // EDC_CPU = 1 << 21 // EDC_GFX = 1 << 22 // APCC = 1 << 23 // TEMP_GPU = 1 << 32 // TEMP_CORE = 1 << 33 // TEMP_MEM = 1 << 34 // TEMP_EDGE = 1 << 35 // TEMP_HOTSPOT = 1 << 36 // TEMP_SOC = 1 << 37 // TEMP_VR_GFX = 1 << 38 // TEMP_VR_SOC = 1 << 39 // TEMP_VR_MEM0 = 1 << 40 // TEMP_VR_MEM1 = 1 << 41 // TEMP_LIQUID0 = 1 << 42 // TEMP_LIQUID1 = 1 << 43 // VRHOT0 = 1 << 44 // VRHOT1 = 1 << 45 // PROCHOT_CPU = 1 << 46 // PROCHOT_GFX = 1 << 47 // PPM = 1 << 56 // FIT = 1 << 57 #endif