From 57513bf7cd5934ae0bff0c3e67564243975d7b49 Mon Sep 17 00:00:00 2001 From: xAlpharax <42233094+xAlpharax@users.noreply.github.com> Date: Wed, 6 Sep 2023 21:44:39 +0300 Subject: Proper changes for VRAM monitoring functionality. NVIDIA + AMD support. Intel support is missing as I could not have tested it, but instructions are present in vram.c Changes to be committed: modified: components/vram.c modified: config.h --- components/vram.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'components/vram.c') diff --git a/components/vram.c b/components/vram.c index bb66c6c..d5e8a22 100644 --- a/components/vram.c +++ b/components/vram.c @@ -62,7 +62,7 @@ float GetTotalVRAM() { float vram_total = -1.0; // Check if an NVIDIA card is present - command_output = runCommand("nvidia-smi --query-gpu=memory.total --format=csv,noheader,nounits");// Returns MiB + command_output = runCommand("nvidia-smi --query-gpu=memory.total --format=csv,noheader,nounits"); // Returns MiB if (command_output != NULL) { sscanf(command_output, "%f", &vram_total); free(command_output); @@ -100,7 +100,7 @@ vram_used(const char *unused) { int vram_used = (int) GetUsedVRAM(); if (vram_used >= 0.0) { - return fmt_human(vram_used * 1024, 1024); + return bprintf("%d MiB", vram_used); } else { return NULL; } @@ -111,7 +111,7 @@ vram_total(const char *unused) { int vram_total = (int) GetTotalVRAM(); if (vram_total >= 0.0) { - return fmt_human(vram_total * 1024, 1024); + return bprintf("%d MiB", vram_total); } else { return NULL; } -- cgit v1.2.3