2 .\" Copyright (c) 2013 Gary Mills
3 .\" Copyright (c) 2006, 2009 Sun Microsystems, Inc. All Rights Reserved.
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
5 .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
6 .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH PRSTAT 8 "Nov 14, 2014"
9 prstat \- report active process statistics
13 \fBprstat\fR [\fB-acHJLmRrtTvWZ\fR] [\fB-d\fR u | d] [\fB-C\fR \fIpsrsetlist\fR] [\fB-h\fR \fIlgrplist\fR]
14 [\fB-j\fR \fIprojlist\fR] [\fB-k\fR \fItasklist\fR] [\fB-n\fR \fIntop\fR[,\fInbottom\fR]]
15 [\fB-p\fR \fIpidlist\fR] [\fB-P\fR \fIcpulist\fR] [\fB-s\fR \fIkey\fR | \fB-S\fR \fIkey\fR ]
16 [\fB-u\fR \fIeuidlist\fR] [\fB-U\fR \fIuidlist\fR] [\fB-z\fR \fIzoneidlist\fR]
17 [\fIinterval\fR [\fIcount\fR]]
22 The \fBprstat\fR utility iteratively examines all active processes on the
23 system and reports statistics based on the selected output mode and sort order.
24 \fBprstat\fR provides options to examine only processes matching specified
25 \fBPID\fRs, \fBUID\fRs, zone \fBID\fRs, \fBCPU\fR \fBID\fRs, and processor set
29 The \fB-j\fR, \fB-k\fR, \fB-C\fR, \fB-p\fR, \fB-P\fR, \fB-u\fR, \fB-U\fR, and
30 \fB-z\fR options accept lists as arguments. Items in a list can be either
31 separated by commas or enclosed in quotes and separated by commas or spaces.
34 If you do not specify an option, \fBprstat\fR examines all processes and
35 reports statistics sorted by \fBCPU\fR usage.
38 The following options are supported:
46 Report information about processes and users. In this mode \fBprstat\fR
47 displays separate reports about processes and users at the same time.
57 Print new reports below previous reports instead of overprinting them.
58 Long names are not truncated in this mode.
64 \fB\fB-C\fR \fIpsrsetlist\fR\fR
68 Report only processes or lwps that are bound to processor sets in the given
69 list. Each processor set is identified by an integer as reported by
70 \fBpsrset\fR(8). The load averages displayed are the sum of the load averages
71 of the specified processor sets (see \fBpset_getloadavg\fR(3C)). Processes with
72 one or more LWPs bound to processor sets in the given list are reported even
73 when the \fB-L\fR option is not used.
79 \fB\fB-d\fR \fBu | d\fR\fR
83 Specify \fBu\fR for a printed representation of the internal representation of
84 time. See \fBtime\fR(2). Specify \fBd\fR for standard date format. See
91 \fB\fB-h\fR \fIlgrplist\fR\fR
95 Report only processes or lwps whose home \fIlgroup\fR is in the given list of
96 \fIlgroups\fR. No processes or lwps will be listed for invalid \fIlgroups\fR.
106 Report information about home \fIlgroup\fR. In this mode, \fBprstat\fR adds an
107 extra column showing process or lwps home \fIlgroup\fR with the header LGRP.
113 \fB\fB-j\fR \fIprojlist\fR\fR
117 Report only processes or lwps whose project \fBID\fR is in the given list. Each
118 project \fBID\fR can be specified as either a project name or a numerical
119 project \fBID\fR. See \fBproject\fR(4).
129 Report information about processes and projects. In this mode \fBprstat\fR
130 displays separate reports about processes and projects at the same time.
131 A trailing asterisk marks a long name that has been truncated
138 \fB\fB-k\fR \fItasklist\fR\fR
142 Report only processes or lwps whose task \fBID\fR is in \fItasklist\fR.
152 Report statistics for each light-weight process (\fBLWP\fR). By default,
153 \fBprstat\fR reports only the number of \fBLWP\fRs for each process.
163 Report microstate process accounting information. In addition to all fields
164 listed in \fB-v\fR mode, this mode also includes the percentage of time the
165 process has spent processing system traps, text page faults, data page faults,
166 waiting for user locks and waiting for \fBCPU\fR (latency time).
172 \fB\fB-n\fR \fIntop\fR[\fI,nbottom\fR]\fR
176 Restrict number of output lines. The \fIntop\fR argument determines how many
177 lines of process or \fBlwp\fR statistics are reported, and the \fInbottom\fR
178 argument determines how many lines of user, task, project or zone statistics
179 are reported if the \fB-a\fR, \fB-t\fR, \fB-T\fR, \fB-J\fR or \fB-Z\fR options
180 are specified. By default, \fBprstat\fR displays as many lines of output that
181 fit in a window or terminal. When you specify the \fB-c\fR option or direct the
182 output to a file, the default values for \fBntop\fR and \fBnbottom\fR are
183 \fB15\fR and \fB5\fR.
189 \fB\fB-p\fR \fIpidlist\fR\fR
193 Report only processes whose process \fBID\fR is in the given list.
199 \fB\fB-P\fR \fIcpulist\fR\fR
203 Report only processes or \fBlwp\fRs which have most recently executed on a
204 \fBCPU\fR in the given list. Each \fBCPU\fR is identified by an integer as
205 reported by \fBpsrinfo\fR(8).
215 Put \fBprstat\fR in the real time scheduling class. When this option is used,
216 \fBprstat\fR is given priority over time-sharing and interactive processes.
217 This option is available only for superuser.
227 Disable lookups for user names and project names. (Note that this does not
228 apply to lookups for the \fB-j\fR, \fB-u\fR, or \fB-U\fR options.)
234 \fB\fB-s\fR \fIkey\fR\fR
238 Sort output lines (that is, processes, \fBlwp\fRs, or users) by \fIkey\fR in
239 descending order. Only one \fIkey\fR can be used as an argument.
241 There are five possible key values:
249 Sort by process \fBCPU\fR usage. This is the default.
259 Sort by process priority.
269 Sort by resident set size.
279 Sort by size of process image.
289 Sort by process execution time.
297 \fB\fB-S\fR \fIkey\fR\fR
301 Sort output lines by \fIkey\fR in ascending order. Possible \fIkey\fR values
302 are the same as for the \fB-s\fR option. See \fB-s\fR.
312 Report total usage summary for each user. The summary includes the total number
313 of processes or \fBLWP\fRs owned by the user, total size of process images,
314 total resident set size, total cpu time, and percentages of recent cpu time and
325 Report information about processes and tasks. In this mode \fBprstat\fR
326 displays separate reports about processes and tasks at the same time.
332 \fB\fB-u\fR \fIeuidlist\fR\fR
336 Report only processes whose effective user \fBID\fR is in the given list. Each
337 user \fBID\fR may be specified as either a login name or a numerical user
344 \fB\fB-U\fR \fIuidlis\fRt\fR
348 Report only processes whose real user \fBID\fR is in the given list. Each user
349 \fBID\fR may be specified as either a login name or a numerical user \fBID\fR.
359 Report verbose process usage. This output format includes the percentage of
360 time the process has spent in user mode, in system mode, and sleeping. It also
361 includes the number of voluntary and involuntary context switches, system calls
362 and the number of signals received. Statistics that are not reported are marked
363 with the \fB-\fR sign.
373 Truncate long names even when \fBprstat\fR would normally print them
375 A trailing asterisk marks a long name that has been truncated
382 \fB\fB-z\fR \fIzoneidlist\fR\fR
386 Report only processes or LWPs whose zone ID is in the given list. Each zone ID
387 can be specified as either a zone name or a numerical zone ID. See
398 Report information about processes and zones. In this mode, \fBprstat\fR
399 displays separate reports about processes and zones at the same time.
400 A trailing asterisk marks a long name that has been truncated
406 The following list defines the column headings and the meanings of a
415 The process \fBID\fR of the process.
425 The real user (login) name or real user \fBID\fR.
426 A trailing asterisk marks a long name that has been truncated
437 The total virtual memory size of the process, including all mapped files and
438 devices, in kilobytes (\fBK\fR), megabytes (\fBM\fR), or gigabytes (\fBG\fR).
448 The resident set size of the process (\fBRSS\fR), in kilobytes (\fBK\fR),
449 megabytes (\fBM\fR), or gigabytes (\fBG\fR). The RSS value is an estimate
450 provided by \fBproc\fR(4) that might underestimate the actual resident set
451 size. Users who want to get more accurate usage information for capacity
452 planning should use the \fB-x\fR option to \fBpmap\fR(1) instead.
462 The state of the process:
470 Process is running on \fBCPU\fR \fIN\fR.
480 Sleeping: process is waiting for an event to complete.
490 Waiting: process is waiting for CPU usage to drop to the CPU-caps enforced
491 limits. See the description of \fBCPU-caps\fR in \fBresource_controls\fR(5).
501 Runnable: process in on run queue.
511 Zombie state: process terminated and parent not waiting.
533 The priority of the process. Larger numbers mean higher priority.
543 Nice value used in priority computation. Only processes in certain scheduling
544 classes have a nice value.
554 The cumulative execution time for the process.
564 The percentage of recent \fBCPU\fR time used by the process. If executing in a
565 non-global \fBzone\fR and the pools facility is active, the percentage will be
566 that of the processors in the processor set in use by the pool to which the
577 The name of the process (name of executed file).
587 The \fBlwp\fR \fBID\fR of the \fBlwp\fR being reported.
597 The number of \fBlwp\fRs in the process.
602 With the some options, in addition to a number of the column headings shown
611 Number of processes in a specified collection.
621 Percentage of memory used by a specified collection of processes.
626 The following columns are displayed when the \fB-v\fR or \fB-m\fR option is
635 The percentage of time the process has spent in user mode.
645 The percentage of time the process has spent in system mode.
655 The percentage of time the process has spent in processing system traps.
665 The percentage of time the process has spent processing text page faults.
675 The percentage of time the process has spent processing data page faults.
685 The percentage of time the process has spent waiting for user locks.
695 The percentage of time the process has spent sleeping.
705 The percentage of time the process has spent waiting for CPU.
715 The number of voluntary context switches.
725 The number of involuntary context switches.
735 The number of system calls.
745 The number of signals received.
750 Under the \fB-L\fR option, one line is printed for each \fBlwp\fR in the
751 process and some reporting fields show the values for the \fBlwp\fR, not the
755 The following column is displayed when the \fB-H\fR option is specified:
763 The home \fIlgroup\fR of the process or lwp.
768 The following operands are supported:
776 Specifies the number of times that the statistics are repeated. By default,
777 \fBprstat\fR reports statistics until a termination signal is received.
787 Specifies the sampling interval in seconds; the default interval is \fB5\fR
793 \fBExample 1 \fRReporting the Five Most Active Super-User Processes
796 The following command reports the five most active super-user processes running
797 on \fBCPU1\fR and \fBCPU2\fR:
802 example% prstat -u root -n 5 -P 1,2 1 1
804 PID USERNAME SWAP RSS STATE PRI NICE TIME CPU PROCESS/LWP
805 306 root 3024K 1448K sleep 58 0 0:00.00 0.3% sendmail/1
806 102 root 1600K 592K sleep 59 0 0:00.00 0.1% in.rdisc/1
807 250 root 1000K 552K sleep 58 0 0:00.00 0.0% utmpd/1
808 288 root 1720K 1032K sleep 58 0 0:00.00 0.0% sac/1
809 1 root 744K 168K sleep 58 0 0:00.00 0.0% init/1
810 TOTAL: 25, load averages: 0.05, 0.08, 0.12
816 \fBExample 2 \fRDisplaying Verbose Process Usage Information
819 The following command displays verbose process usage information about
820 processes with lowest resident set sizes owned by users \fBroot\fR and
826 example% prstat -S rss -n 5 -vc -u root,john
828 PID USERNAME USR SYS TRP TFL DFL LCK SLP LAT VCX ICX SCL SIG PROCESS/LWP
829 1 root 0.0 0.0 - - - - 100 - 0 0 0 0 init/1
830 102 root 0.0 0.0 - - - - 100 - 0 0 3 0 in.rdisc/1
831 250 root 0.0 0.0 - - - - 100 - 0 0 0 0 utmpd/1
832 1185 john 0.0 0.0 - - - - 100 - 0 0 0 0 csh/1
833 240 root 0.0 0.0 - - - - 100 - 0 0 0 0 powerd/4
834 TOTAL: 71, load averages: 0.02, 0.04, 0.08
842 The following exit values are returned:
850 Successful completion.
865 \fBdate\fR(1), \fBlgrpinfo\fR(1), \fBplgrp\fR(1), \fBproc\fR(1), \fBps\fR(1),
866 \fBtime\fR(2), \fBpsrinfo\fR(8), \fBpsrset\fR(8), \fBsar\fR(8),
867 \fBpset_getloadavg\fR(3C), \fBproc\fR(4), \fBproject\fR(4),
868 \fBattributes\fR(5), \fBresource_controls\fR(5), \fBzones\fR(5)
871 The snapshot of system usage displayed by \fBprstat\fR is true only for a
872 split-second, and it may not be accurate by the time it is displayed. When the
873 \fB-m\fR option is specified, \fBprstat\fR tries to turn on microstate
874 accounting for each process; the original state is restored when \fBprstat\fR
875 exits. See \fBproc\fR(4) for additional information about the microstate
879 The total memory size reported in the SWAP and RSS columns for groups of
880 processes can sometimes overestimate the actual amount of memory used by
881 processes with shared memory segments.