The following is a demonstration of the dvmstat program,


Here we run dvmstat to monitor all processes called "find". In another 
window, a "find /" command is run,

   # dvmstat -n find
       re   maj    mf   fr  epi  epo  api  apo  fpi  fpo     sy
        0     0     0    0    0    0    0    0    0    0      0
        0     0     0    0    0    0    0    0    0    0      0
     6336     0   372    0    0    0    0    0    0    0  22255
     1624     0     0    0    0    0    0    0    0    0   5497
     2292     0     0    0    0    0    0    0    0    0   7715
    13064     0     0    0    0    0    0    0    0    0  43998
     7972   168     0    0    0    0    0    0  168    0  38361
      468   636     0    0    0    0    0    0  636    0  13774
      376   588     0    0    0    0    0    0  588    0  10723
       80   636     0    0    0    0    0    0  656    0  11078
       48   772     0    0    0    0    0    0  812    0   9841
       16  1028     0    0    0    0    0    0 1056    0  10752
        0  1712     0    0    0    0    0    0 1740    0  12176
        4  1224     0    0    0    0    0    0 1236    0   9024

The output above is spectacular! When the find command is first run, 
it begins be reading data from the file cache, as indicated by the "re"
reclaims, and a lack of "fpi" filesystem page ins.

Eventually the find command travels to places which are not cached, we can
see the "re" value drops, and both the "maj" major faults and "fpi" values
increase. This transition from cache hits to file system activity is 
very clear from the above output.



Here we run a dvmstat to examine the PID 3778,

   # dvmstat -p 3778
       re   maj    mf   fr  epi  epo  api  apo  fpi  fpo     sy
        0     0     0    0    0    0    0    0    0    0      0
        0     0     0    0    0    0    0    0    0    0      0
       24    28     0    0    0    0    0    0   28    0    109
        4   148    16    0    0    0    0    0  148    0   1883
       16   412   384    0    0    0    0    0  412    0  21019
        0     0     0    0    0    0    0    0    0    0      3
        0     0     0    0    0    0    0    0    0    0    221
        0     0     0    0    0    0    0    0    0    0      0
        0     0     0    0    0    0    0    0    0    0     84
        0     0     0    0    0    0    0    0    0    0      0

Here we can see the statistics for that process only.



The following runs the date command through dvmstat,

   # dvmstat date
   Sun Jun 12 17:44:24 EST 2005
       re   maj    mf   fr  epi  epo  api  apo  fpi  fpo     sy
       16     0   208    0    0    0    0    0    0    0     38

The values above are for the date command only.



Now we run dvmstat on a tar command. Here we tar around 50Mb of files,
so the command takes around 20 seconds to complete,

   # dvmstat tar cf backup.tar DTrace
       re   maj    mf   fr  epi  epo  api  apo  fpi  fpo     sy
       20   256   304    0    8    0    0    0  352    0    621
     4540    56   896    0    0    0    0    0 4636    0   1005
     4432    12   644    0    0    0    0    0 4384    0    906
      680   180   136    0    8    0    0    0 1056    0    502
     2328    60   468    0    0    0    0    0 2296    0    592
     1300   380   272    0    0    0    0    0 1704    0   1095
     2816    72   560    0    0    0    0    0 2940    0    709
     4084    40   416    0    0    0    0    0 4220    0    894
     2764     4   276    0    0    0    0    0 2700    0    566
     1824    96   328    0    0    0    0    0 2072    0    556
     3408    80   392    0   20    0    0    0 3496    0    857
     2804    92   552    0    4    0    0    0 2924    0    741
     1344    16   272    0    0    0    0    0 1376    0    289
     3284    52   520    0   12    0    0    0 3260    0    743
     4832   200   812    0    0    0    0    0 5292    0   1276
    11052    56  2200    0    0    0    0    0 8676    0   2326
     5256   328  1020    0    8    0    0    0 4404    0   1725
       re   maj    mf   fr  epi  epo  api  apo  fpi  fpo     sy
      404   340    72    0   64    0    0    0  536    0   1135

Great! Activity from the tar command such as "fpi"s can be clearly seen.

