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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
|
.TH SA 8 "1997 August 19"
.SH NAME
sa \- summarizes accounting information
.SH SYNOPSIS
.hy 0
.na
.TP
.B sa
[
.B \-a
|
.B \-\-list-all-names
]
.br
[
.B \-b
|
.B \-\-sort-sys-user-div-calls
]
.br
[
.B \-c
|
.B \-\-percentages
]
[
.B \-d
|
.B \-\-sort-avio
]
.br
[
.B \-D
|
.B \-\-sort-tio
]
[
.B \-f
|
.B \-\-not-interactive
]
.br
[
.B \-i
|
.B \-\-dont-read-summary-files
]
.br
[
.B \-j
|
.B \-\-print-seconds
]
[
.B \-k
|
.B \-\-sort-cpu-avmem
]
.br
[
.B \-K
|
.B \-\-sort-ksec
]
[
.B \-l
|
.B \-\-separate-times
]
.br
[
.B \-m
|
.B \-\-user-summary
]
[
.B \-n
|
.B \-\-sort-num-calls
]
.br
[
.B \-p
|
.B \-\-show-paging
]
[
.B \-P
|
.B \-\-show-paging-avg
]
.br
[
.B \-r
|
.B \-\-reverse-sort
]
[
.B \-s
|
.B \-\-merge
]
.br
[
.B \-t
|
.B \-\-print-ratio
]
[
.B \-u
|
.B \-\-print-users
]
.br
[
.BI \-v " num"
|
.BI \-\-threshold " num"
]
[
.B \-\-sort-real-time
]
.br
[
.B \-\-debug
]
[
.B \-V
|
.B \-\-version
]
[
.B \-h
|
.B \-\-help
]
.br
[
.BI "\-\-other-usracct-file " filename
]
[
.BI \-\-ahz " hz"
]
.br
[
.BI "\-\-other-savacct-file " filename
]
.br
[
[
.B "\-\-other-acct-file "
]
.I filename
]
.SH DESCRIPTION
.LP
.B sa
summarizes information about previously executed commands as
recorded in the
.I acct
file. In addition, it condenses this data into a summary file named
.I savacct
which contains the number of times the command was called and the system
resources used. The information can also be summarized on a per-user
basis;
.B sa
will save this information into a file named
.I usracct.
.LP
If no arguments are specified,
.B sa
will print information about all of the commands in the
.I acct
file.
.LP
If called with a file name as the last argument,
.B sa
will use that file instead of the system's default
.I acct
file.
.LP
By default,
.B sa
will sort the output by sum of user and system time.
If command names have unprintable characters, or are only called once,
.B sa
will sort them into a group called `***other'.
If more than one sorting option is specified, the list will
be sorted by the one specified last on the command line.
.LP
The output fields are labeled as follows:
.TP
.I cpu
sum of system and user time in cpu minutes
.TP
.I re
"elapsed time" in minutes
.TP
.I k
cpu-time averaged core usage, in 1k units
.TP
.I avio
average number of I/O operations per execution
.TP
.I tio
total number of I/O operations
.TP
.I k*sec
cpu storage integral (kilo-core seconds)
.TP
.I u
user cpu time in cpu seconds
.TP
.I s
system time in cpu seconds
.LP
Note that these column titles do not appear in the first row of the
table, but after each numeric entry (as units of measurement) in every
row. For example, you might see `79.29re', meaning 79.29 cpu seconds
of "real time".
.LP
An asterisk will appear after the name of commands that forked but didn't call
.B exec.
.LP
GNU
.B sa
takes care to implement a number of features not found in other versions.
For example, most versions of
.B sa
don't pay attention to flags like `\-\-print-seconds' and
`\-\-sort-num-calls' when printing out commands when combined with
the `\-\-user-summary' or `\-\-print-users' flags. GNU
.B sa
pays attention to these flags if they are applicable.
Also, MIPS'
.B sa
stores the average memory use as a short rather than a double, resulting
in some round-off errors. GNU
.B sa
uses double the whole way through.
.SH OPTIONS
.LP
The availability of these program options depends on your operating
system. In specific, the members that appear in the
.B struct acct
of your system's process accounting header file (usually
.I acct.h
) determine which flags will be present. For example, if your system's
.B struct acct
doesn't have the `ac_mem' field, the installed
version of
.B sa
will not support the `\-\-sort-cpu-avmem', `\-\-sort-ksec', `\-k', or
`\-K' options.
.LP
In short, all of these flags may not be available on your machine.
.TP
.PD 0
.B \-a, \-\-list-all-names
Force
.B sa
not to sort those command names with unprintable characters and those
used only once into the
.I ***other
group.
.TP
.B \-b, \-\-sort-sys-user-div-calls
Sort the output by the sum of user and system time divided by the
number of calls.
.TP
.B \-c, \-\-percentages
Print percentages of total time for the command's user, system,
and real time values.
.TP
.B \-d, \-\-sort-avio
Sort the output by the average number of disk I/O operations.
.TP
.B \-D, \-\-sort-tio
Print and sort the output by the total number of disk I/O operations.
.TP
.B \-f, \-\-not-interactive
When using the `\-\-threshold' option, assume that all answers to
interactive queries will be affirmative.
.TP
.B \-i, \-\-dont-read-summary-files
Don't read the information in the system's default
.I savacct
file.
.TP
.B \-j, \-\-print-seconds
Instead of printing total minutes for each category, print seconds per call.
.TP
.B \-k, \-\-sort-cpu-avmem
Sort the output by cpu time average memory usage.
.TP
.B \-K, \-\-sort-ksec
Print and sort the output by the cpu-storage integral.
.TP
.B \-l, \-\-separate-times
Print separate columns for system and user time; usually the two
are added together and listed as `cpu'.
.TP
.B \-m, \-\-user-summary
Print the number of processes and number of CPU minutes on a
per-user basis.
.TP
.B \-n, \-\-sort-num-calls
Sort the output by the number of calls. This is the default sorting method.
.TP
.B \-p, \-\-show-paging
Print the number of minor and major pagefaults and swaps.
.TP
.B \-P, \-\-show-paging-avg
Print the number of minor and major pagefaults and swaps divided by
the number of calls.
.TP
.B \-r, \-\-reverse-sort
Sort output items in reverse order.
.TP
.B \-s, \-\-merge
Merge the summarized accounting data into the summary files
.I savacct
and
.I usracct.
.TP
.B \-t, \-\-print-ratio
For each entry, print the ratio of real time to the sum of system
and user times. If the sum of system and user times is too small
to report--the sum is zero--`*ignore*' will appear in this field.
.TP
.B \-u, \-\-print-users
For each command in the accounting file, print the userid and
command name. After printing all entries, quit. *Note*: this flag
supersedes all others.
.TP
.BI \-v " num " \-\-threshold " num"
Print commands which were executed
.I num
times or fewer and await a
reply from the terminal. If the response begins with `y', add the
command to the `**junk**' group.
.TP
.B \-\-separate-forks
It really doesn't make any sense to me that the stock version of
.B sa
separates statistics for a particular executable depending on
whether or not that command forked. Therefore, GNU
.B sa
lumps this information together unless this option is specified.
.TP
.BI \-\-ahz " hz"
Use this flag to tell the program what
.B AHZ
should be (in hertz). This option is useful if you are trying to view
an
.I acct
file created on another machine which has the same byte order and file
format as your current machine, but has a different value for
.B AHZ.
.TP
.B \-\-debug
Print verbose internal information.
.TP
.B \-V, \-\-version
Print the version number of
.B sa.
.TP
.B \-h, \-\-help
Prints the usage string and default locations of system files to
standard output and exits.
.TP
.BI \-\-sort-real-time
Sort the output by the "real time" field.
.TP
.BI \-\-other-usracct-file " filename"
Write summaries by user ID to
.I filename
rather than the system's default
.I usracct
file.
.TP
.BI \-\-other-savacct-file " filename"
Write summaries by command name to
.I filename
rather than the system's default
.I SAVACCT
file.
.TP
.BI \-\-other-acct-file " filename"
Read from the file
.I filename
instead of the system's default
.I ACCT
file.
.SH FILES
.TP
.I acct
The raw system wide process accounting file. See
.BR acct (5)
for further details.
.TP
.I savacct
A summary of system process accounting sorted by command.
.TP
.I usracct
A summary of system process accounting sorted by user ID.
.RE
.LP
.SH BUGS
There is not yet a wide experience base for comparing the output of GNU
.B sa
with versions of
.B sa
in many other systems. The problem is that the data files grow big in a short
time and therefore require a lot of disk space.
.LP
.SH AUTHOR
The GNU accounting utilities were written by Noel Cragg
<noel@gnu.ai.mit.edu>. The man page was adapted from the accounting
texinfo page by Susan Kleinmann <sgk@sgk.tiac.net>.
.SH "SEE ALSO"
.BR acct (5),
.BR ac (1)
|