8158 Want named threads API
[unleashed.git] / usr / src / man / man1m / prstat.1m
blobd181c9a55f3bb4d13f242d1fafd9be4ffc0fbfea
1 '\" te
2 .\" Copyright (c) 2013 Gary Mills
3 .\" Copyright (c) 2006, 2009 Sun Microsystems, Inc. All Rights Reserved.
4 .\" Copyright (c) 2018, Joyent, Inc. All Rights Reserved.
5 .\" 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.
6 .\"  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
7 .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
8 .TH PRSTAT 1M "September 1, 2018"
9 .SH NAME
10 prstat \- report active process statistics
11 .SH SYNOPSIS
12 .LP
13 .nf
14 \fBprstat\fR [\fB-acHJLmRrtTvWZ\fR] [\fB-d\fR u | d] [\fB-C\fR \fIpsrsetlist\fR] [\fB-h\fR \fIlgrplist\fR]
15      [\fB-j\fR \fIprojlist\fR] [\fB-k\fR \fItasklist\fR] [\fB-n\fR \fIntop\fR[,\fInbottom\fR]]
16      [\fB-p\fR \fIpidlist\fR] [\fB-P\fR \fIcpulist\fR] [\fB-s\fR \fIkey\fR | \fB-S\fR \fIkey\fR ]
17      [\fB-u\fR \fIeuidlist\fR] [\fB-U\fR \fIuidlist\fR] [\fB-z\fR \fIzoneidlist\fR]
18      [\fIinterval\fR [\fIcount\fR]]
19 .fi
21 .SH DESCRIPTION
22 .LP
23 The \fBprstat\fR utility iteratively examines all active processes on the
24 system and reports statistics based on the selected output mode and sort order.
25 \fBprstat\fR provides options to examine only processes matching specified
26 \fBPID\fRs, \fBUID\fRs, zone \fBID\fRs, \fBCPU\fR \fBID\fRs, and processor set
27 \fBID\fRs.
28 .sp
29 .LP
30 The \fB-j\fR, \fB-k\fR, \fB-C\fR, \fB-p\fR, \fB-P\fR, \fB-u\fR, \fB-U\fR, and
31 \fB-z\fR options accept lists as arguments. Items in a list can be either
32 separated by commas or enclosed in quotes and separated by commas or spaces.
33 .sp
34 .LP
35 If you do not specify an option, \fBprstat\fR examines all processes and
36 reports statistics sorted by \fBCPU\fR usage.
37 .SH OPTIONS
38 .LP
39 The following options are supported:
40 .sp
41 .ne 2
42 .na
43 \fB\fB-a\fR\fR
44 .ad
45 .sp .6
46 .RS 4n
47 Report information about processes and users. In this mode \fBprstat\fR
48 displays separate reports about processes and users at the same time.
49 .RE
51 .sp
52 .ne 2
53 .na
54 \fB\fB-c\fR\fR
55 .ad
56 .sp .6
57 .RS 4n
58 Print new reports below previous reports instead of overprinting them.
59 Long names are not truncated in this mode.
60 .RE
62 .sp
63 .ne 2
64 .na
65 \fB\fB-C\fR \fIpsrsetlist\fR\fR
66 .ad
67 .sp .6
68 .RS 4n
69 Report only processes or lwps that are bound to processor sets in the given
70 list. Each processor set is identified by an integer as reported by
71 \fBpsrset\fR(1M). The load averages displayed are the sum of the load averages
72 of the specified processor sets (see \fBpset_getloadavg\fR(3C)). Processes with
73 one or more LWPs bound to processor sets in the given list are reported even
74 when the \fB-L\fR option is not used.
75 .RE
77 .sp
78 .ne 2
79 .na
80 \fB\fB-d\fR \fBu | d\fR\fR
81 .ad
82 .sp .6
83 .RS 4n
84 Specify \fBu\fR for a printed representation of the internal representation of
85 time. See \fBtime\fR(2). Specify \fBd\fR for standard date format. See
86 \fBdate\fR(1).
87 .RE
89 .sp
90 .ne 2
91 .na
92 \fB\fB-h\fR \fIlgrplist\fR\fR
93 .ad
94 .sp .6
95 .RS 4n
96 Report only processes or lwps whose home \fIlgroup\fR is in the given list of
97 \fIlgroups\fR. No processes or lwps will be listed for invalid \fIlgroups\fR.
98 .RE
101 .ne 2
103 \fB\fB-H\fR\fR
105 .sp .6
106 .RS 4n
107 Report information about home \fIlgroup\fR. In this mode, \fBprstat\fR adds an
108 extra column showing process or lwps home \fIlgroup\fR with the header LGRP.
112 .ne 2
114 \fB\fB-j\fR \fIprojlist\fR\fR
116 .sp .6
117 .RS 4n
118 Report only processes or lwps whose project \fBID\fR is in the given list. Each
119 project \fBID\fR can be specified as either a project name or a numerical
120 project \fBID\fR. See \fBproject\fR(4).
124 .ne 2
126 \fB\fB-J\fR\fR
128 .sp .6
129 .RS 4n
130 Report information about processes and projects. In this mode \fBprstat\fR
131 displays separate reports about processes and projects at the same time.
132 A trailing asterisk marks a long name that has been truncated
133 to fit the column.
137 .ne 2
139 \fB\fB-k\fR \fItasklist\fR\fR
141 .sp .6
142 .RS 4n
143 Report only processes or lwps whose task \fBID\fR is in \fItasklist\fR.
147 .ne 2
149 \fB\fB-L\fR\fR
151 .sp .6
152 .RS 4n
153 Report statistics for each light-weight process (\fBLWP\fR). By default,
154 \fBprstat\fR reports only the number of \fBLWP\fRs for each process.
158 .ne 2
160 \fB\fB-m\fR\fR
162 .sp .6
163 .RS 4n
164 Report microstate process accounting information. In addition to all fields
165 listed in \fB-v\fR mode, this mode also includes the percentage of time the
166 process has spent processing system traps, text page faults, data page faults,
167 waiting for user locks and waiting for \fBCPU\fR (latency time).
171 .ne 2
173 \fB\fB-n\fR \fIntop\fR[\fI,nbottom\fR]\fR
175 .sp .6
176 .RS 4n
177 Restrict number of output lines. The \fIntop\fR argument determines how many
178 lines of process or \fBlwp\fR statistics are reported, and the \fInbottom\fR
179 argument determines how many lines of user, task, project or zone statistics
180 are reported if the \fB-a\fR, \fB-t\fR, \fB-T\fR, \fB-J\fR or \fB-Z\fR options
181 are specified. By default, \fBprstat\fR displays as many lines of output that
182 fit in a window or terminal. When you specify the \fB-c\fR option or direct the
183 output to a file, the default values for \fBntop\fR and \fBnbottom\fR are
184 \fB15\fR and \fB5\fR.
188 .ne 2
190 \fB\fB-p\fR \fIpidlist\fR\fR
192 .sp .6
193 .RS 4n
194 Report only processes whose process \fBID\fR is in the given list.
198 .ne 2
200 \fB\fB-P\fR \fIcpulist\fR\fR
202 .sp .6
203 .RS 4n
204 Report only processes or \fBlwp\fRs which have most recently executed on a
205 \fBCPU\fR in the given list. Each \fBCPU\fR is identified by an integer as
206 reported by \fBpsrinfo\fR(1M).
210 .ne 2
212 \fB\fB-R\fR\fR
214 .sp .6
215 .RS 4n
216 Put \fBprstat\fR in the real time scheduling class. When this option is used,
217 \fBprstat\fR is given priority over time-sharing and interactive processes.
218 This option is available only for superuser.
222 .ne 2
224 \fB\fB-r\fR\fR
226 .sp .6
227 .RS 4n
228 Disable lookups for user names and project names. (Note that this does not
229 apply to lookups for the \fB-j\fR, \fB-u\fR, or \fB-U\fR options.)
233 .ne 2
235 \fB\fB-s\fR \fIkey\fR\fR
237 .sp .6
238 .RS 4n
239 Sort output lines (that is, processes, \fBlwp\fRs, or users) by \fIkey\fR in
240 descending order. Only one \fIkey\fR can be used as an argument.
242 There are five possible key values:
244 .ne 2
246 \fBcpu\fR
248 .sp .6
249 .RS 4n
250 Sort by process \fBCPU\fR usage. This is the default.
254 .ne 2
256 \fBpri\fR
258 .sp .6
259 .RS 4n
260 Sort by process priority.
264 .ne 2
266 \fBrss\fR
268 .sp .6
269 .RS 4n
270 Sort by resident set size.
274 .ne 2
276 \fBsize\fR
278 .sp .6
279 .RS 4n
280 Sort by size of process image.
284 .ne 2
286 \fBtime\fR
288 .sp .6
289 .RS 4n
290 Sort by process execution time.
296 .ne 2
298 \fB\fB-S\fR \fIkey\fR\fR
300 .sp .6
301 .RS 4n
302 Sort output lines by \fIkey\fR in ascending order. Possible \fIkey\fR values
303 are the same as for the \fB-s\fR option. See \fB-s\fR.
307 .ne 2
309 \fB\fB-t\fR\fR
311 .sp .6
312 .RS 4n
313 Report total usage summary for each user. The summary includes the total number
314 of processes or \fBLWP\fRs owned by the user, total size of process images,
315 total resident set size, total cpu time, and percentages of recent cpu time and
316 system memory.
320 .ne 2
322 \fB\fB-T\fR\fR
324 .sp .6
325 .RS 4n
326 Report information about processes and tasks. In this mode \fBprstat\fR
327 displays separate reports about processes and tasks at the same time.
331 .ne 2
333 \fB\fB-u\fR \fIeuidlist\fR\fR
335 .sp .6
336 .RS 4n
337 Report only processes whose effective user \fBID\fR is in the given list. Each
338 user \fBID\fR may be specified as either a login name or a numerical user
339 \fBID\fR.
343 .ne 2
345 \fB\fB-U\fR \fIuidlis\fRt\fR
347 .sp .6
348 .RS 4n
349 Report only processes whose real user \fBID\fR is in the given list. Each user
350 \fBID\fR may be specified as either a login name or a numerical user \fBID\fR.
354 .ne 2
356 \fB\fB-v\fR\fR
358 .sp .6
359 .RS 4n
360 Report verbose process usage. This output format includes the percentage of
361 time the process has spent in user mode, in system mode, and sleeping. It also
362 includes the number of voluntary and involuntary context switches, system calls
363 and the number of signals received. Statistics that are not reported are marked
364 with the \fB-\fR sign.
368 .ne 2
370 \fB\fB-W\fR\fR
372 .sp .6
373 .RS 4n
374 Truncate long names even when \fBprstat\fR would normally print them
375 in full.
376 A trailing asterisk marks a long name that has been truncated
377 to fit the column.
381 .ne 2
383 \fB\fB-z\fR \fIzoneidlist\fR\fR
385 .sp .6
386 .RS 4n
387 Report only processes or LWPs whose zone ID is in the given list. Each zone ID
388 can be specified as either a zone name or a numerical zone ID. See
389 \fBzones\fR(5).
393 .ne 2
395 \fB\fB-Z\fR\fR
397 .sp .6
398 .RS 4n
399 Report information about processes and zones. In this mode, \fBprstat\fR
400 displays separate reports about processes and zones at the same time.
401 A trailing asterisk marks a long name that has been truncated
402 to fit the column.
405 .SH OUTPUT
407 The following list defines the column headings and the meanings of a
408 \fBprstat\fR report:
410 .ne 2
412 \fBPID\fR
414 .sp .6
415 .RS 4n
416 The process \fBID\fR of the process.
420 .ne 2
422 \fBUSERNAME\fR
424 .sp .6
425 .RS 4n
426 The real user (login) name or real user \fBID\fR.
427 A trailing asterisk marks a long name that has been truncated
428 to fit the column.
432 .ne 2
434 \fBSWAP\fR
436 .sp .6
437 .RS 4n
438 The total virtual memory size of the process, including all mapped files and
439 devices, in kilobytes (\fBK\fR), megabytes (\fBM\fR), or gigabytes (\fBG\fR).
443 .ne 2
445 \fBRSS\fR
447 .sp .6
448 .RS 4n
449 The resident set size of the process (\fBRSS\fR), in kilobytes (\fBK\fR),
450 megabytes (\fBM\fR), or gigabytes (\fBG\fR). The RSS value is an estimate
451 provided by \fBproc\fR(4) that might underestimate the actual resident set
452 size. Users who want to get more accurate usage information for capacity
453 planning should use the \fB-x\fR option to \fBpmap\fR(1) instead.
457 .ne 2
459 \fBSTATE\fR
461 .sp .6
462 .RS 4n
463 The state of the process:
465 .ne 2
467 \fBcpu\fIN\fR\fR
469 .sp .6
470 .RS 4n
471 Process is running on \fBCPU\fR \fIN\fR.
475 .ne 2
477 \fBsleep\fR
479 .sp .6
480 .RS 4n
481 Sleeping: process is waiting for an event to complete.
485 .ne 2
487 \fBwait\fR
489 .sp .6
490 .RS 4n
491 Waiting: process is waiting for CPU usage to drop to the CPU-caps enforced
492 limits. See the description of \fBCPU-caps\fR in \fBresource_controls\fR(5).
496 .ne 2
498 \fBrun\fR
500 .sp .6
501 .RS 4n
502 Runnable: process in on run queue.
506 .ne 2
508 \fBzombie\fR
510 .sp .6
511 .RS 4n
512 Zombie state: process terminated and parent not waiting.
516 .ne 2
518 \fBstop\fR
520 .sp .6
521 .RS 4n
522 Process is stopped.
528 .ne 2
530 \fBPRI\fR
532 .sp .6
533 .RS 4n
534 The priority of the process. Larger numbers mean higher priority.
538 .ne 2
540 \fBNICE\fR
542 .sp .6
543 .RS 4n
544 Nice value used in priority computation. Only processes in certain scheduling
545 classes have a nice value.
549 .ne 2
551 \fBTIME\fR
553 .sp .6
554 .RS 4n
555 The cumulative execution time for the process.
559 .ne 2
561 \fBCPU\fR
563 .sp .6
564 .RS 4n
565 The percentage of recent \fBCPU\fR time used by the process. If executing in a
566 non-global \fBzone\fR and the pools facility is active, the percentage will be
567 that of the processors in the processor set in use by the pool to which the
568 \fBzone\fR is bound.
572 .ne 2
574 \fBPROCESS\fR
576 .sp .6
577 .RS 4n
578 The name of the process (name of executed file).
582 .ne 2
584 \fBLWP\fR
586 .sp .6
587 .RS 4n
588 The \fBlwp\fR \fBID\fR of the \fBlwp\fR being reported, as well as the LWP
589 name if any is set.
593 .ne 2
595 \fBNLWP\fR
597 .sp .6
598 .RS 4n
599 The number of \fBlwp\fRs in the process.
604 With the some options, in addition to a number of the column headings shown
605 above, there are:
607 .ne 2
609 \fBNPROC\fR
611 .sp .6
612 .RS 4n
613 Number of processes in a specified collection.
617 .ne 2
619 \fBMEMORY\fR
621 .sp .6
622 .RS 4n
623 Percentage of memory used by a specified collection of processes.
628 The following columns are displayed when the \fB-v\fR or \fB-m\fR option is
629 specified
631 .ne 2
633 \fBUSR\fR
635 .sp .6
636 .RS 4n
637 The percentage of time the process has spent in user mode.
641 .ne 2
643 \fBSYS\fR
645 .sp .6
646 .RS 4n
647 The percentage of time the process has spent in system mode.
651 .ne 2
653 \fBTRP\fR
655 .sp .6
656 .RS 4n
657 The percentage of time the process has spent in processing system traps.
661 .ne 2
663 \fBTFL\fR
665 .sp .6
666 .RS 4n
667 The percentage of time the process has spent processing text page faults.
671 .ne 2
673 \fBDFL\fR
675 .sp .6
676 .RS 4n
677 The percentage of time the process has spent processing data page faults.
681 .ne 2
683 \fBLCK\fR
685 .sp .6
686 .RS 4n
687 The percentage of time the process has spent waiting for user locks.
691 .ne 2
693 \fBSLP\fR
695 .sp .6
696 .RS 4n
697 The percentage of time the process has spent sleeping.
701 .ne 2
703 \fBLAT\fR
705 .sp .6
706 .RS 4n
707 The percentage of time the process has spent waiting for CPU.
711 .ne 2
713 \fBVCX\fR
715 .sp .6
716 .RS 4n
717 The number of voluntary context switches.
721 .ne 2
723 \fBICX\fR
725 .sp .6
726 .RS 4n
727 The number of involuntary context switches.
731 .ne 2
733 \fBSCL\fR
735 .sp .6
736 .RS 4n
737 The number of system calls.
741 .ne 2
743 \fBSIG\fR
745 .sp .6
746 .RS 4n
747 The number of signals received.
752 Under the \fB-L\fR option, one line is printed for each \fBlwp\fR in the
753 process and some reporting fields show the values for the \fBlwp\fR, not the
754 process.
757 The following column is displayed when the \fB-H\fR option is specified:
759 .ne 2
761 \fBLGRP\fR
763 .sp .6
764 .RS 4n
765 The home \fIlgroup\fR of the process or lwp.
768 .SH OPERANDS
770 The following operands are supported:
772 .ne 2
774 \fB\fIcount\fR\fR
776 .sp .6
777 .RS 4n
778 Specifies the number of times that the statistics are repeated. By default,
779 \fBprstat\fR reports statistics until a termination signal is received.
783 .ne 2
785 \fB\fIinterval\fR\fR
787 .sp .6
788 .RS 4n
789 Specifies the sampling interval in seconds; the default interval is \fB5\fR
790 seconds.
793 .SH EXAMPLES
795 \fBExample 1 \fRReporting the Five Most Active Super-User Processes
798 The following command reports the five most active super-user processes running
799 on \fBCPU1\fR and \fBCPU2\fR:
802 .in +2
804 example% prstat -u root -n 5 -P 1,2 1 1
806 PID   USERNAME  SWAP   RSS STATE  PRI  NICE      TIME  CPU PROCESS/LWP
807  306   root     3024K 1448K sleep   58    0   0:00.00 0.3% sendmail/1
808  102   root     1600K  592K sleep   59    0   0:00.00 0.1% in.rdisc/1
809  250   root     1000K  552K sleep   58    0   0:00.00 0.0% utmpd/1
810  288   root     1720K 1032K sleep   58    0   0:00.00 0.0% sac/1
811    1   root      744K  168K sleep   58    0   0:00.00 0.0% init/1
812 TOTAL:       25, load averages:  0.05, 0.08, 0.12
814 .in -2
818 \fBExample 2 \fRDisplaying Verbose Process Usage Information
821 The following command displays verbose process usage information about
822 processes with lowest resident set sizes owned by users \fBroot\fR and
823 \fBjohn\fR.
826 .in +2
828 example% prstat -S rss -n 5 -vc -u root,john
830  PID USERNAME USR SYS TRP TFL DFL LCK SLP LAT VCX ICX SCL SIG PROCESS/LWP
831    1 root     0.0 0.0  -   -   -   -  100  -    0   0   0   0 init/1
832  102 root     0.0 0.0  -   -   -   -  100  -    0   0   3   0 in.rdisc/1
833  250 root     0.0 0.0  -   -   -   -  100  -    0   0   0   0 utmpd/1
834 1185 john    0.0 0.0  -   -   -   -  100  -    0   0   0   0 csh/1
835  240 root     0.0 0.0  -   -   -   -  100  -    0   0   0   0 powerd/4
836  TOTAL:       71, load averages:  0.02, 0.04, 0.08
839 .in -2
842 .SH EXIT STATUS
844 The following exit values are returned:
846 .ne 2
848 \fB\fB0\fR\fR
850 .sp .6
851 .RS 4n
852 Successful completion.
856 .ne 2
858 \fB\fB1\fR\fR
860 .sp .6
861 .RS 4n
862 An error occurred.
865 .SH SEE ALSO
867 \fBdate\fR(1), \fBlgrpinfo\fR(1), \fBplgrp\fR(1), \fBproc\fR(1), \fBps\fR(1),
868 \fBtime\fR(2), \fBpsrinfo\fR(1M), \fBpsrset\fR(1M), \fBsar\fR(1M),
869 \fBpset_getloadavg\fR(3C), \fBproc\fR(4), \fBproject\fR(4),
870 \fBattributes\fR(5), \fBresource_controls\fR(5), \fBzones\fR(5)
871 .SH NOTES
873 The snapshot of system usage displayed by \fBprstat\fR is true only for a
874 split-second, and it may not be accurate by the time it is displayed. When the
875 \fB-m\fR option is specified, \fBprstat\fR tries to turn on microstate
876 accounting for each process; the original state is restored when \fBprstat\fR
877 exits. See \fBproc\fR(4) for additional information about the microstate
878 accounting facility.
881 The total memory size reported in the SWAP and RSS columns for groups of
882 processes can sometimes overestimate the actual amount of memory used by
883 processes with shared memory segments.