Show graphics card (NVIDIA) temp and mem usage
authorSiraaj Khandkar <siraaj@khandkar.net>
Tue, 3 Jul 2018 21:26:46 +0000 (17:26 -0400)
committerSiraaj Khandkar <siraaj@khandkar.net>
Tue, 3 Jul 2018 21:26:46 +0000 (17:26 -0400)
bin/khatus_show

index f008d19..c0a41a1 100755 (executable)
@@ -355,11 +355,29 @@ mpd_current_file=$(
         '
 )
 
+graphics_card=$(
+    nvidia-smi \
+        --format=csv,noheader,nounits \
+        --query-gpu=memory.total,memory.used,temperature.gpu \
+    | awk -F ',' '
+        {
+            mem_total = $1;
+            mem_used  = $2;
+            temp      = $3;
+            mem_used_percent = (100 * mem_used) / mem_total;
+            printf("[%d%% %dC]", mem_used_percent, temp);
+        }
+        '
+)
+
 echo \
 "\
  E$energy\
  \
  \
+ G=$graphics_card\
+ \
+ \
  M$memory\
  \
  \
This page took 0.02235 seconds and 4 git commands to generate.