Sa: Reports, cleans up, and maintains process statistical files
Purpose: The SA command compresses the information in/var/log/pacct to the abstract file/var/log/savacct and/var/log/usracct, report, clear, and maintain process statistical files.
Usage: SA [Option]... [file]...
The main options are as follows.
--A: print the names of all commands (including those with non-printable characters ).
--B: divide the output by the sum of user and system time divided by the number of calls. Otherwise, the output is the sum of user time and system time.
--C: print the time used by each command as a percentage of the time used by all commands. In addition, there are users, systems and real-time.
--C: Merge the accounting file into the summary file. If the digest file is in the old usage, convert it to the new usage.
--D: sorts the output data by average disk I/O operations.
--D: sorts and prints the output according to the total disk I/O operations.
--F: Do not force interactive threshold compression. This flag must be used with the-V flag.
--I: read only the original data, not the abstract file.
--J: print the number of seconds for each call, instead of the total number of minutes for each category.
--K: sorts the output by average CPU time.
--K: sorts and prints the output by the number of CPU storage.
--L: separates system time from user time, rather than combining them.
--M: print the number of processes and the number of CPU minutes for each user.
--N: the output is classified by the number of calls.
--R: invert the classification order.
--S: Merge the accounting file into the summary file.
--T: Ratio of the time used to print each command to the user and system time.
--U: temporarily hold all other signs and print the user digital ID and command name of each command.
The flag used with the SA command changes the type of report information. The report may contain the following fields.
-Avio: Average number of I/O operations performed each time.
-CP: The sum of user and system time, measured in minutes.
-CPU: Same as CP.
-K: Average CPU time used by the kernel, in the unit of 1 K.
-K * sec: CPU storage integrity, in the unit of 1 k-core seconds.
-Re: Real-Time time, in minutes.
-S: system time, in minutes.
-TiO: Total number of I/O operations.
-U: User time, in minutes.
If you run the SA command without specifying any flag, the summary report contains the number of calls to each command, as well as the RE, CPU, avio, and K fields.
The application example is as follows.
(1) print the number of processes and the number of CPU minutes for each user
# Sa-M/var/log/pacct
904 72.81re 0.27cp 1324 K
Root 658 69.54re 0.27cp 926 K
Nagios 237 3.24re 0.00cp 2400 K
Sshd 8 0.00re 0.00cp 2104 K
Smmsp 1 0.02re 0.00cp 2035 K
(2) specify SA to read manually created files/var/account/Acct
By default, the SA command is used to read the pacct, savacct, and usracct files under/var/account/respectively. We need to specify that it reads the manually created files/var/account/Acct.
# Sa-A -- Other-ACCT-file/var/account/Acct
3 0.00re 0.00cp 0 avio 726 K
1 0.00re 0.00cp 0 avio 1207 K ls
1 0.00re 0.00cp 0 avio 571 K goodc
1. 0.00re. 0.00cp 0 avio 399 K accton
(3) summarize accounting records based on average CPU time
Sa-K
Title: Fast query of Linux core application commands
Author: Cao jianghua,Edited by Fang Jianguo
ISBN: 978-7-121-11149-5
Publication date: 2010Year7Month
Pricing:59.00RMB
Start: 16Open
Page number: 528Page
Internal Capacity Simplified Introduction
After more than a decade of development, the Linux operating system has been continuously improved and more applications have been made. Now, Linux Desktop is relatively mature, but the command line technology is still the core technology of Linux.
This book introduces the functions, syntaxes, options, typical application instances, and precautions of core management commands (including the latest virtualization management commands and SELinux management commands) under Linux Command lines, every command is described in detail and a large number of instances are described. This gives readers a quick and in-depth understanding of commands in Linux. The book is classified according to the functions of Linux commands for readers to query. Before reading this book, you do not need to have too much background knowledge, whether you are a Unix user, a new linux user, or even a Windows user who has never been in touch with Linux, you can easily understand and master the content, and quickly understand and use the Linux system of each release. This book uses the commands involved in RHEL 5.5 and also applies to other Linux distributions. It is a required reference for all Linux users.
Related serialization:
Linux core application command quick query serialization 2: lastcomm: displays information about previously used commands
Linux core command speed query: accton: Process statistics on enabling or disabling