Refactor _lp_CPUNUM

This commit is contained in:
Olivier Mengué 2012-08-14 23:24:55 +02:00
parent 1f21d7ff5e
commit 7f5346f953

View File

@ -144,23 +144,12 @@ else
fi fi
# get cpu number # Get cpu count
_lp_cpunum_Linux() case "$LP_OS" in
{ Linux) _lp_CPUNUM=$( nproc || grep -c '^[Pp]rocessor' /proc/cpuinfo ) ;;
grep -c '^[Pp]rocessor' /proc/cpuinfo FreeBSD) _lp_CPUNUM=$( sysctl -n hw.ncpu ) ;;
} SunOS) _lp_CPUNUM=$( kstat -m cpu_info | grep -c "module: cpu_info" ) ;;
esac
_lp_cpunum_FreeBSD()
{
sysctl -n hw.ncpu
}
_lp_cpunum_SunOS()
{
kstat -m cpu_info | grep -c "module: cpu_info"
}
_lp_CPUNUM=$(_lp_cpunum_$LP_OS)
# get current load # get current load