Port: Detect nproc bin name in benchmark scripts
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 5 Oct 2015 19:03:34 +0000 (15:03 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 6 Oct 2015 17:01:47 +0000 (13:01 -0400)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tests/benchmark/run-urcu-tests.sh
tests/benchmark/runhash.sh

index 6e6cf606f81f158588d4b5fdd41415cf13bf6aa0..7a0974207c75b42a0a45cb800e6271f8df899b3f 100755 (executable)
@@ -9,8 +9,17 @@ plan_tests     ${NUM_TESTS}
 #run all tests
 diag "Executing URCU tests"
 
 #run all tests
 diag "Executing URCU tests"
 
+NUM_CPUS="1"
+for i in nproc gnproc; do
+       NUM_CPUS=$($i 2>/dev/null)
+       if [ "$?" -eq "0" ]; then
+               break
+       else
+               NUM_CPUS="1"
+       fi
+done
+
 #set to number of active CPUS
 #set to number of active CPUS
-NUM_CPUS=$(nproc)
 if [[ ${NUM_CPUS} -lt 4 ]]; then
        NUM_CPUS=4      # Floor at 4 due to following assumptions.
 fi
 if [[ ${NUM_CPUS} -lt 4 ]]; then
        NUM_CPUS=4      # Floor at 4 due to following assumptions.
 fi
index 2ae73e971c8a71cd2b2e7da175b5c35efa2dd636..dc894d4503bcfa68b5703da809e2ff864f8c0921 100755 (executable)
@@ -18,8 +18,17 @@ TIME_UNITS=$1
 
 TESTPROG=./test_urcu_hash
 
 
 TESTPROG=./test_urcu_hash
 
+NUM_CPUS="1"
+for i in nproc gnproc; do
+       NUM_CPUS=$($i 2>/dev/null)
+       if [ "$?" -eq "0" ]; then
+               break
+       else
+               NUM_CPUS="1"
+       fi
+done
+
 #thread multiplier: number of processors divided by 4.
 #thread multiplier: number of processors divided by 4.
-NUM_CPUS=$(nproc)
 if [[ ${NUM_CPUS} -lt 4 ]]; then
        NUM_CPUS=4      # Floor at 4 due to following assumptions.
 fi
 if [[ ${NUM_CPUS} -lt 4 ]]; then
        NUM_CPUS=4      # Floor at 4 due to following assumptions.
 fi
This page took 0.026177 seconds and 4 git commands to generate.