diff options
author | Vidhu Kant Sharma <bokuwakanojogahoshii@yahoo.com> | 2021-03-14 17:03:06 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <bokuwakanojogahoshii@yahoo.com> | 2021-03-14 17:03:06 +0530 |
commit | 29b6d79e5252b8e6af18898ee0d6d7596ffd0841 (patch) | |
tree | 6a5532ab66658a23783c54f3a09e3c32d085db96 /lemonblocks/modules/cpu_load.sh | |
parent | 8a6150293fbb183ef3bd6f701fe9c620537a3efa (diff) |
pushing lemonblocks config
Diffstat (limited to 'lemonblocks/modules/cpu_load.sh')
-rwxr-xr-x | lemonblocks/modules/cpu_load.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lemonblocks/modules/cpu_load.sh b/lemonblocks/modules/cpu_load.sh new file mode 100755 index 00000000..1a677a96 --- /dev/null +++ b/lemonblocks/modules/cpu_load.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +read cpu a b c previdle rest < /proc/stat +prevtotal=$((a+b+c+previdle)) +sleep 0.5 +read cpu a b c idle rest < /proc/stat +total=$((a+b+c+idle)) +cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) )) + +printf " CPU:%s%% " $cpu |