/proc/cpuinfo is not available on Darwin arch (ie. mac)

This commit is contained in:
Jean-Baptiste Bellet
2022-10-27 11:19:55 +02:00
parent d1cd1fdefe
commit bbf400a83b

View File

@@ -15,7 +15,17 @@ fi
n="$1"
passed=0
processors="`cat /proc/cpuinfo | grep -c processor`"
# Check via uname the environment we are running in to get the number of cores
if [[ "`uname`" == "Darwin" ]]; then
processors="`sysctl -n hw.ncpu.`"
env="mac"
else
processors="`cat /proc/cpuinfo | grep -c processor`"
env="linux"
fi
echo "Running $n times on a $env with $processors cores"
for i in `seq $processors`; do
yes > /dev/null &