Saturday, July 13, 2013

Understanding prstat and vmstat command…





Vmstat - Reports Virtual Memory Statistics.

# vmstat
Provides information for the entire system


# prstat –Zc 1
   PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP
 27770 root       17M 3336K sleep    1    0  17:47:35 1.8% perl/1
 15530 user1    5296K 4888K cpu0    50    0   0:00:00 1.3% prstat/1
  8791 root      171M   11M sleep   59    0  49:30:01 1.2% nscd/35
  5976 root       19M 4080K sleep   59  -20  27:51:52 0.8% perfd/4
   127 daemon   4304K 1064K sleep   56    0  67:38:44 0.5% rcapd/1
 25200 root     9688K 7392K sleep   59    0   0:00:21 0.4% perl/1
 19148 root     9720K 7416K sleep   58    0   0:00:28 0.4% perl/1
 13362 root     9624K 7520K sleep   59    0   0:00:02 0.3% perl/1
 19365 root     9720K 7400K sleep    1    0   0:00:28 0.3% perl/1
 13152 root     9616K 7512K sleep   57    0   0:00:02 0.3% perl/1
  1045 root     9680K 7408K sleep   56    0   0:00:15 0.3% perl/1
   844 root     9680K 7392K sleep   43    0   0:00:15 0.3% perl/1
 24943 root     9688K 7352K sleep   59    0   0:00:21 0.3% perl/1
  6772 root     9648K 7480K sleep   57    0   0:00:08 0.3% perl/1
  7028 root     9648K 7472K sleep   59    0   0:00:08 0.3% perl/1
ZONEID    NPROC  SIZE   RSS MEMORY      TIME  CPU ZONE
     0      502 2645M  667M   100% 299:12:00  11% global

Where
Z – Reports information about processes and zones.  In this mode, prstat displays separate reports about processes and zones at the same time.
-c – Print new reports below previous reports instead of overlapping the old.

27770 root       17M 3336K sleep    1    0  17:47:35 1.8% perl/1
Says that, ‘perl’ – utilize whole 1 CPU

 


# prstat –ZcmL 1

ð  m – Report mircostate process accounting information.  Also reports 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).
ð  L – Report statistics for each light-weight process (LWP). 
NOTE: By default, prstat reports only the number of LWPs for each process.
PID USERNAME USR SYS TRP TFL DFL LCK SLP LAT VCX ICX SCL SIG PROCESS/LWPID
  8791 root      26 0.1 0.0 0.0 0.0 0.0  69 4.7  15 153 118   0 nscd/1172
 25934 root     2.6 0.0 0.0 0.0 0.0  95 0.0 2.1   7  13  10   0 dna/2
 18412 user1    0.4 1.7 0.0 0.8 0.8 0.0  89 7.5  38  39  1K   0 prstat/1
  5976 root     0.3 1.8 0.0 0.0 0.0 0.0  98 0.4   3  57  2K   0 perfd/1
 27770 root     0.5 1.6 0.0 0.0 0.0 0.0  91 6.8  11  55  2K   0 scopeux/1
   127 daemon   0.2 1.3 0.0 0.0 0.0 0.0  98 0.2   8  51  1K   0 rcapd/1
  1824 root     0.3 0.5 0.2 0.0 0.0 0.0  85  14  39  16 759  26 pingtest.sh/1
  7028 root     0.3 0.2 0.0 0.0 0.0 0.0  96 3.8  44   8 245   0 perl/1
 13152 root     0.3 0.2 0.0 0.0 0.0 0.0  96 3.9  41   4 222   0 perl/1
 13362 root     0.2 0.1 0.0 0.0 0.0 0.0  73  27  32   3 180   0 perl/1
 25200 root     0.2 0.1 0.0 0.0 0.0 0.0  74  26  33   7 183   0 perl/1
   844 root     0.2 0.1 0.0 0.0 0.0 0.0  67  32  30  11 164   0 perl/1
  6772 root     0.2 0.1 0.0 0.0 0.0 0.0  74  26  32   4 176   0 perl/1
 24943 root     0.2 0.1 0.0 0.0 0.0 0.0  74  26  30   2 158   0 perl/1
  1045 root     0.2 0.1 0.0 0.0 0.0 0.0  65  34  29   3 155   0 perl/1
ZONEID     NLWP  SIZE   RSS MEMORY      TIME  CPU ZONE
     0      872 2636M  653M   100% 277:26:26  17% global
Total: 497 processes, 872 lwps, load averages: 0.95, 1.13, 1.06




# vmstat
# vmstat        1             5


User-1@Solairs_Virtual_Box1$ vmstat 1 5
 kthr      memory            page            disk          faults      cpu
 r b w   swap  free  re  mf pi po fr de sr lf lf m1 m1   in   sy   cs us sy id
 0 0 65 4222656 36032 34 199 131 9 13 0 297 0  0  1  1  563 2138  483 16  9 74
 4 0 240 2707464 13408 39 437 489 0 0 0  0  0  0  6  3  713 7687  523 26 34 40
 1 0 240 2707632 13712 191 894 722 0 0 0 0  0  0 11  5  822 1629  538  6 22 73
 2 0 240 2707536 13488 581 4873 1561 8 0 0 0 0 0 25 13 1130 4797  871 19 71 11
 0 0 240 2707744 13664 51 36 455 0 0  0  0  0  0  0  0  767  698  471  2  9 89



Reports the summary, ie, from the time of reboot to till (uptime to till).