xref: /aosp_15_r20/external/ltp/tools/genload/README (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard WorkerUSAGE
2*49cdfc7eSAndroid Build Coastguard Worker
3*49cdfc7eSAndroid Build Coastguard WorkerSee the program's usage statement by invoking with --help.
4*49cdfc7eSAndroid Build Coastguard Worker
5*49cdfc7eSAndroid Build Coastguard WorkerNOTES
6*49cdfc7eSAndroid Build Coastguard Worker
7*49cdfc7eSAndroid Build Coastguard WorkerThis program works really well for me, but it might not have some of the
8*49cdfc7eSAndroid Build Coastguard Workerfeatures that you want.  If you would like, please extend the code and send
9*49cdfc7eSAndroid Build Coastguard Workerme the patch[1].  Enjoy the program :-)
10*49cdfc7eSAndroid Build Coastguard Worker
11*49cdfc7eSAndroid Build Coastguard WorkerPlease use the context diff format.  That is: save the original program
12*49cdfc7eSAndroid Build Coastguard Workeras stress.c.orig, then make and test your desired changes to stress.c, then
13*49cdfc7eSAndroid Build Coastguard Workerrun 'diff -u stress.c.orig stress.c' to produce a context patch.  Thanks.
14*49cdfc7eSAndroid Build Coastguard Worker
15*49cdfc7eSAndroid Build Coastguard WorkerAmos Waterland <[email protected]>
16*49cdfc7eSAndroid Build Coastguard WorkerNorman, Oklahoma
17*49cdfc7eSAndroid Build Coastguard Worker27 Nov 2001
18*49cdfc7eSAndroid Build Coastguard Worker
19*49cdfc7eSAndroid Build Coastguard WorkerEXAMPLES
20*49cdfc7eSAndroid Build Coastguard Worker[examples]
21*49cdfc7eSAndroid Build Coastguard Worker
22*49cdfc7eSAndroid Build Coastguard WorkerThe simple case is that you just want to bring the system load average up to
23*49cdfc7eSAndroid Build Coastguard Workeran arbitrary value.  The following forks 13 processes, each of which spins
24*49cdfc7eSAndroid Build Coastguard Workerin a tight loop calculating the sqrt() of a random number acquired with
25*49cdfc7eSAndroid Build Coastguard Workerrand().
26*49cdfc7eSAndroid Build Coastguard Worker
27*49cdfc7eSAndroid Build Coastguard Worker  % stress -c 13
28*49cdfc7eSAndroid Build Coastguard Worker
29*49cdfc7eSAndroid Build Coastguard WorkerLong options are supported, as well as is making the output less verbose.
30*49cdfc7eSAndroid Build Coastguard WorkerThe following forks 1024 processes, and only reports error messages if any.
31*49cdfc7eSAndroid Build Coastguard Worker
32*49cdfc7eSAndroid Build Coastguard Worker  % stress --quiet --hogcpu 1k
33*49cdfc7eSAndroid Build Coastguard Worker
34*49cdfc7eSAndroid Build Coastguard WorkerTo see how your system performs when it is I/O bound, use the -i switch.
35*49cdfc7eSAndroid Build Coastguard WorkerThe following forks 4 processes, each of which spins in a tight loop calling
36*49cdfc7eSAndroid Build Coastguard Workersync(), which is a system call that flushes memory buffers to disk.
37*49cdfc7eSAndroid Build Coastguard Worker
38*49cdfc7eSAndroid Build Coastguard Worker  % stress -i 4
39*49cdfc7eSAndroid Build Coastguard Worker
40*49cdfc7eSAndroid Build Coastguard WorkerMultiple hogs may be combined on the same command line.  The following does
41*49cdfc7eSAndroid Build Coastguard Workereverything the preceding examples did in one command, but also turns up the
42*49cdfc7eSAndroid Build Coastguard Workerverbosity level as well as showing how to cause the command to
43*49cdfc7eSAndroid Build Coastguard Workerself-terminate after 1 minute.
44*49cdfc7eSAndroid Build Coastguard Worker
45*49cdfc7eSAndroid Build Coastguard Worker  % stress -c 13 -i 4 --verbose --timeout 1m
46*49cdfc7eSAndroid Build Coastguard Worker
47*49cdfc7eSAndroid Build Coastguard WorkerAn value of 0 normally denotes infinity.  The following is how to do a fork
48*49cdfc7eSAndroid Build Coastguard Workerbomb (be careful with this).
49*49cdfc7eSAndroid Build Coastguard Worker
50*49cdfc7eSAndroid Build Coastguard Worker  % stress -c 0
51*49cdfc7eSAndroid Build Coastguard Worker
52*49cdfc7eSAndroid Build Coastguard WorkerFor the -m and -d options, a value of 0 means to redo their operation an
53*49cdfc7eSAndroid Build Coastguard Workerinfinite number of times.  To allocate and free 128MB in a redo loop use the
54*49cdfc7eSAndroid Build Coastguard Workerfollowing command.  This can be useful for "bouncing" against the system RAM
55*49cdfc7eSAndroid Build Coastguard Workerceiling.
56*49cdfc7eSAndroid Build Coastguard Worker
57*49cdfc7eSAndroid Build Coastguard Worker  % stress -m 0 --hogvm-bytes 128M
58*49cdfc7eSAndroid Build Coastguard Worker
59*49cdfc7eSAndroid Build Coastguard WorkerFor the -m and -d options, a negative value of n means to redo the operation
60*49cdfc7eSAndroid Build Coastguard Workerabs(n) times.  Here is now to allocate and free 5MB three times in a row.
61*49cdfc7eSAndroid Build Coastguard Worker
62*49cdfc7eSAndroid Build Coastguard Worker  % stress -m -3 --hogvm-bytes 5m
63*49cdfc7eSAndroid Build Coastguard Worker
64*49cdfc7eSAndroid Build Coastguard WorkerYou can write a file of arbitrary length to disk.  The file is created with
65*49cdfc7eSAndroid Build Coastguard Workermkstemp() in the current directory, the default is to unlink it, but
66*49cdfc7eSAndroid Build Coastguard Workerunlinking can be overridden with the --hoghdd-noclean flag.
67*49cdfc7eSAndroid Build Coastguard Worker
68*49cdfc7eSAndroid Build Coastguard Worker  % stress -d 1 --hoghdd-noclean --hoghdd-bytes 13
69*49cdfc7eSAndroid Build Coastguard Worker
70*49cdfc7eSAndroid Build Coastguard WorkerLarge file support is enabled.
71*49cdfc7eSAndroid Build Coastguard Worker
72*49cdfc7eSAndroid Build Coastguard Worker  % stress -d 1 --hoghdd-noclean --hoghdd-bytes 3G
73