How to get the number of instructions executed inside a virtual machine from the host?

60 Views Asked by At

I have attempted to use the perf kvm stat -p vmpid command to get the number of instructions executed.

However, I have observed that the command still reports a significant number of instructions even in the VM guest kernel crash state (instruction expects to approach 0). Just like:

          3,835.91 msec task-clock:G              #    1.000 CPUs utilized
                25      context-switches:G        #    0.007 K/sec
                 7      cpu-migrations:G          #    0.002 K/sec
                 0      page-faults:G             #    0.000 K/sec
    10,879,172,713      cycles:G                  #    2.836 GHz
       905,371,317      instructions:G            #    0.08  insn per cycle
       150,903,724      branches:G                #   39.340 M/sec
            23,387      branch-misses:G           #    0.02% of all branches

Is there an alternative method to exclusively capture the count of instructions executed internally by the VM?

My virtual machine is based on the qemu/kvm platform.

I appreciate any insights or suggestions on how to accurately measure the executed instructions within the VM from the host side.

PS: The guest kernel crash was manually triggered by me, and the command is echo c > /proc/sysrq-trigger

0

There are 0 best solutions below