staging: rtl8192u: remove redundant assignment to pointer crypt
[linux/fpc-iii.git] / tools / testing / selftests / rcutorture / bin / cpus2use.sh
blob4e9485590c10d5535a08ebf030518fcecb2e7be9
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0+
4 # Get an estimate of how CPU-hoggy to be.
6 # Usage: cpus2use.sh
8 # Copyright (C) IBM Corporation, 2013
10 # Authors: Paul E. McKenney <paulmck@linux.ibm.com>
12 if test -n "$TORTURE_ALLOTED_CPUS"
13 then
14 echo $TORTURE_ALLOTED_CPUS
15 exit 0
17 ncpus=`grep '^processor' /proc/cpuinfo | wc -l`
18 idlecpus=`mpstat | tail -1 | \
19 awk -v ncpus=$ncpus '{ print ncpus * ($7 + $NF) / 100 }'`
20 awk -v ncpus=$ncpus -v idlecpus=$idlecpus < /dev/null '
21 BEGIN {
22 cpus2use = idlecpus;
23 if (cpus2use < 1)
24 cpus2use = 1;
25 if (cpus2use < ncpus / 10)
26 cpus2use = ncpus / 10;
27 if (cpus2use == int(cpus2use))
28 cpus2use = int(cpus2use)
29 else
30 cpus2use = int(cpus2use) + 1
31 print cpus2use;