accounting: sa

1 
1 4 `sa'
1 ******
1 
1 `sa' summarizes information about previously executed commands as
1 recorded in the `acct' file.  In addition, it condenses this data into
1 the `savacct' summary file, which contains the number of times the
1 command was called and the system resources used.  The information can
1 also be summarized on a per-user basis; `sa' will save this information
1 into `usracct'.  Usage:
1 
1    `sa [OPTS] [FILE]'
1 
1    If no arguments are specified, `sa' will print information about all
1 of the commands in the `acct' file.  If command names have unprintable
1 characters, or are only called once, `sa' will sort them into a group
1 called `***other'.  Overall totals for each field are gathered and
1 printed with a blank command name.
1 
1    If called with a file name as the last argument, `sa' will use that
1 file instead of `acct'.
1 
1    By default, `sa' will sort the output by sum of user and system time.
1 
1    The output fields are labeled as follows:
1 
1 `cpu'
1      sum of system and user time in cpu seconds
1 
1 `re'
1      "real time" in cpu seconds
1 
1 `k'
1      cpu-time averaged core usage, in 1k units
1 
1 `avio'
1      average number of I/O operations per execution
1 
1 `tio'
1      total number of I/O operations
1 
1 `k*sec'
1      cpu storage integral (kilo-core seconds)
1 
1 `u'
1      user cpu time in cpu seconds
1 
1 `s'
1      system time in cpu seconds
1 
1 
1    Note that these column titles do not appear in the first row of the
1 table, but after each numeric entry (as units of measurement) in every
1 row.  For example, you might see `79.29re', meaning 79.29 cpu seconds
1 of "real time."
1 
1    An asterisk will appear after the name of commands that forked but
1 didn't call `exec'.
1 
1 4.1 Flags
1 =========
1 
1 The availability of these program options depends on your operating
1 system.  In specific, the members that appear in the `struct acct' of
1 your system's process accounting header file (usually `acct.h')
1 determine which flags will be present.  For example, if your system's
1 `struct acct' doesn't have the `ac_mem' field, the installed version of
1 `sa' will not support the `--sort-cpu-avmem', `--sort-ksec', `-k', or
1 `-K' options.
1 
1    In short, all of these flags may not be available on your machine.
1 
1 `-a'
1 `--list-all-names'
1      Force `sa' not to sort those command names with unprintable
1      characters and those used only once into the ``***other'' group.
1 
1 `-b'
1 `--sort-sys-user-div-calls'
1      Sort the output by the sum of user and system time divided by the
1      number of calls.
1 
1 `-c'
1 `--percentages'
1      Print percentages of total time for the command's user, system,
1      and real time values.
1 
1 `-d'
1 `--sort-avio'
1      Sort the output by the average number of disk I/O operations.
1 
1 `-D'
1 `--sort-tio'
1      Print and sort the output by the total number of disk I/O
1      operations.
1 
1 `-f'
1 `--not-interactive'
1      When using the `--threshold' option, assume that all answers to
1      interactive queries will be affirmative.
1 
1 `-i'
1 `--dont-read-summary-file'
1      Don't read the information in `savacct'.
1 
1 `-j'
1 `--print-seconds'
1      Instead of printing total minutes for each category, print seconds
1      per call.
1 
1 `-k'
1 `--sort-cpu-avmem'
1      Sort the output by cpu time average memory usage.
1 
1 `-K'
1 `--sort-ksec'
1      Print and sort the output by the cpu-storage integral.
1 
1 `-l'
1 `--separate-times'
1      Print separate columns for system and user time; usually the two
1      are added together and listed as `cpu'.
1 
1 `-m'
1 `--user-summary'
1      Print the number of processes and number of CPU minutes on a
1      per-user basis.
1 
1 `-n'
1 `--sort-num-calls'
1      Sort the output by the number of calls.  This is the default
1      sorting method.
1 
1 `-p'
1 `--show-paging'
1      Print the number of minor and major pagefaults and swaps.
1 
1 `-P'
1 `--show-paging-avg'
1      Print the number of minor and major pagefaults and swaps divided by
1      the number of calls.
1 
1 `-r'
1 `--reverse-sort'
1      Sort output items in reverse order.
1 
1 `-s'
1 `--merge'
1      Merge the summarized accounting data into the summary files
1      `savacct' and `usracct'.
1 
1 `-t'
1 `--print-ratio'
1      For each entry, print the ratio of real time to the sum of system
1      and user times.  If the sum of system and user times is too small
1      to report--the sum is zero--`*ignore*' will appear in this field.
1 
1 `-u'
1 `--print-users'
1      For each command in the accounting file, print the userid and
11      command name.  After printing all entries, quit.  ⇒* this flag
      supersedes all others.
1 
1 `-v NUM'
1 `--threshold NUM'
1      Print commands which were executed NUM times or fewer and await a
1      reply from the terminal.  If the response begins with `y', add the
1      command to the `**junk**' group.
1 
1 `--separate-forks'
1      It really doesn't make any sense to me that the stock version of
1      `sa' separates statistics for a particular executable depending on
1      whether or not that command forked.  Therefore, GNU `sa' lumps this
1      information together unless this option is specified.
1 
1 `--sort-real-time'
1      Sort the output by the "real time" (elapsed time) for each command.
1 
1 `--ahz HZ'
1      Use this flag to tell the program what `AHZ' should be (in hertz).
1      This option is useful if you are trying to view an `acct' file
1      created on another machine which has the same byte order and file
1      format as your current machine, but has a different value for
1      `AHZ'.
1 
1 `--debug'
1      Print verbose internal information.
1 
1 `-V'
1 `--version'
1      Print `sa''s version number.
1 
1 `-h'
1 `--help'
1      Print `sa''s usage string and default locations of system files to
1      standard output.
1 
1    ⇒* if more than one sorting option is specified, the list will
1 be sorted by the one specified last on the command line.
1 
1 4.2 Problems
1 ============
1 
1 I haven't been able to test this on many different machines because the
1 data files grow so big in a short time; our sysadmin would rather save
1 the disk space.
1 
1    Most versions of `sa' that I've tested don't pay attention to flags
1 like `--print-seconds' and `--sort-num-calls' when printing out
1 commands when combined with the `--user-summary' or `--print-users'
1 flags.  GNU `sa' pays attention to these flags if they are applicable.
1 
1 4.2.1 mips sa
1 -------------
1 
1 The average memory use is stored as a short rather than a double, so we
1 suffer from round-off errors.  GNU `sa' uses double the whole way
1 through.
1