summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxAlpharax <42233094+xAlpharax@users.noreply.github.com>2023-09-06 21:44:39 +0300
committerxAlpharax <42233094+xAlpharax@users.noreply.github.com>2023-09-06 21:44:39 +0300
commit57513bf7cd5934ae0bff0c3e67564243975d7b49 (patch)
tree4318e23906c3b1764820976ba32ae717fe3d7b7b
parentb2bcd0fc0f9b06cc021d46bdc954addb3c433f99 (diff)
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
-rw-r--r--components/vram.c6
-rw-r--r--config.h1
2 files changed, 3 insertions, 4 deletions
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;
}
diff --git a/config.h b/config.h
index 54c02fc..c6a99bc 100644
--- a/config.h
+++ b/config.h
@@ -17,7 +17,6 @@ const struct arg args[] = {
{ cpu_freq, " %sHz", NULL },
{ ram_perc, " <%s ram>", NULL },
{ vram_perc, " <%s vram>", NULL },
- { vram_total, " <%s vram>", NULL },
{ disk_perc, " <%s nvme>", "/" },
{ disk_perc, " <%s sata>", "/home/alphara/exfatssd" },
{ wifi_perc, " <%s wifi>", "wlp5s0" },