diff options
author | Paul E. McKenney <paulmck@kernel.org> | 2019-10-21 18:38:00 +0300 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2019-12-10 00:00:27 +0300 |
commit | b8dfff975c370912c7ac633ca3e4a812dcd38f96 (patch) | |
tree | 8645331ce3007a1003053f31a94fa6d5add5e480 /tools/testing/selftests/rcutorture | |
parent | 517f17aed0ce678dfa82d7dd4e2593fc1bac799c (diff) | |
download | linux-b8dfff975c370912c7ac633ca3e4a812dcd38f96.tar.xz |
torture: Handle systems lacking the mpstat command
The rcutorture scripting uses the mpstat command to determine how much
the system is being used, and adjusts make's -j argument accordingly.
However, mpstat isn't installed by default, so it would be good if the
scripting does something useful when mpstat isn't present.
This commit therefore makes the scripts assumes that if mpstat is not
present, they are free to use all the CPUs.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'tools/testing/selftests/rcutorture')
-rwxr-xr-x | tools/testing/selftests/rcutorture/bin/cpus2use.sh | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/testing/selftests/rcutorture/bin/cpus2use.sh b/tools/testing/selftests/rcutorture/bin/cpus2use.sh index 4e9485590c10..1dbfb62567d2 100755 --- a/tools/testing/selftests/rcutorture/bin/cpus2use.sh +++ b/tools/testing/selftests/rcutorture/bin/cpus2use.sh @@ -15,8 +15,15 @@ then exit 0 fi ncpus=`grep '^processor' /proc/cpuinfo | wc -l` -idlecpus=`mpstat | tail -1 | \ - awk -v ncpus=$ncpus '{ print ncpus * ($7 + $NF) / 100 }'` +if mpstat -V > /dev/null 2>&1 +then + idlecpus=`mpstat | tail -1 | \ + awk -v ncpus=$ncpus '{ print ncpus * ($7 + $NF) / 100 }'` +else + # No mpstat command, so use all available CPUs. + echo The mpstat command is not available, so greedily using all CPUs. + idlecpus=$ncpus +fi awk -v ncpus=$ncpus -v idlecpus=$idlecpus < /dev/null ' BEGIN { cpus2use = idlecpus; |