summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe <bousset.rudy@gmail.com>2022-08-16 22:07:43 +0200
committerJoe <bousset.rudy@gmail.com>2022-08-16 22:07:43 +0200
commit70f4a40ab0bd8387f515ca34bd636b1871bc79ff (patch)
tree36f4a97eeaa057970c47120f2d47401fc144cb6d
parentmutt color updae (diff)
downloaddotfiles-bsd-70f4a40ab0bd8387f515ca34bd636b1871bc79ff.tar.gz
dotfiles-bsd-70f4a40ab0bd8387f515ca34bd636b1871bc79ff.tar.bz2
dotfiles-bsd-70f4a40ab0bd8387f515ca34bd636b1871bc79ff.tar.xz
dotfiles-bsd-70f4a40ab0bd8387f515ca34bd636b1871bc79ff.tar.zst
dotfiles-bsd-70f4a40ab0bd8387f515ca34bd636b1871bc79ff.zip
update
-rwxr-xr-x.local/bin/status/sb-cpu16
1 files changed, 16 insertions, 0 deletions
diff --git a/.local/bin/status/sb-cpu b/.local/bin/status/sb-cpu
index f989958..7ff7aca 100755
--- a/.local/bin/status/sb-cpu
+++ b/.local/bin/status/sb-cpu
@@ -1,3 +1,19 @@
#!/bin/sh
+ncpu=$(sysctl -n hw.ncpu)
+ncpu=$((ncpu - 1))
+cpu=""
+for i in $(seq 0 $ncpu); do
+ case $(sysctl -n dev.cpu.$i.cx_usage | cut -d'.' -f1 | awk '{printf "%d\n", $1 / 12.5}') in
+ "0") printf "▁";;
+ "1") printf "▂";;
+ "2") printf "▃";;
+ "3") printf "▄";;
+ "4") printf "▅";;
+ "5") printf "▆";;
+ "6") printf "▇";;
+ "7") printf "█";;
+ "8") printf "█";;
+ esac;
+done
# top | sed -n 3p | awk '{print $10}' | cut -d '.' -f1 | awk '{print " " 100 - $1 "%"}'