A.4. kvm_stat
kvm_stat 命令是一个 python 脚本,可从
kvm
内核模块检索运行时统计信息。kvm_stat 命令可用于诊断对 kvm
可见的客户机行为。特别是,与客户机相关的问题。目前,报告的统计信息适用于整个系统;报告所有正在运行的 guest 的行为。要运行此脚本,您需要安装 qemu-kvm-tools 软件包。如需更多信息,请参阅 第 2.2 节 “在现有 Red Hat Enterprise Linux 系统上安装虚拟化软件包”。
kvm_stat 命令要求加载
kvm
内核模块并挂载 debugfs。如果没有启用这些功能,命令将输出启用 debugfs 或 kvm
模块所需的步骤。例如:
# kvm_stat
Please mount debugfs ('mount -t debugfs debugfs /sys/kernel/debug')
and ensure the kvm modules are loaded
如果需要,挂载 debugfs :
# mount -t debugfs debugfs /sys/kernel/debug
kvm_stat 输出
kvm_stat 命令输出所有客户机和主机的统计信息。在命令终止前更新输出(使用 Ctrl+c 或 q 键)。请注意,您屏幕上看到的输出可能有所不同。有关输出元素的说明,请点击任何术语来链接到该失效。
# kvm_stat kvm statistics kvm_exit 17724 66 Individual exit reasons follow, see kvm_exit (NAME) for more information. kvm_exit(CLGI) 0 0 kvm_exit(CPUID) 0 0 kvm_exit(CR0_SEL_WRITE) 0 0 kvm_exit(EXCP_BASE) 0 0 kvm_exit(FERR_FREEZE) 0 0 kvm_exit(GDTR_READ) 0 0 kvm_exit(GDTR_WRITE) 0 0 kvm_exit(HLT) 11 11 kvm_exit(ICEBP) 0 0 kvm_exit(IDTR_READ) 0 0 kvm_exit(IDTR_WRITE) 0 0 kvm_exit(INIT) 0 0 kvm_exit(INTR) 0 0 kvm_exit(INVD) 0 0 kvm_exit(INVLPG) 0 0 kvm_exit(INVLPGA) 0 0 kvm_exit(IOIO) 0 0 kvm_exit(IRET) 0 0 kvm_exit(LDTR_READ) 0 0 kvm_exit(LDTR_WRITE) 0 0 kvm_exit(MONITOR) 0 0 kvm_exit(MSR) 40 40 kvm_exit(MWAIT) 0 0 kvm_exit(MWAIT_COND) 0 0 kvm_exit(NMI) 0 0 kvm_exit(NPF) 0 0 kvm_exit(PAUSE) 0 0 kvm_exit(POPF) 0 0 kvm_exit(PUSHF) 0 0 kvm_exit(RDPMC) 0 0 kvm_exit(RDTSC) 0 0 kvm_exit(RDTSCP) 0 0 kvm_exit(READ_CR0) 0 0 kvm_exit(READ_CR3) 0 0 kvm_exit(READ_CR4) 0 0 kvm_exit(READ_CR8) 0 0 kvm_exit(READ_DR0) 0 0 kvm_exit(READ_DR1) 0 0 kvm_exit(READ_DR2) 0 0 kvm_exit(READ_DR3) 0 0 kvm_exit(READ_DR4) 0 0 kvm_exit(READ_DR5) 0 0 kvm_exit(READ_DR6) 0 0 kvm_exit(READ_DR7) 0 0 kvm_exit(RSM) 0 0 kvm_exit(SHUTDOWN) 0 0 kvm_exit(SKINIT) 0 0 kvm_exit(SMI) 0 0 kvm_exit(STGI) 0 0 kvm_exit(SWINT) 0 0 kvm_exit(TASK_SWITCH) 0 0 kvm_exit(TR_READ) 0 0 kvm_exit(TR_WRITE) 0 0 kvm_exit(VINTR) 1 1 kvm_exit(VMLOAD) 0 0 kvm_exit(VMMCALL) 0 0 kvm_exit(VMRUN) 0 0 kvm_exit(VMSAVE) 0 0 kvm_exit(WBINVD) 0 0 kvm_exit(WRITE_CR0) 2 2 kvm_exit(WRITE_CR3) 0 0 kvm_exit(WRITE_CR4) 0 0 kvm_exit(WRITE_CR8) 0 0 kvm_exit(WRITE_DR0) 0 0 kvm_exit(WRITE_DR1) 0 0 kvm_exit(WRITE_DR2) 0 0 kvm_exit(WRITE_DR3) 0 0 kvm_exit(WRITE_DR4) 0 0 kvm_exit(WRITE_DR5) 0 0 kvm_exit(WRITE_DR6) 0 0 kvm_exit(WRITE_DR7) 0 0 kvm_entry 17724 66 kvm_apic 13935 51 kvm_emulate_insn 13924 51 kvm_mmio 13897 50 varl-kvm_eoi 3222 12 kvm_inj_virq 3222 12 kvm_apic_accept_irq 3222 12 kvm_pv_eoi 3184 12 kvm_fpu 376 2 kvm_cr 177 1 kvm_apic_ipi 278 1 kvm_msi_set_irq 295 0 kvm_pio 79 0 kvm_userspace_exit 52 0 kvm_set_irq 50 0 kvm_pic_set_irq 50 0 kvm_ioapic_set_irq 50 0 kvm_ack_irq 25 0 kvm_cpuid 90 0 kvm_msr 12 0
变量解释:
kvm_ack_irq
- 中断确认数量(PIC/IOAPIC)中断确认.kvm_age_page
- 内存管理单元(MMU)通知程序页时迭代的数量.kvm_apic
- APIC 寄存器数目。kvm_apic_accept_irq
- 本地 APIC 中可接受的中断数。kvm_apic_ipi
- 处理器中断的数量.kvm_async_pf_completed
- 异步页面错误完成次数.kvm_async_pf_doublefault
- 异步页面错误的数量停止.kvm_async_pf_not_present
- 异步页面错误初始化号.kvm_async_pf_ready
- 异步页面错误完成次数.kvm_cpuid
- 已执行的 CPUID 指令数。kvm_cr
- 陷阱和模拟控制寄存器(CR)访问(CR0、CR3、CR4、CR8)。kvm_emulate_insn
- 模拟指令的数量。kvm_entry
- 模拟指令的数量。kvm_eoi
- 中断(EOI)通知的可编程中断控制器(APIC)的数量.kvm_exit
-VM-exits
数 .kvm_exit(NAME)
- 特定于处理器的单一退出。如需更多信息,请参阅您的处理器文档。kvm_fpu
- KVM 浮点单元(FPU)的数量.kvm_hv_hypercall
- Hyper-V 超calls 数.kvm_hypercall
- 非Hyper-V 超calls 的数量.kvm_inj_exception
- 注入到 guest 中的异常数量.kvm_inj_virq
- 注入到客户机中的中断数。kvm_invlpga
- INVLPGA 指令的数量已截获。kvm_ioapic_set_irq
- 虚拟 IOAPIC 控制器的中断级别数变化。kvm_mmio
- 模拟内存映射的 I/O(MMIO)操作数量.kvm_msi_set_irq
- 消息信号中断(MSI)的数量。kvm_msr
- 特定型号寄存器(MSR)访问的数量.kvm_nested_intercepts
- L1 mvapich L2 嵌套 SVM 交换机的数量。kvm_nested_vmrun
- L1 nested L2 嵌套 SVM 交换机的数量。kvm_nested_intr_vmexit
- 由于中断窗口导致嵌套虚拟机退出注入的数量。kvm_nested_vmexit
- 在执行嵌套(L2)guest 时退出管理程序.kvm_nested_vmexit_inject
- L2 nested L1 嵌套交换机的数量。kvm_page_fault
- 管理程序处理的页面错误数量.kvm_pic_set_irq
- 对虚拟可编程中断控制器(PIC)的更改。kvm_pio
- 模拟程序 I/O(PIO)操作的数量。kvm_pv_eoi
- 输入的半虚拟化结束(EOI)事件的数量.kvm_set_irq
- 通用 IRQ 控制器级别的中断级别更改(counts PIC、IOAPIC 和 MSI)。kvm_skinit
- SVM SKINIT 的数量可退出。kvm_track_tsc
- 时间戳计数器(TSC)写入的数量。kvm_try_async_get_page
- 异步页面错误尝试次数.kvm_update_master_clock
- pvclock masterclock 更新的数量.kvm_userspace_exit
- 退出给用户空间的数量.kvm_write_tsc_offset
- TSC offset 写入数.vcpu_match_mmio
- SPTE 缓存内存映射的 I/O(MMIO)的数量。
kvm_stat 命令的输出信息由 KVM 管理程序导出,该文件位于
/sys/kernel/debug/tracing/events/kvm/
目录中。