Merge pull request #535 from dylanaraps/cpu_usage

CPU Usage: Add missing core commands and update old ones
This commit is contained in:
Dylan Araps 2016-12-16 00:10:02 +11:00 committed by GitHub
commit d74587325c
1 changed files with 5 additions and 3 deletions

View File

@ -929,11 +929,13 @@ get_cpu_usage() {
*)
# Get cores if unset
if [[ -z "$cores" ]]; then
if [[ "$cpu_cores" == "off" ]]; then
case "$os" in
"Linux") cores="$(awk -F ': ' '/siblings/ {printf $2; exit}' /proc/cpuinfo)" ;;
"Mac OS X" | "BSD") cores="$(sysctl -n hw.ncpu)" ;;
"Linux") cores="$(grep -c "^processor" /proc/cpuinfo)" ;;
"Mac OS X") cores="$(sysctl -n hw.logicalcpu_max)" ;;
"BSD") cores="$(sysctl -n hw.ncpu)" ;;
"Solaris") cores="$(kstat -m cpu_info | grep -c -F "chip_id")" ;;
"Haiku") cores="$(sysinfo -cpu | grep -c -F 'CPU #')" ;;
"iPhone OS") cores="${cpu/*\(}"; cores="${cores/\)*}" ;;
esac
fi