kvm_statcommand is a python script which retrieves runtime statistics from the
kvmkernel module. The
kvm_statcommand can be used to diagnose guest behavior visible to
kvm. In particular, performance related issues with guests. Currently, the reported statistics are for the entire system; the behavior of all running guests is reported. To run this script you need to install the qemu-kvm-tools package.
kvm_statcommand requires that the
kvmkernel module is loaded and
debugfsis mounted. If either of these features are not enabled, the command will output the required steps to enable
kvmmodule. For example:
# kvm_stat Please mount debugfs ('mount -t debugfs debugfs /sys/kernel/debug') and ensure the kvm modules are loaded
# mount -t debugfs debugfs /sys/kernel/debug
kvm_stat command outputs statistics for all guests and the host. The output is updated until the command is terminated (using Ctrl+c or the q key).
# kvm_stat kvm statistics efer_reload 94 0 exits 4003074 31272 fpu_reload 1313881 10796 halt_exits 14050 259 halt_wakeup 4496 203 host_state_reload 1638354 24893 hypercalls 0 0 insn_emulation 1093850 1909 insn_emulation_fail 0 0 invlpg 75569 0 io_exits 1596984 24509 irq_exits 21013 363 irq_injections 48039 1222 irq_window 24656 870 largepages 0 0 mmio_exits 11873 0 mmu_cache_miss 42565 8 mmu_flooded 14752 0 mmu_pde_zapped 58730 0 mmu_pte_updated 6 0 mmu_pte_write 138795 0 mmu_recycled 0 0 mmu_shadow_zapped 40358 0 mmu_unsync 793 0 nmi_injections 0 0 nmi_window 0 0 pf_fixed 697731 3150 pf_guest 279349 0 remote_tlb_flush 5 0 request_irq 0 0 signal_exits 1 0 tlb_flush 200190 0
Explanation of variables:
- The number of Extended Feature Enable Register (EFER) reloads.
- The count of all
- The number of times a
VMENTRYreloaded the FPU state. The
fpu_reloadis incremented when a guest is using the Floating Point Unit (FPU).
- Number of guest exits due to
haltcalls. This type of exit is usually seen when a guest is idle.
- Number of wakeups from a
- Count of full reloads of the host state (currently tallies MSR setup and guest MSR reads).
- Number of guest hypervisor service calls.
- Number of guest instructions emulated by the host.
- Number of failed
- Number of guest exits from I/O port accesses.
- Number of guest exits due to external interrupts.
- Number of interrupts sent to guests.
- Number of guest exits from an outstanding interrupt window.
- Number of large pages currently in use.
- Number of guest exits due to memory mapped I/O (MMIO) accesses.
- Number of KVM MMU shadow pages created.
- Detection count of excessive write operations to an MMU page. This counts detected write operations not of individual write operations.
- Number of page directory entry (PDE) destruction operations.
- Number of page table entry (PTE) destruction operations.
- Number of guest page table entry (PTE) write operations.
- Number of shadow pages that can be reclaimed.
- Number of invalidated shadow pages.
- Number of non-synchronized pages which are not yet unlinked.
- Number of Non-maskable Interrupt (NMI) injections to the guest.
- Number of guest exits from (outstanding) Non-maskable Interrupt (NMI) windows.
- Number of fixed (non-paging) page table entry (PTE) maps.
- Number of page faults injected into guests.
- Number of remote (sibling CPU) Translation Lookaside Buffer (TLB) flush requests.
- Number of guest interrupt window request exits.
- Number of guest exits due to pending signals from the host.
- Number of
tlb_flushoperations performed by the hypervisor.
kvm_statcommand is exported by the KVM hypervisor as pseudo files located in the