一、 概述
prstat [-acJLmRtTv] [-C psrsetlist] [-j projlist] [-k task-list] [-n ntop[,nbottom]] [-p pidlist] [-P cpulist] [-s key
| -S key ] [-u euidlist] [-U uidlist] [interval [count]]
prstat命令能够反复检查系统中所有活动的进程,并按照指定的输出模式及排列方式报告统计信息。它还可以根据进程ID(PID)、用户ID(UID)、CPU ID以及处理器组ID (processor set IDs)来遴选和归类输出结果。
The following options are supported:
-a Report information about processes and users. In this mode prstat displays separate reports about processes and users at the same time.
-c Print new reports below previous reports instead of overprinting them.
-C psrsetlist
Report only processes or lwps that are bound to pro-cessor sets in the given list. Each processor set is identified by an integer as reported by psrset(1M).
The load averages displayed are the sum of the load averages of the specified processor sets (see pset_getloadavg(3C)).
-j projlist
Report only processes or lwps whose project ID is in the given list. Each project ID can be specified as
either a project name or a numerical project ID. See project(4).
-J Report information about processes and projects. In this mode prstat displays separate reports about
processes and projects at the same time.
-k tasklist
Report only processes or lwps whose task ID is in tasklist.
-L Report statistics for each light-weight process (LWP). By default, prstat reports only the number of LWPs for
each process.
-m Report microstate process accounting information. In addition to all fields listed in -v mode, this mode
also includes the percentage of time the process has spent processing system traps, text page faults, data
page faults, waiting for user locks and waiting for CPU (latency time).
-n ntop[,nbottom]
Restrict number of output lines. The ntop argument determines how many lines of process or lwp statistics
are reported, and the nbottom argument determines how many lines of user, task, or projects statistics are
reported if the -a, -t, -T, or -J options are specified. By default, prstat displays as many lines of
output that fit in a window or terminal. When you specify the -c option or direct the output to a file,
the default values for ntop and nbottom are 15 and 5.
-p pidlist
Report only processes whose process ID is in the given list.
-P cpulist
Report only processes or lwps which have most recently executed on a CPU in the given list. Each CPU is iden-
tified by an integer as reported by psrinfo(1M).
-R Put prstat in the real time scheduling class. When this option is used, prstat is given priority over time-sharing and interactive processes. This option is available only for superuser.
-s key
Sort output lines (that is, processes, lwps, or users) by key in descending order. Only one key can be used
as an argument.
There are five possible key values:
cpu Sort by process CPU usage. This is the default.
pri Sort by process priority.
rss Sort by resident set size.
size Sort by size of process image.
time Sort by process execution time.
-S key
Sort output lines by key in ascending order. Possible key values are the same as for the -s option. See -s.
-t Report total usage summary for each user. The summary includes the total number of processes or LWPs owned by the user, total size of process images, total resident set size, total cpu time, and percentages of
recent cpu time and system memory.
-T Report information about processes and tasks. In this mode prstat displays separate reports about processes and tasks at the same time.
-u euidlist
Report only processes whose effective user ID is in the given list. Each user ID may be specified as
either a login name or a numerical user ID.
-U uidlist
Report only processes whose real user ID is in the given list. Each user ID may be specified as either a
login name or a numerical user ID.
-v Report verbose process usage. This output format includes the percentage of time the process has spent
in user mode, in system mode, and sleeping. It also includes the number of voluntary and involuntary con-
text switches, system calls and the number of signals received. Statistics that are not reported are marked
with the - sign.
OUTPUT
The following list defines the column headings and the mean-
ings of a prstat report:
PID The process ID of the process.
USERNAME
The real user (login) name or real user ID.
SIZE The total virtual memory size of the process, including all mapped files and devices, in kilobytes (K),
megabytes (M), or gigabytes (G). The resident set size of the process (RSS), in kilobytes (K), megabytes (M),
or gigabytes (G).
STATE The state of the process:
cpuN Process is running on CPU N.
sleep Sleeping: process is waiting for an event to
complete.
run Runnable: process in on run queue.
zombie
Zombie state: process terminated and parent not
waiting.
stop Process is stopped.
PRI The priority of the process. Larger numbers mean higher priority.
NICE Nice value used in priority computation. Only processes in certain scheduling classes have a nice
value.
TIME The cumulative execution time for the process.
CPU The percentage of recent CPU time used by the process.
PROCESS
The name of the process (name of executed file).
LWPID The lwp ID of the lwp being reported.
NLWP The number of lwps in the process.
The following columns are displayed when the -v or -m option is specified
USR The percentage of time the process has spent in user mode.
SYS The percentage of time the process has spent in system mode.
TRP The percentage of time the process has spent in processing system traps.
TFL The percentage of time the process has spent processing text page faults.
DFL The percentage of time the process has spent processing data page faults.
LCK The percentage of time the process has spent waiting for user locks.
SLP The percentage of time the process has spent sleeping.
LAT The percentage of time the process has spent waiting for CPU.
VCX The number of voluntary context switches.
ICX The number of involuntary context switches.
SCL The number of system calls.
SIG The number of signals received.
Under the -l option, one line is printed for each lwp in the process and some reporting fields show the values for the lwp, not the process.
The following operands are supported:
count Specifies the number of times that the statistics are repeated. By default, prstat reports statistics until
a termination signal is received.
interval
Specifies the sampling interval in seconds; the default interval is 5 seconds.