5 $0 [ -b path ] [ -s server ] [ -p port ] [ -m mntpoint ] [ -l path | seconds ]
7 Generate load, using an assorted set of commands and optionnaly:
8 - hackbench if the path to the hackbench binary is specified with -b;
9 - nc to send TCP data to "server" port "port" if -s is specified (if -p
10 is not specified, the port 9, aka discard is used);
11 - dd to write data under "mntpoint" if -m is specified.
13 during the runtime of the LTP test if the path to the LTP installation
14 directory is specifed with -l or during "seconds" seconds.
19 while [ $# -gt 0 ]; do
23 -b) shift; hackbench="$1"; shift
25 -s) shift; server="$1"; shift
27 -p) shift; port="$1"; shift
29 -m) shift; mntpoint="$1"; shift
31 -l) shift; ltpdir="$1"; shift
39 if [ -z "$ltpdir" -a $# -ne 1 ]; then
46 if [ -n "$server" ]; then
47 if type nc > /dev/null 2>&1; then
49 elif type netcat > /dev/null 2>&1; then
52 echo netcat or nc not found
56 seq 1 399999 > /tmp/netcat.data
57 ( while :; do cat /tmp/netcat.data; sleep 15; done | $nc $server $port ) &
61 if [ -n "$mntpoint" ]; then
62 while :; do dd if=/dev/zero of=$mntpoint/bigfile bs=1024000 count=100; done &
66 if [ -n "$hackbench" ]; then
67 while :; do $hackbench 1; done &
71 while :; do cat /proc/interrupts; done > /dev/null 2>&1 &
74 while :; do ps w; done > /dev/null 2>&1 &
77 dd if=/dev/zero of=/dev/null &
80 while :; do ls -lR / > /dev/null 2>&1; done &
83 test -e /proc/sys/kernel/hung_task_timeout_secs && \
84 echo 0 > /proc/sys/kernel/hung_task_timeout_secs
86 if [ -n "$ltpdir" ]; then
87 cd "$ltpdir" && ./runalltests.sh
88 cd "$ltpdir" && ./runalltests.sh
93 kill $pids > /dev/null 2>&1
95 killall -KILL cat $nc dd hackbench ls ps > /dev/null 2>&1
96 killall -KILL `basename $0` sleep > /dev/null 2>&1