diff --git a/scripts/gpu_power.sh b/scripts/gpu_power.sh index 1fd32592..efba040c 100755 --- a/scripts/gpu_power.sh +++ b/scripts/gpu_power.sh @@ -51,7 +51,7 @@ get_gpu() elif [[ "$gpu" == apple ]]; then usage="$(sudo powermetrics --samplers gpu_power -i500 -n 1 | grep 'GPU Power' | sed 's/GPU Power: \(.*\) \(.*\)/\1\2/g')" - else + elif [[ "$gpu" == Advanced ]]; then usage=$( for card in /sys/class/drm/card? do @@ -59,6 +59,8 @@ get_gpu() done | \ sed -z -e 's/\n/|/g' -e 's/|$//g' ) + else # "Intel" "Matrox", etc + usage="unknown" fi echo $usage } diff --git a/scripts/gpu_ram_info.sh b/scripts/gpu_ram_info.sh index c4d482c8..f2bfc735 100755 --- a/scripts/gpu_ram_info.sh +++ b/scripts/gpu_ram_info.sh @@ -51,7 +51,7 @@ get_gpu() total_accuracy=$(get_tmux_option "@dracula-gpu-vram-total-accuracy" "d") usage=$(nvidia-smi --query-gpu=memory.used,memory.total --format=csv,noheader,nounits | awk "{ used += \$0; total +=\$2 } END { printf(\"%${used_accuracy}GB/%${total_accuracy}GB\n\", used / 1024, total / 1024) }") fi - else + elif [[ "$gpu" == Advanced ]]; then usage="$( for card in /sys/class/drm/card? do @@ -60,6 +60,8 @@ get_gpu() echo "$use/$max" done | sed -z -e 's/\n/|/g' -e 's/|$//g' )" + else # "Intel" "Matrox", etc + usage="unknown" fi echo $usage } diff --git a/scripts/gpu_usage.sh b/scripts/gpu_usage.sh index b052900c..6477f211 100755 --- a/scripts/gpu_usage.sh +++ b/scripts/gpu_usage.sh @@ -46,8 +46,10 @@ get_gpu() usage=$(nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits | awk '{ sum += $0 } END { printf("%d%%\n", sum / NR) }') elif [[ "$gpu" == apple ]]; then usage="$(sudo powermetrics --samplers gpu_power -i500 -n 1 | grep 'active residency' | sed 's/[^0-9.%]//g' | sed 's/[%].*$//g')%" - else + elif [[ "$gpu" == Advanced ]]; then usage="$(cat /sys/class/drm/card?/device/gpu_busy_percent | sed -z -e 's/\n/%|/g' -e 's/|$//g')" + else # "Intel" "Matrox", etc + usage="unknown" fi normalize_percent_len $usage }