HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/share/doc/acct/html/sa.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.8, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>sa (Accounting Utilities Manual)</title>

<meta name="description" content="sa (Accounting Utilities Manual)">
<meta name="keywords" content="sa (Accounting Utilities Manual)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="index.html" rel="up" title="Top">
<link href="dump_002dacct.html" rel="next" title="dump-acct">
<link href="lastcomm.html" rel="prev" title="lastcomm">
<style type="text/css">
<!--
a.copiable-anchor {visibility: hidden; text-decoration: none; line-height: 0em}
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
span:hover a.copiable-anchor {visibility: visible}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en">
<div class="chapter" id="sa">
<div class="header">
<p>
Next: <a href="dump_002dacct.html" accesskey="n" rel="next"><code>dump-acct</code></a>, Previous: <a href="lastcomm.html" accesskey="p" rel="prev"><code>lastcomm</code></a>, Up: <a href="index.html" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<hr>
<span id="sa-1"></span><h2 class="chapter">4 <code>sa</code></h2>

<p><code>sa</code> summarizes information about previously executed commands as
recorded in the <code>acct</code> file.  In addition, it condenses this data
into the <code>savacct</code> summary file, 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; <code>sa</code>
will save this information into <code>usracct</code>.  Usage:
</p>
<p><code>sa [<var>opts</var>] [<var>file</var>]</code>
</p>
<p>If no arguments are specified, <code>sa</code> will print information about
all of the commands in the <code>acct</code> file.  If command
names have unprintable characters, or are only called once, <code>sa</code>
will sort them into a group called <code>***other</code>.  Overall totals for
each field are gathered and printed with a blank command name.
</p>
<p>If called with a file name as the last argument, <code>sa</code> will use that
file instead of <code>acct</code>.
</p>
<p>By default, <code>sa</code> will sort the output by sum of user and system
time.
</p>
<p>The output fields are labeled as follows:
</p>
<dl compact="compact">
<dt><span><code>cpu</code></span></dt>
<dd><p>sum of system and user time in cpu seconds
</p>
</dd>
<dt><span><code>re</code></span></dt>
<dd><p>&ldquo;real time&rdquo; in cpu seconds
</p>
</dd>
<dt><span><code>k</code></span></dt>
<dd><p>cpu-time averaged core usage, in 1k units
</p>
</dd>
<dt><span><code>avio</code></span></dt>
<dd><p>average number of I/O operations per execution
</p>
</dd>
<dt><span><code>tio</code></span></dt>
<dd><p>total number of I/O operations
</p>
</dd>
<dt><span><code>k*sec</code></span></dt>
<dd><p>cpu storage integral (kilo-core seconds)
</p>
</dd>
<dt><span><code>u</code></span></dt>
<dd><p>user cpu time in cpu seconds
</p>
</dd>
<dt><span><code>s</code></span></dt>
<dd><p>system time in cpu seconds
</p>
</dd>
</dl>

<p>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 <code>79.29re</code>, meaning 79.29 cpu
seconds of &ldquo;real time.&rdquo;
</p>
<p>An asterisk will appear after the name of commands that forked but
didn&rsquo;t call <code>exec</code>.
</p>
<ul class="section-toc">
<li><a href="#Flags-3" accesskey="1">Flags</a></li>
<li><a href="#Problems-1" accesskey="2">Problems</a></li>
</ul>
<div class="section" id="Flags-3">
<h3 class="section">4.1 Flags</h3>

<p>The availability of these program options depends on your operating
system.  In specific, the members that appear in the <code>struct acct</code>
of your system&rsquo;s process accounting header file (usually <code>acct.h</code>)
determine which flags will be present.  For example, if your system&rsquo;s
<code>struct acct</code> doesn&rsquo;t have the <code>ac_mem</code> field, the installed
version of <code>sa</code> will not support the <code>--sort-cpu-avmem</code>,
<code>--sort-ksec</code>, <code>-k</code>, or <code>-K</code> options.
</p>
<p>In short, all of these flags may not be available on your machine.
</p>
<dl compact="compact">
<dt><span><code>-a</code></span></dt>
<dt><span><code>--list-all-names</code></span></dt>
<dd><p>Force <code>sa</code> not to sort those command names with unprintable
characters and those used only once into the &lsquo;<code>***other</code>&rsquo; group.
</p>
</dd>
<dt><span><code>-b</code></span></dt>
<dt><span><code>--sort-sys-user-div-calls</code></span></dt>
<dd><p>Sort the output by the sum of user and system time divided by the number
of calls.
</p>
</dd>
<dt><span><code>-c</code></span></dt>
<dt><span><code>--percentages</code></span></dt>
<dd><p>Print percentages of total time for the command&rsquo;s user, system, and real
time values.
</p>
</dd>
<dt><span><code>-d</code></span></dt>
<dt><span><code>--sort-avio</code></span></dt>
<dd><p>Sort the output by the average number of disk I/O operations.
</p>
</dd>
<dt><span><code>-D</code></span></dt>
<dt><span><code>--sort-tio</code></span></dt>
<dd><p>Print and sort the output by the total number of disk I/O operations.
</p>
</dd>
<dt><span><code>-f</code></span></dt>
<dt><span><code>--not-interactive</code></span></dt>
<dd><p>When using the <code>--threshold</code> option, assume that all answers to
interactive queries will be affirmative.
</p>
</dd>
<dt><span><code>-i</code></span></dt>
<dt><span><code>--dont-read-summary-file</code></span></dt>
<dd><p>Don&rsquo;t read the information in <code>savacct</code>.
</p>
</dd>
<dt><span><code>-j</code></span></dt>
<dt><span><code>--print-seconds</code></span></dt>
<dd><p>Instead of printing total minutes for each category, print seconds per
call.
</p>
</dd>
<dt><span><code>-k</code></span></dt>
<dt><span><code>--sort-cpu-avmem</code></span></dt>
<dd><p>Sort the output by cpu time average memory usage.
</p>
</dd>
<dt><span><code>-K</code></span></dt>
<dt><span><code>--sort-ksec</code></span></dt>
<dd><p>Print and sort the output by the cpu-storage integral.
</p>
</dd>
<dt><span><code>-l</code></span></dt>
<dt><span><code>--separate-times</code></span></dt>
<dd><p>Print separate columns for system and user time; usually the two are
added together and listed as <code>cpu</code>.
</p>
</dd>
<dt><span><code>-m</code></span></dt>
<dt><span><code>--user-summary</code></span></dt>
<dd><p>Print the number of processes and number of CPU minutes on a per-user
basis.
</p>
</dd>
<dt><span><code>-n</code></span></dt>
<dt><span><code>--sort-num-calls</code></span></dt>
<dd><p>Sort the output by the number of calls.  This is the default sorting
method.
</p>
</dd>
<dt><span><code>-p</code></span></dt>
<dt><span><code>--show-paging</code></span></dt>
<dd><p>Print the number of minor and major pagefaults and swaps.
</p>
</dd>
<dt><span><code>-P</code></span></dt>
<dt><span><code>--show-paging-avg</code></span></dt>
<dd><p>Print the number of minor and major pagefaults and swaps divided by
the number of calls.
</p>
</dd>
<dt><span><code>-r</code></span></dt>
<dt><span><code>--reverse-sort</code></span></dt>
<dd><p>Sort output items in reverse order.
</p>
</dd>
<dt><span><code>-s</code></span></dt>
<dt><span><code>--merge</code></span></dt>
<dd><p>Merge the summarized accounting data into the summary files
<code>savacct</code> and <code>usracct</code>.
</p>
</dd>
<dt><span><code>-t</code></span></dt>
<dt><span><code>--print-ratio</code></span></dt>
<dd><p>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&mdash;the sum is zero&mdash;<code>*ignore*</code> will appear in this field.
</p>
</dd>
<dt><span><code>-u</code></span></dt>
<dt><span><code>--print-users</code></span></dt>
<dd><p>For each command in the accounting file, print the userid and command
name.  After printing all entries, quit.  <strong>Note</strong>: this flag
supersedes all others.
</p>
</dd>
<dt><span><code>-v <var>num</var></code></span></dt>
<dt><span><code>--threshold <var>num</var></code></span></dt>
<dd><p>Print commands which were executed <var>num</var> times or fewer and await a
reply from the terminal.  If the response begins with <code>y</code>, add the
command to the <code>**junk**</code> group.
</p>
</dd>
<dt><span><code>--separate-forks</code></span></dt>
<dd><p>It really doesn&rsquo;t make any sense to me that the stock version of
<code>sa</code> separates statistics for a particular executable depending on
whether or not that command forked.  Therefore, GNU <code>sa</code> lumps this
information together unless this option is specified.
</p>
</dd>
<dt><span><code>--sort-real-time</code></span></dt>
<dd><p>Sort the output by the &ldquo;real time&rdquo; (elapsed time) for each command.
</p>
</dd>
<dt><span><code>--ahz <var>hz</var></code></span></dt>
<dd><p>Use this flag to tell the program what <code>AHZ</code> should be (in hertz).
This option is useful if you are trying to view an <code>acct</code> file
created on another machine which has the same byte order and file format
as your current machine, but has a different value for <code>AHZ</code>.
</p>
</dd>
<dt><span><code>--debug</code></span></dt>
<dd><p>Print verbose internal information.
</p>
</dd>
<dt><span><code>-V</code></span></dt>
<dt><span><code>--version</code></span></dt>
<dd><p>Print <code>sa</code>&rsquo;s version number.
</p>
</dd>
<dt><span><code>-h</code></span></dt>
<dt><span><code>--help</code></span></dt>
<dd><p>Print <code>sa</code>&rsquo;s usage string and default locations of system files to
standard output.
</p></dd>
</dl>

<p><strong>Note</strong>: if more than one sorting option is specified, the list
will be sorted by the one specified last on the command line.
</p>
</div>
<div class="section" id="Problems-1">
<h3 class="section">4.2 Problems</h3>

<p>I haven&rsquo;t been able to test this on many different machines because the
data files grow so big in a short time; our sysadmin would rather save
the disk space.
</p>
<p>Most versions of <code>sa</code> that I&rsquo;ve tested don&rsquo;t pay attention to flags
like <code>--print-seconds</code> and <code>--sort-num-calls</code> when printing
out commands when combined with the <code>--user-summary</code> or
<code>--print-users</code> flags.  GNU <code>sa</code> pays attention to these flags
if they are applicable.
</p>
<ul class="section-toc">
<li><a href="#mips-sa" accesskey="1">mips sa</a></li>
</ul>
<div class="subsection" id="mips-sa">
<h4 class="subsection">4.2.1 mips sa</h4>

<p>The average memory use is stored as a short rather than a double, so we
suffer from round-off errors.  GNU <code>sa</code> uses double the whole way
through.
</p>

</div>
</div>
</div>
<hr>
<div class="header">
<p>
Next: <a href="dump_002dacct.html"><code>dump-acct</code></a>, Previous: <a href="lastcomm.html"><code>lastcomm</code></a>, Up: <a href="index.html">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>



</body>
</html>