Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 1 | CPU=$(sed -n 's/^cpu\s//p' /proc/stat); |
2 | TOTAL=$(($(T=0; for VAL in $CPU; do T=($((T))+$((VAL))); done; echo $T))); | ||||
3 | IDLE=${CPU[4]}; | ||||
4 | IDLE_FRAC=$(echo $(($IDLE.00/$TOTAL))); | ||||
5 | IN_USE=$(echo $(( 1.00 - $IDLE_FRAC ))); | ||||
6 | NUM=$(( $IN_USE * 100 )); | ||||
7 | echo $NUM |