Skip the standalone nodes, when gpu_metrics is present

Currently we open the standalone busy, temp, gpu/memory clock and
power_usage nodes, even if gpu_metrics is present.

At the same time, we correctly ignore them when doing the read-only.
So just avoid opening them all together.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
pull/703/head
Emil Velikov 2 years ago
parent 5143229bd1
commit 17bfd6ed08

@ -7,10 +7,11 @@
struct amdgpu_files
{
FILE *busy;
FILE *temp;
FILE *vram_total;
FILE *vram_used;
/* The following can be NULL, in that case we're using the gpu_metrics node */
FILE *busy;
FILE *temp;
FILE *core_clock;
FILE *memory_clock;
FILE *power_usage;

@ -639,13 +639,16 @@ void init_gpu_stats(uint32_t& vendorID, uint32_t reported_deviceID, overlay_para
SPDLOG_DEBUG("Using gpu_metrics");
}
path += "/device";
if (!amdgpu.busy)
amdgpu.busy = fopen((path + "/gpu_busy_percent").c_str(), "r");
if (!amdgpu.vram_total)
amdgpu.vram_total = fopen((path + "/mem_info_vram_total").c_str(), "r");
if (!amdgpu.vram_used)
amdgpu.vram_used = fopen((path + "/mem_info_vram_used").c_str(), "r");
if (!metrics_path.empty())
break;
if (!amdgpu.busy)
amdgpu.busy = fopen((path + "/gpu_busy_percent").c_str(), "r");
path += "/hwmon/";
auto dirs = ls(path.c_str(), "hwmon", LS_DIRS);
for (auto& dir : dirs) {

Loading…
Cancel
Save