1994-09-26 21:22:57 +00:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1994 Christopher G. Demetriou
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
|
|
|
.\" This product includes software developed by Christopher G. Demetriou.
|
|
|
|
.\" 3. The name of the author may not be used to endorse or promote products
|
|
|
|
.\" derived from this software without specific prior written permission
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
.\"
|
1999-08-28 01:35:59 +00:00
|
|
|
.\" $FreeBSD$
|
1994-09-26 21:22:57 +00:00
|
|
|
.\"
|
2007-05-18 12:36:10 +00:00
|
|
|
.Dd May 18, 2007
|
1994-09-26 21:22:57 +00:00
|
|
|
.Dt SA 8
|
1994-09-26 21:41:06 +00:00
|
|
|
.Os
|
1994-09-26 21:22:57 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm sa
|
|
|
|
.Nd print system accounting statistics
|
|
|
|
.Sh SYNOPSIS
|
2000-11-20 20:10:44 +00:00
|
|
|
.Nm
|
1994-09-26 21:22:57 +00:00
|
|
|
.Op Fl abcdDfijkKlmnqrstu
|
2007-05-18 12:36:10 +00:00
|
|
|
.Op Fl P Ar file
|
|
|
|
.Op Fl U Ar file
|
1994-09-26 21:22:57 +00:00
|
|
|
.Op Fl v Ar cutoff
|
|
|
|
.Op Ar
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
1997-10-15 06:41:19 +00:00
|
|
|
.Nm
|
1994-09-26 21:22:57 +00:00
|
|
|
utility reports on, cleans up,
|
|
|
|
and generally maintains system
|
|
|
|
accounting files.
|
|
|
|
.Pp
|
2002-07-14 14:47:15 +00:00
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility is able to condense the information in
|
1994-09-26 21:22:57 +00:00
|
|
|
.Pa /var/account/acct
|
|
|
|
into the summary files
|
|
|
|
.Pa /var/account/savacct
|
|
|
|
and
|
|
|
|
.Pa /var/account/usracct ,
|
|
|
|
which contain system statistics according
|
|
|
|
to command name and login id, respectively.
|
|
|
|
This condensation is desirable because on a
|
|
|
|
large system,
|
|
|
|
.Pa /var/account/acct
|
|
|
|
can grow by hundreds of blocks per day.
|
|
|
|
The summary files are normally read before
|
|
|
|
the accounting file, so that reports include
|
|
|
|
all available information.
|
|
|
|
.Pp
|
|
|
|
If file names are supplied, they are read instead of
|
1996-04-07 00:06:21 +00:00
|
|
|
.Pa /var/account/acct .
|
1994-09-26 21:22:57 +00:00
|
|
|
After each file is read, if the summary
|
|
|
|
files are being updated, an updated summary will
|
2004-07-02 23:13:00 +00:00
|
|
|
be saved to disk.
|
|
|
|
Only one report is printed,
|
1994-09-26 21:22:57 +00:00
|
|
|
after the last file is processed.
|
|
|
|
.Pp
|
|
|
|
The labels used in the output indicate the following, except
|
|
|
|
where otherwise specified by individual options:
|
|
|
|
.Bl -tag -width k*sec
|
|
|
|
.It Dv avio
|
|
|
|
Average number of I/O operations per execution
|
|
|
|
.It Dv cp
|
|
|
|
Sum of user and system time, in minutes
|
|
|
|
.It Dv cpu
|
|
|
|
Same as
|
2001-07-15 08:06:20 +00:00
|
|
|
.Dv cp
|
1994-09-26 21:22:57 +00:00
|
|
|
.It Dv k
|
|
|
|
CPU-time averaged core usage, in 1k units
|
|
|
|
.It Dv k*sec
|
|
|
|
CPU storage integral, in 1k-core seconds
|
|
|
|
.It Dv re
|
|
|
|
Real time, in minutes
|
|
|
|
.It Dv s
|
|
|
|
System time, in minutes
|
|
|
|
.It Dv tio
|
|
|
|
Total number of I/O operations
|
|
|
|
.It Dv u
|
|
|
|
User time, in minutes
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The options to
|
1997-10-15 06:41:19 +00:00
|
|
|
.Nm
|
1994-09-26 21:22:57 +00:00
|
|
|
are:
|
|
|
|
.Bl -tag -width Ds
|
|
|
|
.It Fl a
|
|
|
|
List all command names, including those containing unprintable
|
2004-07-02 23:13:00 +00:00
|
|
|
characters and those used only once.
|
|
|
|
By default,
|
1997-10-15 06:41:19 +00:00
|
|
|
.Nm
|
1994-09-26 21:22:57 +00:00
|
|
|
places all names containing unprintable characters and
|
|
|
|
those used only once under the name ``***other''.
|
|
|
|
.It Fl b
|
|
|
|
If printing command statistics, sort output by the sum of user and system
|
|
|
|
time divided by number of calls.
|
|
|
|
.It Fl c
|
2001-07-15 08:06:20 +00:00
|
|
|
In addition to the number of calls and the user, system and real times
|
1994-09-26 21:22:57 +00:00
|
|
|
for each command, print their percentage of the total over all commands.
|
|
|
|
.It Fl d
|
|
|
|
If printing command statistics, sort by the average number of disk
|
2004-07-02 23:13:00 +00:00
|
|
|
I/O operations.
|
|
|
|
If printing user statistics, print the average number of
|
1994-09-26 21:22:57 +00:00
|
|
|
disk I/O operations per user.
|
|
|
|
.It Fl D
|
|
|
|
If printing command statistics, sort and print by the total number
|
|
|
|
of disk I/O operations.
|
|
|
|
.It Fl f
|
|
|
|
Force no interactive threshold comparison with the
|
|
|
|
.Fl v
|
|
|
|
option.
|
|
|
|
.It Fl i
|
|
|
|
Do not read in the summary files.
|
|
|
|
.It Fl j
|
|
|
|
Instead of the total minutes per category, give seconds per call.
|
|
|
|
.It Fl k
|
|
|
|
If printing command statistics, sort by the cpu-time average memory
|
2004-07-02 23:13:00 +00:00
|
|
|
usage.
|
|
|
|
If printing user statistics, print the cpu-time average
|
1994-09-26 21:22:57 +00:00
|
|
|
memory usage.
|
|
|
|
.It Fl K
|
|
|
|
If printing command statistics, print and sort by the cpu-storage integral.
|
|
|
|
.It Fl l
|
|
|
|
Separate system and user time; normally they are combined.
|
|
|
|
.It Fl m
|
|
|
|
Print per-user statistics rather than per-command statistics.
|
|
|
|
.It Fl n
|
|
|
|
Sort by number of calls.
|
2007-05-18 12:36:10 +00:00
|
|
|
.It Fl P Ar file
|
|
|
|
Use the specified
|
|
|
|
.Ar file
|
|
|
|
for accessing the per-command accounting summary database,
|
|
|
|
instead of the default
|
|
|
|
.Pa /var/account/savacct .
|
1994-09-26 21:22:57 +00:00
|
|
|
.It Fl q
|
|
|
|
Create no output other than error messages.
|
|
|
|
.It Fl r
|
|
|
|
Reverse order of sort.
|
|
|
|
.It Fl s
|
|
|
|
Truncate the accounting files when done and merge their data
|
|
|
|
into the summary files.
|
|
|
|
.It Fl t
|
|
|
|
For each command, report the ratio of real time to the sum
|
|
|
|
of user and system cpu times.
|
|
|
|
If the cpu time is too small to report, ``*ignore*'' appears in
|
|
|
|
this field.
|
2007-05-18 12:36:10 +00:00
|
|
|
.It Fl U Ar file
|
|
|
|
Use the specified
|
|
|
|
.Ar file
|
|
|
|
for accessing the per-user accounting summary database,
|
|
|
|
instead of the default
|
|
|
|
.Pa /var/account/usracct .
|
1994-09-26 21:22:57 +00:00
|
|
|
.It Fl u
|
|
|
|
Superseding all other flags, for each entry
|
|
|
|
in the accounting file, print the user ID, total seconds of cpu usage,
|
|
|
|
total memory usage, number of I/O operations performed, and
|
|
|
|
command name.
|
|
|
|
.It Fl v Ar cutoff
|
|
|
|
For each command used
|
|
|
|
.Ar cutoff
|
|
|
|
times or fewer, print the command name and await a reply
|
2004-07-02 23:13:00 +00:00
|
|
|
from the terminal.
|
|
|
|
If the reply begins with ``y'', add
|
|
|
|
the command to the category ``**junk**''.
|
|
|
|
This flag is
|
1994-09-26 21:22:57 +00:00
|
|
|
used to strip garbage from the report.
|
|
|
|
.El
|
|
|
|
.Pp
|
2004-07-02 23:13:00 +00:00
|
|
|
By default, per-command statistics will be printed.
|
|
|
|
The number of
|
1994-09-26 21:22:57 +00:00
|
|
|
calls, the total elapsed time in minutes, total cpu and user time
|
|
|
|
in minutes, average number of I/O operations, and CPU-time
|
2004-07-02 23:13:00 +00:00
|
|
|
averaged core usage will be printed.
|
|
|
|
If the
|
1994-09-26 21:22:57 +00:00
|
|
|
.Fl m
|
|
|
|
option is specified, per-user statistics will be printed, including
|
|
|
|
the user name, the number of commands invoked, total cpu time used
|
|
|
|
(in minutes), total number of I/O operations, and CPU storage integral
|
2004-07-02 23:13:00 +00:00
|
|
|
for each user.
|
|
|
|
If the
|
1994-09-26 21:22:57 +00:00
|
|
|
.Fl u
|
|
|
|
option is specified, the uid, user and system time (in seconds),
|
|
|
|
CPU storage integral, I/O usage, and command name will be printed
|
|
|
|
for each entry in the accounting data file.
|
|
|
|
.Pp
|
|
|
|
If the
|
|
|
|
.Fl u
|
|
|
|
flag is specified, all flags other than
|
|
|
|
.Fl q
|
2004-07-02 23:13:00 +00:00
|
|
|
are ignored.
|
|
|
|
If the
|
1994-09-26 21:22:57 +00:00
|
|
|
.Fl m
|
|
|
|
flag is specified, only the
|
|
|
|
.Fl b ,
|
|
|
|
.Fl d ,
|
|
|
|
.Fl i ,
|
|
|
|
.Fl k ,
|
|
|
|
.Fl q ,
|
|
|
|
and
|
2001-07-15 08:06:20 +00:00
|
|
|
.Fl s
|
1994-09-26 21:22:57 +00:00
|
|
|
flags are honored.
|
|
|
|
.Sh FILES
|
|
|
|
.Bl -tag -width /var/account/usracct -compact
|
|
|
|
.It Pa /var/account/acct
|
|
|
|
raw accounting data file
|
|
|
|
.It Pa /var/account/savacct
|
|
|
|
per-command accounting summary database
|
|
|
|
.It Pa /var/account/usracct
|
|
|
|
per-user accounting summary database
|
|
|
|
.El
|
2005-01-18 20:02:45 +00:00
|
|
|
.Sh EXIT STATUS
|
|
|
|
.Ex -std
|
1994-09-26 21:22:57 +00:00
|
|
|
.Sh SEE ALSO
|
1997-01-20 00:03:00 +00:00
|
|
|
.Xr lastcomm 1 ,
|
1994-09-26 21:22:57 +00:00
|
|
|
.Xr acct 5 ,
|
1997-01-20 00:03:00 +00:00
|
|
|
.Xr ac 8 ,
|
|
|
|
.Xr accton 8
|
2010-05-13 12:08:11 +00:00
|
|
|
.Sh AUTHORS
|
2014-06-20 09:57:27 +00:00
|
|
|
.An Chris G. Demetriou Aq Mt cgd@postgres.berkeley.edu
|
1994-09-26 21:22:57 +00:00
|
|
|
.Sh CAVEATS
|
|
|
|
While the behavior of the options in this version of
|
1997-10-15 06:41:19 +00:00
|
|
|
.Nm
|
1994-09-26 21:22:57 +00:00
|
|
|
was modeled after the original version, there are some intentional
|
2004-07-02 23:13:00 +00:00
|
|
|
differences and undoubtedly some unintentional ones as well.
|
|
|
|
In
|
1994-09-26 21:22:57 +00:00
|
|
|
particular, the
|
|
|
|
.Fl q
|
|
|
|
option has been added, and the
|
|
|
|
.Fl m
|
|
|
|
option now understands more options than it used to.
|
|
|
|
.Pp
|
|
|
|
The formats of the summary files created by this version of
|
1997-10-15 06:41:19 +00:00
|
|
|
.Nm
|
2000-01-29 01:54:59 +00:00
|
|
|
are very different from the those used by the original version.
|
1994-09-26 21:22:57 +00:00
|
|
|
This is not considered a problem, however, because the accounting record
|
|
|
|
format has changed as well (since user ids are now 32 bits).
|
2005-01-18 20:02:45 +00:00
|
|
|
.Sh BUGS
|
|
|
|
The number of options to this program is absurd, especially considering
|
2005-02-13 23:45:54 +00:00
|
|
|
that there is not much logic behind their lettering.
|
2005-01-18 20:02:45 +00:00
|
|
|
.Pp
|
|
|
|
The field labels should be more consistent.
|
|
|
|
.Pp
|
|
|
|
The VM system does not record the CPU storage integral.
|