diff options
author | Adam T. Carpenter <atc@53hor.net> | 2020-05-13 17:58:26 -0400 |
---|---|---|
committer | Adam T. Carpenter <atc@53hor.net> | 2020-05-13 17:58:26 -0400 |
commit | d552ce8e6de88ee7ff362d3a6a9ad746e876fbc5 (patch) | |
tree | efe83835c5372978d2bb735f7a1c766881f9aeb7 /i3blocks-cpuload.sh | |
parent | 212b87cd003505f0414b8c3cc538c715f8c33df6 (diff) | |
download | scripts-d552ce8e6de88ee7ff362d3a6a9ad746e876fbc5.tar.xz scripts-d552ce8e6de88ee7ff362d3a6a9ad746e876fbc5.zip |
fixed email address
Diffstat (limited to 'i3blocks-cpuload.sh')
-rwxr-xr-x | i3blocks-cpuload.sh | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/i3blocks-cpuload.sh b/i3blocks-cpuload.sh index 8d61815..dd30311 100755 --- a/i3blocks-cpuload.sh +++ b/i3blocks-cpuload.sh @@ -1,16 +1,18 @@ #!/bin/sh -cpu_count=4 low=25 high=75 icon_low= icon_mid= icon_high= -#min_avg_usage=$(vmstat | tail -1 | cut -w -f17) +cpu_count=$(sysctl -n hw.ncpu) avg_load=$(sysctl vm.loadavg | cut -w -f3) percent=$(echo "result = $avg_load / $cpu_count * 100; scale=0; result / 1" | bc -l) +mhz=$(sysctl -n dev.cpu.0.freq) +ghz=$(echo "result = $mhz / 1000; scale=1; result / 1" | bc -l) + [ $percent -lt $low ] && printf $icon_low [ $percent -ge $low ] && [ $percent -lt $high ] && printf $icon_mid [ $percent -ge $high ] && printf $icon_high -printf " %s%%\n" $percent +printf " %s%% %s GHz\n" $percent $ghz |