SA(8)

πŸ“¦
version 6.6.4 Β· 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– SA(8) β€” system manager's manual, but make it cute πŸ’–

okay bestie, so this is sa, from the System Manager's Manual section 8. she summarizes accounting information and honestly? she's iconic for it. let's get into it ✨


✨ NAME ✨

sa β€” summarizes accounting information πŸ’…


🌸 SYNOPSIS 🌸

sa     [ -a | --list-all-names ]
       [ -b | --sort-sys-user-div-calls ]
       [ -c | --percentages ] [ -d | --sort-avio ]
       [ -D | --sort-tio ] [ -f | --not-interactive ]
       [ -i | --dont-read-summary-files ]
       [ -j | --print-seconds ] [ -k | --sort-cpu-avmem ]
       [ -K | --sort-ksec ] [ -l | --separate-times ]
       [ -m | --user-summary ] [ -n | --sort-num-calls ]
       [ -p | --show-paging ] [ -P | --show-paging-avg ]
       [ -r | --reverse-sort ] [ -s | --merge ]
       [ -t | --print-ratio ] [ -u | --print-users ]
       [ -v num | --threshold num ] [ --sort-real-time ]
       [ --debug ] [ -V | --version ] [ -h | --help ]
       [ --other-usracct-file filename ] [ --ahz hz ]
       [ --other-savacct-file filename ]
       [ [ --other-acct-file ] filename ]

πŸ¦‹ DESCRIPTION πŸ¦‹

so sa summarizes info about commands that already ran, as recorded in the acct file. and not only that β€” she condenses that data into a summary file called savacct, which holds the number of times the command was called plus the system resources it used. and if you want, you can get all of that summarized per-user too, because sa saves that info into a file named usracct. slay πŸ’–

if you pass no arguments at all, sa prints info about all the commands in the acct file. (yes, all of them. main character energy.)

if you call her with a file name as the last argument, she'll use that file instead of the system's default acct file.

by default, sa sorts the output by sum of user and system time. and here's a lil quirk: if command names have unprintable characters, or were only called once, she'll sort them into a group called ***other. and if you specify more than one sorting option? the list gets sorted by whichever one you said last on the command line. periodt.

the output fields are labeled like this, bestie:

  • cpu β€” sum of system and user time in cpu minutes
  • re β€” "elapsed time" in minutes
  • k β€” cpu-time averaged core usage, in 1k units
  • avio β€” average number of I/O operations per execution
  • tio β€” total number of I/O operations
  • k*sec β€” cpu storage integral (kilo-core seconds)
  • u β€” user cpu time in cpu seconds
  • s β€” system time in cpu seconds

ngl this next part trips people up: those column titles do not appear in the first row of the table. instead they show up after each numeric entry (as units of measurement) in every row. so for example you might see 79.29re, which means 79.29 cpu seconds of "real time". iykyk 🫢

an asterisk will appear after the name of commands that forked but didn't call exec. wild, right?

now, GNU sa takes care to implement a bunch of features you won't find in other versions. for example, most versions of sa don't pay attention to flags like --print-seconds and --sort-num-calls when printing out commands, when those are combined with the --user-summary or --print-users flags. GNU sa does pay attention to these flags if they're applicable. also, MIPS' sa stores the average memory use as a short rather than a double, which results in some round-off errors. GNU sa uses double the whole way through. no round-off nonsense here, we don't do that πŸ’…


πŸ’… OPTIONS πŸ’…

quick vibe check first: the availability of these program options depends on your operating system. specifically, the members that appear in the struct acct of your system's process accounting header file (usually acct.h) determine which flags will be present. for example, if your system's struct acct doesn't have the ac_mem field, the installed version of sa will not support the --sort-cpu-avmem, --sort-ksec, -k, or -K options.

in short: all of these flags may not be available on your machine. check before you commit, bestie 😭
  • -a, --list-all-names β€” force sa not to sort those command names with unprintable characters, and those used only once, into the ***other group.
  • -b, --sort-sys-user-div-calls β€” sort the output by the sum of user and system time divided by the number of calls.
  • -c, --percentages β€” print percentages of total time for the command's user, system, and real time values.
  • -d, --sort-avio β€” sort the output by the average number of disk I/O operations.
  • -D, --sort-tio β€” print and sort the output by the total number of disk I/O operations.
  • -f, --not-interactive β€” when using the --threshold option, assume that all answers to interactive queries will be affirmative.
  • -i, --dont-read-summary-files β€” don't read the information in the system's default savacct file.
  • -j, --print-seconds β€” instead of printing total minutes for each category, print seconds per call.
  • -k, --sort-cpu-avmem β€” sort the output by cpu time average memory usage.
  • -K, --sort-ksec β€” print and sort the output by the cpu-storage integral.
  • -l, --separate-times β€” print separate columns for system and user time; usually the two are added together and listed as cpu.
  • -m, --user-summary β€” print the number of processes and number of CPU minutes on a per-user basis.
  • -n, --sort-num-calls β€” sort the output by the number of calls. this is the default sorting method πŸ‘‘
  • -p, --show-paging β€” print the number of minor and major pagefaults and swaps.
  • -P, --show-paging-avg β€” print the number of minor and major pagefaults and swaps divided by the number of calls.
  • -r, --reverse-sort β€” sort output items in reverse order.
  • -s, --merge β€” merge the summarized accounting data into the summary files savacct and usracct.
  • -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.
  • -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. she said sit DOWN πŸ’€
  • -v num, --threshold num β€” print commands which were executed num times or fewer, and await a reply from the terminal. if the response begins with y, add the command to the **junk** group.
  • --separate-forks β€” quote: "it really doesn't make any sense to me that the stock version of sa separates statistics for a particular executable depending on whether or not that command forked." therefore, GNU sa lumps this information together unless this option is specified.
  • --ahz hz β€” use this flag to tell the program what AHZ should be (in hertz). this option is useful if you're trying to view an 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 AHZ.
  • --debug β€” print verbose internal information.
  • -V, --version β€” print the version number of sa.
  • -h, --help β€” prints the usage string and default locations of system files to standard output and exits.
  • --sort-real-time β€” sort the output by the "real time" field.
  • --other-usracct-file filename β€” write summaries by user ID to filename rather than the system's default usracct file.
  • --other-savacct-file filename β€” write summaries by command name to filename rather than the system's default SAVACCT file.
  • --other-acct-file filename β€” read from the file filename instead of the system's default ACCT file.

πŸŽ€ FILES πŸŽ€

  • acct β€” the raw system wide process accounting file. see acct(5) for further details.
  • savacct β€” a summary of system process accounting sorted by command.
  • usracct β€” a summary of system process accounting sorted by user ID.

πŸ™ˆ BUGS πŸ™ˆ

ngl there is not yet a wide experience base for comparing the output of GNU sa with versions of sa in many other systems. the problem? the data files grow big in a short time and therefore require a lot of disk space. she's hungry, your disk is the snack 😭


🫢 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>. we stan πŸ’–


🌈 SEE ALSO 🌈


and that's the whole page, bestie β€” this one's dated 1997 August 19, straight from the System Manager's Manual. go forth and account for things πŸ’…βœ¨