summaryrefslogtreecommitdiffstats
path: root/cpustat
authorRaghavendra D Prabhu <[email protected]>2011-03-12 18:54:47 (GMT)
committer Raghavendra D Prabhu <[email protected]>2011-03-12 18:54:47 (GMT)
commit5ec75ea891c9b44cdd2d7a3e0c29b4d08dff2b2a (patch) (side-by-side diff)
treedeabb15393558ab3a1a629fc0782d8b0c3124c48 /cpustat
downloadScripts-5ec75ea891c9b44cdd2d7a3e0c29b4d08dff2b2a.zip
Scripts-5ec75ea891c9b44cdd2d7a3e0c29b4d08dff2b2a.tar.gz
Scripts-5ec75ea891c9b44cdd2d7a3e0c29b4d08dff2b2a.tar.bz2
Initial scripts update
Diffstat (limited to 'cpustat') (more/less context) (ignore whitespace changes)
-rwxr-xr-xcpustat11
1 files changed, 11 insertions, 0 deletions
diff --git a/cpustat b/cpustat
new file mode 100755
index 0000000..90e1acd
--- a/dev/null
+++ b/cpustat
@@ -0,0 +1,11 @@
+#!/bin/zsh
+idle=$(mpstat | tail -1 | awk '{ print $12 }')
+print $idle
+util=${$((100.00-$idle))%.*}
+
+if [[ $util -ge 50 ]];then
+ echo -n "CPU: <fc=#f0c040>$util</fc>%"
+else
+ echo -n "CPU: $util%"
+fi
+