From fba91a85491b83db5338078d42bb43023991eca4 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Mon, 5 Oct 2015 15:03:34 -0400 Subject: [PATCH] Port: Detect nproc bin name in benchmark scripts Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- tests/benchmark/run-urcu-tests.sh | 11 ++++++++++- tests/benchmark/runhash.sh | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/benchmark/run-urcu-tests.sh b/tests/benchmark/run-urcu-tests.sh index 6e6cf60..7a09742 100755 --- a/tests/benchmark/run-urcu-tests.sh +++ b/tests/benchmark/run-urcu-tests.sh @@ -9,8 +9,17 @@ plan_tests ${NUM_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 -NUM_CPUS=$(nproc) if [[ ${NUM_CPUS} -lt 4 ]]; then NUM_CPUS=4 # Floor at 4 due to following assumptions. fi diff --git a/tests/benchmark/runhash.sh b/tests/benchmark/runhash.sh index 2ae73e9..dc894d4 100755 --- a/tests/benchmark/runhash.sh +++ b/tests/benchmark/runhash.sh @@ -18,8 +18,17 @@ TIME_UNITS=$1 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. -NUM_CPUS=$(nproc) if [[ ${NUM_CPUS} -lt 4 ]]; then NUM_CPUS=4 # Floor at 4 due to following assumptions. fi -- 2.34.1