Call signals by names in cpuctl test
[ltp-debian.git] / testscripts / adp.sh
blobc2067292927135557988037326dd61a52c72e172
1 #!/bin/bash
3 # adp.sh -- run ADP's stress test on /proc/[0-9]*/cmdline
7 usage()
9 cat << EOF
10 usage: $0 options
12 This script runs ADP's stress test on /proc/[0-0]*/cmdline.
14 OPTIONS
15 -h display this message and exit
16 -d delay for top, in seconds
17 -n number of iterations for top
18 EOF
22 checkvar()
24 VAR=$1
25 eval VALUE='$'$VAR
26 if [ "x$VALUE" = "x" ]; then
27 echo "`basename $0`: $VAR is not set."
28 return 1
29 else
30 return 0
35 while getopts hd:n: OPTION
37 case $OPTION in
39 usage
40 exit 1
43 delay=$OPTARG
46 iterations=$OPTARG
49 usage
50 exit 1
52 esac
53 done
56 #check all vars
57 checkvar delay && checkvar iterations || {
58 usage
59 exit 2
62 echo "-------------------------------------------------------------------------"
63 date
64 echo "Starting tests..."
66 for i in 1 2 3 4 5
68 ./adp_children.sh &
69 done
71 echo "Stressing /proc/[0-9]*/cmdline..."
73 for i in 1 2 3 4 5
75 ./adp_test.sh &
76 done
78 echo "Starting 'top', redirecting output to 'adp.log'..."
79 top -b -d $delay -n $iterations > adp.log &
81 echo "LTP ADP Test done. Killing processes..."
82 killall adp_test.sh
83 killall adp_children.sh
85 echo "Done. Please check adp.log."
86 date
88 echo "-------------------------------------------------------------------------"