Fix cpu usage bug on MacOSX/darwin

This commit is contained in:
Ethan Edwards 2020-12-28 11:41:54 -05:00
parent fbb1c6b929
commit 6757a53299

View file

@ -23,7 +23,10 @@ get_percent()
;; ;;
Darwin) Darwin)
percent=$(ps -A -o %cpu | awk '{s+=$1} END {print s "%"}') cpuvalue=$(ps -A -o %cpu | awk -F. '{s+=$1} END {print s}')
cpucores=$(sysctl -n hw.logicalcpu)
cpuusage=$(( cpuvalue / cpucores ))
percent="$cpuusage%"
echo $percent echo $percent
;; ;;