From: Siraaj Khandkar Date: Tue, 3 Jul 2018 21:26:46 +0000 (-0400) Subject: Show graphics card (NVIDIA) temp and mem usage X-Git-Url: https://git.xandkar.net/?p=khatus.git;a=commitdiff_plain;h=78fe905a09f5da60eddc6d88902a5359853505ad Show graphics card (NVIDIA) temp and mem usage --- diff --git a/bin/khatus_show b/bin/khatus_show index f008d19..c0a41a1 100755 --- a/bin/khatus_show +++ b/bin/khatus_show @@ -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\ \ \