Add a new option to kvmstat that allows to filter by PID

Review Request #72 — Created July 10, 2015 and updated — Latest diff uploaded

tuxillo
illumos-gate
general

kvmstat - Add -p to filter by PID

[root@sm01 /opt/custom/bin/b]# ./kvmstat
   pid vcpu |  exits :  haltx   irqx  irqwx    iox  mmiox |   irqs   emul   eptv
 32020    0 |    542 :     69      3      0     14    141 |     69    363      0
 32020    1 |    435 :     72      4      2     29    145 |     77    242      0
 18743    0 |   8683 :   1180     42      9     23   2368 |   1198   6189      0
 18743    1 |   6775 :   1185     28      9     21   2384 |   1209   4169      0
   pid vcpu |  exits :  haltx   irqx  irqwx    iox  mmiox |   irqs   emul   eptv
 32020    0 |    553 :     73      3      0     14    148 |     73    368      0
 32020    1 |    425 :     69      7      2     24    138 |     74    244      0
 18743    0 |   8927 :   1216     71      5     31   2440 |   1244   6325      0
 18743    1 |   6908 :   1177     36      7      7   2372 |   1211   4301      0
   pid vcpu |  exits :  haltx   irqx  irqwx    iox  mmiox |   irqs   emul   eptv
 32020    0 |    543 :     72      1      0      6    147 |     72    371      0
 32020    1 |    451 :     72      2      2     37    145 |     78    256      0
 18743    0 |   8939 :   1201     52     13     31   2439 |   1232   6370      0
 18743    1 |   7089 :   1209     35      7     27   2466 |   1249   4404      0
^C
[root@sm01 /opt/custom/bin/b]# ./kvmstat -h
Usage: kvmstat [-p pid] [interval [count]]

  Displays statistics for running kernel virtual machines, with one line
  per virtual CPU.  All statistics are reported as per-second rates.

  The columns are as follows:

    pid    =>  identifier of process controlling the virtual CPU
    vcpu   =>  virtual CPU identifier relative to its virtual machine
    exits  =>  virtual machine exits for the virtual CPU
    haltx  =>  virtual machine exits due to the HLT instruction
    irqx   =>  virtual machine exits due to a pending external interrupt
    irqwx  =>  virtual machine exits due to an open interrupt window
    iox    =>  virtual machine exits due to an I/O instruction
    mmiox  =>  virtual machine exits due to memory mapped I/O
    irqs   =>  interrupts injected into the virtual CPU
    emul   =>  instructions emulated in the kernel
    eptv   =>  extended page table violations

[root@sm01 /opt/custom/bin/b]# ./kvmstat -p 32020
   pid vcpu |  exits :  haltx   irqx  irqwx    iox  mmiox |   irqs   emul   eptv
 32020    0 |    548 :     69      9      0      6    141 |     70    375      0
 32020    1 |    436 :     71      4      3     32    143 |     79    243      0
   pid vcpu |  exits :  haltx   irqx  irqwx    iox  mmiox |   irqs   emul   eptv
 32020    0 |    534 :     70      3      0      6    142 |     70    364      0
 32020    1 |    443 :     72      3      2     37    144 |     78    246      0
^C
Loading...