-
Notifications
You must be signed in to change notification settings - Fork 12
/
lookbusy.1
215 lines (159 loc) · 7.94 KB
/
lookbusy.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
." $Id$
.TH lookbusy
.SH NAME
lookbusy \- a synthetic load generator
.SH SYNOPSIS
\fBlookbusy\fR [OPTIONS]
.SH DESCRIPTION
lookbusy generates synthetic CPU, memory and disk access loads on a host. CPU
load is induced by simple arithmetic looping (with as little memory bandwidth
consumption as feasible) alternating with periods of sleeping in an attempt to
generate the degree of utilization selected. Memory load is induced by
allocating a buffer of a controllable size, then steadily stirring it to keep
the pages active from the VM standpoint. Disk load is induced through
creation of one or more files, and copying blocks of it between two moving
positions.
.SH OPTIONS
.TP
\-h, \-\-help
Display commandline help.
.TP
\-V, \-\-version
Display the lookbusy version and copyright information.
.TP
\-v, \-\-verbose
Produce verbose output; may be specified more than once for additional noise.
.TP
\-q, \-\-quiet
Be quiet; produce error output only.
.TP
\-c \fIutil\fR[\-\fIhigh_util\fR], \-\-cpu\-util \fIutil\fR[\-\fIhigh_util\fR]
Attempt to use between \fIutil\fR and \fIhigh_util\fR percent of time on each
CPU. For fixed usage mode (see \fB\-\-cpu\-mode\fR), only \fIutil\fR should
be given. For curved usage mode, a range should be given. If specified,
\fIhigh_util\fR should be greater than \fIutil\fR, and both values must be
between 0 and 100 inclusive.
Prior to starting, a short benchmark will be attempted to establish a
spin/sleep ratio needed; this estimate assumes that all CPUs are of equal
speed, and that at least one CPU is unutilized during the test. The default
is 50%.
.TP
\-n \fIn\fR, \-\-ncpus \fIn\fR
Specify explicitly that \fIn\fR CPUs are to be kept busy, instead of
attempting to auto-detect how many physical CPUs are involved.
.TP
\-r \fImode\fR, \-\-cpu\-mode \fImode\fR
Select a CPU utilization mode. \fImode\fR must be one of \fBfixed\fR
or \fBcurve\fR. The default is \fBfixed\fR.
In \fBfixed\fR mode, lookbusy will attempt to maintain a constant CPU usage at
the level specified (see \fI\-\-cpu\-util\fR).
In \fBcurve\fR mode, CPU usage will vary between the range specified (again,
see \fI\-\-cpu\-util\fR) according to a repeating curve function having a
period specified by \fI\-\-cpu\-curve\-period\fR and a peak at the offset
within that period specified by \fI\-\-cpu\-curve\-peak\fR. The default curve
period is 24 hours long, with a peak at local midnight (or midnight GMT, if
\-\-utc is given). As of version 1.0, this curve is simply a cosine function,
though this may change in future releases.
.TP
\-P \fIinterval\fR[\fIunit\fR], \-\-cpu\-curve\-period \fIinterval\fR[\fIunit\fR]
When using the \fBcurve\fR CPU usage mode, this option specifies the
repetition period (frequency). The utilization curve will return to its peak
once per interval. The interval is be specified as an integer, optionally
followed by one of \fBd\fR (days), \fBh\fR (hours), \fBm\fR (minutes) or
\fBs\fR (seconds). For example, \fB12h\fR would specify a 12-hour utilization
cycle. If no units are specified, the value is interpreted as a number of
seconds.
.TP
\-p \fIoffset\fR[\fIunit\fR], \-\-cpu\-curve\-peak \fIinterval\fR[\fIunit\fR]
When using the \fBcurve\fR CPU mode, this option specifies the offset of the
peak within the usage cycle. As with \fB\-\-cpu\-curve\-period\fR above,
\fIoffset\fR is given as an integer, optionally followed by \fBd\fR, \fBh\fR,
\fBm\fR or \fBs\fR. The default is chosen so as to place the peak at midnight
local time (or UTC, if \-\-utc is given).
.TP
\-u, \-\-utc
When computing time-relative utilization curves, make these computations for
the UTC/GMT timezone. If not specified, the host timezone is used.
.TP
\-m \fIutil\fR, \-\-mem-util \fIutil\fR
Keep \fIutil\fR mebibytes (1024^2 bytes) of memory utilized. This memory
will be allocated, then continually stirred to ensure it is actually
allocated in the VM system and impose pressure to keep it resident. The
default is 0 (disabled).
.TP
\-M \fIinterval\fR, \-\-mem\-sleep \fIinterval\fIR
Sleep \fIinterval\fR milliseconds after each memory stir iteration. The
iteration reads and writes \fBPAGE_SIZE\fR bytes each from independently
cycling positions in the working buffer. The default is 1ms, which will
produce very little visible load on modern hardware, but will cover a 1GB
utilization buffer in roughly 4 minutes.
.TP
\-d \fIsize\fR[\fIunit\fR], \-\-disk\-util \fIsize\fR[\fIunit\fR]
Generate disk activity by creating and updating a buffer of the given size.
The integer value \fIsize\fR may optionally be followed by one of \fBb\fR
(bytes), \fBkb\fR (kilobytes), \fBmb\fR (megabytes), \fBgb\fR (gigabytes) or
\fBtb\fR (terabytes). The default is 0 (disk churn disabled).
.TP
\-D \fIinterval\fR, \-\-disk\-sleep \fIinterval\fR
Sleep \fIinterval\fR milliseconds after each iteration of the disk churn loop.
Each iteration will read and write a block of data (see \fB\-b\fR) from two
independently cycling positions in a scratch file. See also \fB\-f\fR. The
default is 100ms.
.TP
\-b \fIblocksize\fR[\fIunit\fR], \-\-disk\-block\-size \fIblocksize\fR[\fIunit\fR]
Specifies the particular size of blocks copied within the file when generating
disk utilization. The value given may be followed by one of \fBb\fR (bytes),
\fBkb\fR (kilobytes), \fBmb\fR (megabytes), or \fBgb\fR (gigabytes); if no unit
is given, bytes are assumed. The default block size is 32768 bytes, or 32K.
.TP
\-f \fIpath\fR, \-\-disk\-path \fIpath\fR
Use a file at \fIpath\fR as a file on which to generate disk activity. If
\fIpath\fR does not exist, but its dirname (see \fBdirname(1)\fR) does, the
file will be used as specified. If \fIpath\fR exists and is a directory,
a secure temporary filename will be created within it and used.
.SH CPU UTILIZATION
If CPU utilization is enabled, a spinner process will be forked for each
physical CPU detected on the system (or a fixed number of spinners, if the
\fI-n\fR option is given.) All spinners will monitor \fB/proc/stat\fR's
cumulative CPU utilization counters, attempting to keep total system CPU load
at the desired level.
If other processes use a proportion of CPU time \fBless\fR than the chosen
amount, lookbusy will use the remainder. If other processes use \fBmore\fR
than the chosen amount, lookbusy will reduce its own usage to a minimum
until the load drops below the chosen level.
The self-adjustment technique can take a relatively long time, by
computational standards, to settle -- about 500ms on a 1GHz PowerPC CPU.
Because of this latency, lookbusy should not be expected to defer to
latency-sensitive applications quickly enough to avoid competing with them for
CPU during periods of escalating consumption.
.SH EXAMPLES
.TP
\fBlookbusy \-c 10\fR
Attempt to use 10% of all available CPUs.
.TP
\fBlookbusy \-c 75 \-n 2\fR
Attempt to keep up to two CPUs 75% utilized (if there is only one CPU, the two
spinners will divide the load, though not necessarily evenly).
.TP
\fBlookbusy \-\-cpu\-mode curve \-\-cpu-curve-peak 14h \-c 20\-80\fR
Maintain a CPU load of between 20% and 80%, on a curve repeating every 24
hours (the default), with its peak at 2PM local time.
.TP
\fBlookbusy \-c 20\-30 \-\-cpu\-mode curve \-\-cpu\-curve\-period 60m \-\-cpu\-curve\-peak 30m\fR
Maintain a CPU load on a utilization curve between 20% and 30%, reaching a
peak every hour on the half hour.
.TP
\fBlookbusy \-c 0 -m 512mb \-M 100\fR
Keep 512MB of memory occupied, with a memory stir iteration every ~100 usec;
don't use any other CPU time.
.TP
\fBlookbusy \-c 0 -d 2gb \-D 10 \-f /var/tmp/\fR
Generate disk traffic via a 2GB temporary file in /var/tmp/, with a 10
microsecond pause between each block operation. Don't use CPU time.
.SH COPYRIGHT
Copyright (c) 2006, Devin Carraway <[email protected]>
.br
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License, version 2 or (at your option) any later
version. See <http://www.gnu.org/licenses/gpl.html> for the text of this
license. There is NO WARRANTY, to the extent permitted by law.