From 8e29cd00b35862c998e79671adad5604d2ce25c6 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 23 Dec 2017 22:20:50 +1100 Subject: [PATCH] gpu [linux]: Add clock speed --- neofetch | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index acf517e4..dcb9ecda 100755 --- a/neofetch +++ b/neofetch @@ -1212,7 +1212,7 @@ get_gpu() { # Read GPUs into array. IFS=$'\n' gpus=($(lspci -mm | awk -F '\\"|\\" \\"|\\(' \ - '/"Display|"3D|"VGA/ {a[$0] = $3 " " $4} END{for(i in a) + '/"Display|"3D|"VGA/ {a[$0] = $1 $3 " " $4} END{for(i in a) {if(!seen[a[i]]++) print a[i]}}')) IFS="$old_ifs" @@ -1225,6 +1225,8 @@ get_gpu() { [[ "$gpu_type" == "integrated" && ! "$gpu" =~ (i|I)ntel ]] && \ { unset -v gpu; continue; } + freq="$(< /sys/devices/pci0000\:00/0000\:"${gpu/ *}"/drm/card0/gt_cur_freq_mhz)" + case "$gpu" in *"advanced"*) gpu="${gpu/'[AMD/ATI]' }" @@ -1267,6 +1269,10 @@ get_gpu() { fi prin "${subtitle:+${subtitle}${gpu_name}}" "$gpu" + + [[ "$gpu_freq" == "on" && "$freq" ]] && \ + prin "GPU Frequency" "${freq}Mhz" + ((++gpu_num)) done