summaryrefslogtreecommitdiffstats
path: root/.local
diff options
context:
space:
mode:
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/status/sb-cpu23
1 files changed, 13 insertions, 10 deletions
diff --git a/.local/bin/status/sb-cpu b/.local/bin/status/sb-cpu
index 58abb72..7770bdb 100755
--- a/.local/bin/status/sb-cpu
+++ b/.local/bin/status/sb-cpu
@@ -9,14 +9,17 @@
printf " "
# for i in $(top -P -d 2 -s 0.2 | grep '^CPU' | tail -n$ncpu | sed '{s/% idle$//;s/.*[[:blank:]]//;s/\..*//;s/^/100 - /;}' | bc); do
-case $(top -d 2 -s 0.2 | grep '^CPU' | sed '{1d;s/% idle$//;s/.*[[:blank:]]//;s/\..*//;s/^/(100 - /;s/$/) \/ 12\.5/;}' | bc) in
- "0") printf "[ ]";;
- "1") printf "[= ]";;
- "2") printf "[== ]";;
- "3") printf "[=== ]";;
- "4") printf "[==== ]";;
- "5") printf "[===== ]";;
- "6") printf "[====== ]";;
- "7") printf "[======= ]";;
- "8") printf "[========]";;
+stats=$(top -d 2 -s 0.2 | grep -E 'load averages:|^CPU')
+printf "%s " "$(echo "$stats" | sed '{1,2d;4d;s/.*averages: *//;s/,.*//;}')"
+case $(echo "$stats" | sed '{1,3d;s/% idle$//;s/.*[[:blank:]]//;s/\..*//;s/^/(100 - /;s/$/) \/ 12\.5/;}' | bc) in
+ "0") printf "[ ]\n";;
+ "1") printf "[= ]\n";;
+ "2") printf "[== ]\n";;
+ "3") printf "[=== ]\n";;
+ "4") printf "[==== ]\n";;
+ "5") printf "[===== ]\n";;
+ "6") printf "[====== ]\n";;
+ "7") printf "[======= ]\n";;
+ "8") printf "[========]\n";;
esac
+