3.2. Process Statistics Summary: prstatThe process statistics utility, prstat, shows us a top-level summary of the processes that are using system resources. The prstat utility summarizes this information every 5 seconds by default and reports the statistics for that period. $ prstat PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP 25646 rmc 1613M 42M cpu15 0 10 0:33:10 3.1% filebench/2 25661 rmc 1613M 42M cpu8 0 10 0:33:11 3.1% filebench/2 25652 rmc 1613M 42M cpu20 0 10 0:33:09 3.1% filebench/2 25647 rmc 1613M 42M cpu0 0 10 0:33:10 3.1% filebench/2 25641 rmc 1613M 42M cpu27 0 10 0:33:10 3.1% filebench/2 25656 rmc 1613M 42M cpu7 0 10 0:33:10 3.1% filebench/2 25634 rmc 1613M 42M cpu11 0 10 0:33:11 3.1% filebench/2 25637 rmc 1613M 42M cpu17 0 10 0:33:10 3.1% filebench/2 25643 rmc 1613M 42M cpu12 0 10 0:33:10 3.1% filebench/2 25648 rmc 1613M 42M cpu1 0 10 0:33:10 3.1% filebench/2 25640 rmc 1613M 42M cpu26 0 10 0:33:10 3.1% filebench/2 25651 rmc 1613M 42M cpu31 0 10 0:33:10 3.1% filebench/2 25654 rmc 1613M 42M cpu29 0 10 0:33:10 3.1% filebench/2 25650 rmc 1613M 42M cpu5 0 10 0:33:10 3.1% filebench/2 25653 rmc 1613M 42M cpu10 0 10 0:33:10 3.1% filebench/2 25638 rmc 1613M 42M cpu18 0 10 0:33:10 3.1% filebench/2 25660 rmc 1613M 42M cpu13 0 10 0:33:10 3.1% filebench/2 25635 rmc 1613M 42M cpu25 0 10 0:33:10 3.1% filebench/2 25642 rmc 1613M 42M cpu28 0 10 0:33:10 3.1% filebench/2 25649 rmc 1613M 42M cpu19 0 10 0:33:08 3.1% filebench/2 25645 rmc 1613M 42M cpu3 0 10 0:33:10 3.1% filebench/2 25657 rmc 1613M 42M cpu4 0 10 0:33:09 3.1% filebench/2 Total: 91 processes, 521 lwps, load averages: 29.06, 28.84, 26.68 The default output for prstat shows one line of output per process. Entries are sorted by CPU consumption. The columns are as follows:
3.2.1. Thread Summary: prstat -LThe -L option causes prstat to show one thread per line instead of one process per line. $ prstat -L PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/LWPID 25689 rmc 1787M 217M sleep 59 0 0:00:08 0.1% filebench/1 25965 rmc 1785M 214M cpu22 60 10 0:00:00 0.1% filebench/2 26041 rmc 1785M 214M cpu4 60 10 0:00:00 0.0% filebench/2 26016 rmc 1785M 214M sleep 60 10 0:00:00 0.0% filebench/2 9 root 10M 9648K sleep 59 0 0:00:14 0.0% svc.configd/14 9 root 10M 9648K sleep 59 0 0:00:26 0.0% svc.configd/12 26174 rmc 5320K 5320K cpu30 59 0 0:00:00 0.0% prstat/1 9 root 10M 9648K sleep 59 0 0:00:36 0.0% svc.configd/10 7 root 19M 17M sleep 59 0 0:00:11 0.0% svc.startd/9 93 root 2600K 1904K sleep 59 0 0:00:00 0.0% syseventd/12 93 root 2600K 1904K sleep 59 0 0:00:00 0.0% syseventd/11 93 root 2600K 1904K sleep 59 0 0:00:00 0.0% syseventd/10 93 root 2600K 1904K sleep 59 0 0:00:00 0.0% syseventd/9 93 root 2600K 1904K sleep 59 0 0:00:00 0.0% syseventd/8 93 root 2600K 1904K sleep 59 0 0:00:00 0.0% syseventd/7 93 root 2600K 1904K sleep 59 0 0:00:00 0.0% syseventd/6 93 root 2600K 1904K sleep 59 0 0:00:00 0.0% syseventd/5 ... The output is similar to the previous example, but the last column is now represented by process name and thread number:
3.2.2. Process Microstates: prstat -mThe process microstates can be very useful to help identify why a process or thread is performing suboptimally. By specifying the -m (show microstates) and -L (show per-thread) options, you can observe the per-thread microstates. The microstates represent a time-based summary broken into percentages of each thread. The columns USR tHRough LAT sum to 100% of the time spent for each thread during the prstat sample. $ prstat -mL PID USERNAME USR SYS TRP TFL DFL LCK SLP LAT VCX ICX SCL SIG PROCESS/LWPID 25644 rmc 98 1.5 0.0 0.0 0.0 0.0 0.0 0.1 0 36 693 0 filebench/2 25660 rmc 98 1.7 0.1 0.0 0.0 0.0 0.0 0.1 2 44 693 0 filebench/2 25650 rmc 98 1.4 0.1 0.0 0.0 0.0 0.0 0.1 0 45 699 0 filebench/2 25655 rmc 98 1.4 0.1 0.0 0.0 0.0 0.0 0.2 0 46 693 0 filebench/2 25636 rmc 98 1.6 0.1 0.0 0.0 0.0 0.0 0.2 1 50 693 0 filebench/2 25651 rmc 98 1.6 0.1 0.0 0.0 0.0 0.0 0.2 0 54 693 0 filebench/2 25656 rmc 98 1.5 0.1 0.0 0.0 0.0 0.0 0.2 0 60 693 0 filebench/2 25639 rmc 98 1.5 0.1 0.0 0.0 0.0 0.0 0.2 1 61 693 0 filebench/2 25634 rmc 98 1.3 0.1 0.0 0.0 0.0 0.0 0.4 0 63 693 0 filebench/2 25654 rmc 98 1.3 0.1 0.0 0.0 0.0 0.0 0.4 0 67 693 0 filebench/2 25659 rmc 98 1.7 0.1 0.0 0.0 0.0 0.0 0.4 1 68 693 0 filebench/2 25647 rmc 98 1.5 0.1 0.0 0.0 0.0 0.0 0.4 0 73 693 0 filebench/2 25648 rmc 98 1.6 0.1 0.0 0.0 0.0 0.3 0.2 2 48 693 0 filebench/2 25643 rmc 98 1.6 0.1 0.0 0.0 0.0 0.0 0.5 0 75 693 0 filebench/2 25642 rmc 98 1.4 0.1 0.0 0.0 0.0 0.0 0.5 0 80 693 0 filebench/2 25638 rmc 98 1.4 0.1 0.0 0.0 0.0 0.0 0.6 0 76 693 0 filebench/2 25657 rmc 97 1.8 0.1 0.0 0.0 0.0 0.4 0.3 6 64 693 0 filebench/2 25646 rmc 97 1.7 0.1 0.0 0.0 0.0 0.0 0.6 6 83 660 0 filebench/2 25645 rmc 97 1.6 0.1 0.0 0.0 0.0 0.0 0.9 0 55 693 0 filebench/2 25652 rmc 97 1.7 0.2 0.0 0.0 0.0 0.0 0.9 2 106 693 0 filebench/2 25658 rmc 97 1.5 0.1 0.0 0.0 0.0 0.0 1.0 0 72 693 0 filebench/2 25637 rmc 97 1.7 0.1 0.0 0.0 0.0 0.3 0.6 4 95 693 0 filebench/2 Total: 91 processes, 510 lwps, load averages: 28.94, 28.66, 24.39 As discussed in Section 2.11, you can use the USR and SYS states to see what percentage of the elapsed sample interval a process spent on the CPU, and LAT as the percentage of time waiting for CPU. Likewise, you can use the TFL and DTL to determine if and by how much a process is waiting for memory pagingsee Section 6.6.1. The remainder of important events such as disk and network waits are bundled into the SLP state, along with other kernel wait events. While SLP column is inclusive of disk I/O, other types of blocking can cause time to be spent in the SLP state. For example, kernel locks or condition variables also accumulate time in this state. 3.2.3. Sorting by a Key: prstat -sThe output from prstat can be sorted by a set of keys, as directed by the -s option. For example, if we want to show processes with the largest physical memory usage, we can use prstat -s rss. $ prstat -s rss PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP 20340 ftp 183M 176M sleep 59 0 0:00:24 0.0% httpd/1 4024 daemon 11M 10M sleep 59 0 0:00:06 0.0% nfsmapid/19 2632 daemon 11M 9980K sleep 59 0 0:00:06 0.0% nfsmapid/5 7 root 10M 9700K sleep 59 0 0:00:05 0.0% svc.startd/14 9 root 9888K 8880K sleep 59 0 0:00:08 0.0% svc.configd/46 21091 ftp 13M 8224K sleep 59 0 0:00:00 0.0% httpd/1 683 root 7996K 7096K sleep 59 0 0:00:07 0.0% svc.configd/16 680 root 7992K 7096K sleep 59 0 0:00:07 0.0% svc.configd/15 671 root 7932K 7068K sleep 59 0 0:00:04 0.0% svc.startd/13 682 root 7956K 7064K sleep 59 0 0:00:07 0.0% svc.configd/43 668 root 7924K 7056K sleep 59 0 0:00:03 0.0% svc.startd/13 669 root 7920K 7056K sleep 59 0 0:00:03 0.0% svc.startd/15 685 root 7876K 6980K sleep 59 0 0:00:07 0.0% svc.configd/15 684 root 7824K 6924K sleep 59 0 0:00:07 0.0% svc.configd/16 670 root 7796K 6924K sleep 59 0 0:00:03 0.0% svc.startd/12 687 root 7712K 6816K sleep 59 0 0:00:07 0.0% svc.configd/17 664 root 7668K 6756K sleep 59 0 0:00:03 0.0% svc.startd/12 681 root 7644K 6752K sleep 59 0 0:00:08 0.0% svc.configd/13 686 root 7644K 6744K sleep 59 0 0:00:08 0.0% svc.configd/17 ... The following are valid keys for sorting:
The -S option sorts by ascending order, rather than descending. 3.2.4. User Summary: prstat -tA summary by user ID can be printed with the -t option. $ prstat -t NPROC USERNAME SIZE RSS MEMORY TIME CPU 233 root 797M 477M 48% 0:05:31 0.4% 50 daemon 143M 95M 9.6% 0:00:12 0.0% 14 40000 112M 28M 2.8% 0:00:00 0.0% 2 rmc 9996K 3864K 0.4% 0:00:04 0.0% 2 ftp 196M 184M 19% 0:00:24 0.0% 2 50000 4408K 2964K 0.3% 0:00:00 0.0% 18 nobody 104M 51M 5.2% 0:00:00 0.0% 8 webservd 48M 21M 2.1% 0:00:00 0.0% 7 smmsp 47M 10M 1.0% 0:00:00 0.0% Total: 336 processes, 1201 lwps, load averages: 0.02, 0.01, 0.01 3.2.5. Project Summary: prstat -JA summary by project ID can be generated with the -J option. This is very useful for summarizing per-project resource utilization. See Chapter 7 in Solaris™ Internals for information about using projects. $ prstat -J PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP 21130 root 4100K 3264K cpu0 59 0 0:00:00 0.2% prstat/1 21109 root 7856K 2052K sleep 59 0 0:00:00 0.0% sshd/1 21111 root 1200K 952K sleep 59 0 0:00:00 0.0% ksh/1 2632 daemon 11M 9980K sleep 59 0 0:00:06 0.0% nfsmapid/5 118 root 3372K 2372K sleep 59 0 0:00:06 0.0% nscd/24 PROJID NPROC SIZE RSS MEMORY TIME CPU PROJECT 3 8 39M 18M 1.8% 0:00:00 0.2% default 0 323 1387M 841M 85% 0:05:58 0.0% system 10 3 18M 8108K 0.8% 0:00:04 0.0% group.staff 1 2 19M 6244K 0.6% 0:00:09 0.0% user.root Total: 336 processes, 1201 lwps, load averages: 0.02, 0.01, 0.01 3.2.6. Zone Summary: prstat -ZThe -Z option provides a summary per zone. See Chapter 6 in Solaris™ Internals for more information about Solaris Zones. $ prstat -Z PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP 21132 root 2952K 2692K cpu0 49 0 0:00:00 0.1% prstat/1 21109 root 7856K 2052K sleep 59 0 0:00:00 0.0% sshd/1 2179 root 4952K 2480K sleep 59 0 0:00:21 0.0% automountd/3 21111 root 1200K 952K sleep 49 0 0:00:00 0.0% ksh/1 2236 root 4852K 2368K sleep 59 0 0:00:06 0.0% automountd/3 2028 root 4912K 2428K sleep 59 0 0:00:10 0.0% automountd/3 118 root 3372K 2372K sleep 59 0 0:00:06 0.0% nscd/24 ZONEID NPROC SIZE RSS MEMORY TIME CPU ZONE 0 47 177M 104M 11% 0:00:31 0.1% global 5 33 302M 244M 25% 0:01:12 0.0% gallery 3 40 161M 91M 9.2% 0:00:40 0.0% nakos 4 43 171M 94M 9.5% 0:00:44 0.0% mcdougallfamily 2 30 96M 56M 5.6% 0:00:23 0.0% shared 1 32 113M 60M 6.0% 0:00:45 0.0% packer 7 43 203M 87M 8.7% 0:00:55 0.0% si Total: 336 processes, 1202 lwps, load averages: 0.02, 0.01, 0.01 |