perf 试用
1 [root@zone3-pc124 bin]# ./perf kvm stat report 2 3 4 Analyze events for all VMs, all VCPUs: 5 6 VM-EXIT Samples Samples% Time% Min Time Max Time Avg time 7 8 IO_INSTRUCTION 6543 48.47% 0.90% 10.36us 1032.97us 26.82us ( +- 0.85% ) 9 EXCEPTION_NMI 1655 12.26% 0.06% 4.00us 23.59us 6.59us ( +- 0.42% ) 10 APIC_ACCESS 1357 10.05% 0.04% 2.51us 26.12us 5.16us ( +- 1.13% ) 11 HLT 1269 9.40% 98.94% 2.58us 15962.56us 15250.94us ( +- 0.26% ) 12 PREEMPTION_TIMER 1269 9.40% 0.01% 1.80us 37.28us 2.18us ( +- 1.39% ) 13 EPT_VIOLATION 903 6.69% 0.05% 5.12us 62.97us 10.69us ( +- 2.22% ) 14 EXTERNAL_INTERRUPT 482 3.57% 0.01% 1.55us 41.16us 3.92us ( +- 4.03% ) 15 TPR_BELOW_THRESHOLD 17 0.13% 0.00% 3.32us 20.05us 4.69us ( +- 20.51% ) 16 PENDING_INTERRUPT 5 0.04% 0.00% 2.88us 3.76us 3.32us ( +- 5.27% ) 17 18 Total Samples:13500, Total events handled time:19561281.10us. 19 20 [root@zone3-pc124 bin]# ./perf kvm stat report --event=ioport 21 22 23 Analyze events for all VMs, all VCPUs: 24 25 IO Port Access Samples Samples% Time% Min Time Max Time Avg time 26 27 0x608:PIN 2604 39.80% 18.07% 3.94us 25.59us 4.33us ( +- 0.43% ) 28 0x71:PIN 2560 39.13% 18.83% 4.10us 26.57us 4.59us ( +- 0.35% ) 29 0x70:POUT 1280 19.56% 62.05% 12.81us 1031.02us 30.25us ( +- 3.13% ) 30 0xc042:PIN 20 0.31% 0.14% 4.18us 4.47us 4.30us ( +- 0.41% ) 31 0xc050:PIN 20 0.31% 0.13% 4.04us 4.25us 4.14us ( +- 0.39% ) 32 0xc052:PIN 20 0.31% 0.13% 3.90us 4.18us 4.06us ( +- 0.41% ) 33 0x600:POUT 9 0.14% 0.40% 25.40us 30.48us 27.88us ( +- 2.73% ) 34 0x600:PIN 9 0.14% 0.07% 4.21us 4.88us 4.62us ( +- 1.72% ) 35 0xafe0:PIN 9 0.14% 0.06% 4.09us 4.55us 4.31us ( +- 1.27% ) 36 0xafe1:PIN 9 0.14% 0.06% 3.97us 4.21us 4.09us ( +- 0.64% ) 37 0xc0b0:POUT 2 0.03% 0.04% 9.94us 12.84us 11.39us ( +- 12.72% ) 38 0xc010:POUT 1 0.02% 0.01% 8.02us 8.02us 8.02us ( +- 0.00% ) 39 40 Total Samples:6543, Total events handled time:62395.31us. 41 42 [root@zone3-pc124 bin]# virsh qemu-monitor-command vm-123457 --hmp "info mtree" 43 memory 44 0000000000000000-7ffffffffffffffe (prio 0, RW): system 45 0000000000000000-000000007fffffff (prio 0, RW): alias ram-below-4g @pc.ram 0000000000000000-000000007fffffff 46 00000000000a0000-00000000000bffff (prio 1, RW): alias smram-region @pci 00000000000a0000-00000000000bffff 47 00000000000c0000-00000000000c3fff (prio 1, R-): alias pam-rom @pc.ram 00000000000c0000-00000000000c3fff 48 00000000000c4000-00000000000c7fff (prio 1, R-): alias pam-rom @pc.ram 00000000000c4000-00000000000c7fff 49 00000000000c8000-00000000000cbfff (prio 1, R-): alias pam-rom @pc.ram 00000000000c8000-00000000000cbfff 50 00000000000cb000-00000000000cdfff (prio 1000, RW): alias kvmvapic-rom @pc.ram 00000000000cb000-00000000000cdfff 51 00000000000cc000-00000000000cffff (prio 1, R-): alias pam-rom @pc.ram 00000000000cc000-00000000000cffff 52 00000000000d0000-00000000000d3fff (prio 1, R-): alias pam-rom @pc.ram 00000000000d0000-00000000000d3fff 53 00000000000d4000-00000000000d7fff (prio 1, R-): alias pam-rom @pc.ram 00000000000d4000-00000000000d7fff 54 00000000000d8000-00000000000dbfff (prio 1, R-): alias pam-rom @pc.ram 00000000000d8000-00000000000dbfff 55 00000000000dc000-00000000000dffff (prio 1, R-): alias pam-rom @pc.ram 00000000000dc000-00000000000dffff 56 00000000000e0000-00000000000e3fff (prio 1, R-): alias pam-rom @pc.ram 00000000000e0000-00000000000e3fff 57 00000000000e4000-00000000000e7fff (prio 1, R-): alias pam-rom @pc.ram 00000000000e4000-00000000000e7fff 58 00000000000e8000-00000000000ebfff (prio 1, RW): alias pam-ram @pc.ram 00000000000e8000-00000000000ebfff 59 00000000000ec000-00000000000effff (prio 1, RW): alias pam-ram @pc.ram 00000000000ec000-00000000000effff 60 00000000000f0000-00000000000fffff (prio 1, R-): alias pam-rom @pc.ram 00000000000f0000-00000000000fffff 61 0000000080000000-00000000ffffffff (prio 0, RW): alias pci-hole @pci 0000000080000000-00000000ffffffff 62 00000000fec00000-00000000fec00fff (prio 0, RW): kvm-ioapic 63 00000000fee00000-00000000feefffff (prio 4096, RW): icc-apic-container 64 00000000fee00000-00000000feefffff (prio 0, RW): kvm-apic-msi 65 0000000100000000-40000000ffffffff (prio 0, RW): alias pci-hole64 @pci 0000000100000000-40000000ffffffff 66 I/O 67 0000000000000000-000000000000ffff (prio 0, RW): io 68 0000000000000000-0000000000000007 (prio 0, RW): dma-chan 69 0000000000000008-000000000000000f (prio 0, RW): dma-cont 70 0000000000000020-0000000000000021 (prio 0, RW): kvm-pic 71 0000000000000040-0000000000000043 (prio 0, RW): kvm-pit 72 0000000000000060-0000000000000060 (prio 0, RW): i8042-data 73 0000000000000061-0000000000000061 (prio 0, RW): elcr 74 0000000000000064-0000000000000064 (prio 0, RW): i8042-cmd 75 0000000000000070-0000000000000071 (prio 0, RW): rtc 76 000000000000007e-000000000000007f (prio 0, RW): kvmvapic 77 0000000000000080-0000000000000080 (prio 0, RW): ioport80 78 0000000000000081-0000000000000083 (prio 0, RW): alias dma-page @dma-page 0000000000000081-0000000000000083 79 0000000000000087-0000000000000087 (prio 0, RW): alias dma-page @dma-page 0000000000000087-0000000000000087 80 0000000000000089-000000000000008b (prio 0, RW): alias dma-page @dma-page 0000000000000089-000000000000008b 81 000000000000008f-000000000000008f (prio 0, RW): alias dma-page @dma-page 000000000000008f-000000000000008f 82 0000000000000092-0000000000000092 (prio 0, RW): port92 83 00000000000000a0-00000000000000a1 (prio 0, RW): kvm-pic 84 00000000000000b2-00000000000000b3 (prio 0, RW): apm-io 85 00000000000000c0-00000000000000cf (prio 0, RW): dma-chan 86 00000000000000d0-00000000000000df (prio 0, RW): dma-cont 87 00000000000000f0-00000000000000f0 (prio 0, RW): ioportF0 88 0000000000000170-0000000000000177 (prio 0, RW): alias ide @ide 0000000000000170-0000000000000177 89 00000000000001ce-00000000000001d0 (prio 0, RW): alias vbe @vbe 00000000000001ce-00000000000001d0 90 00000000000001f0-00000000000001f7 (prio 0, RW): alias ide @ide 00000000000001f0-00000000000001f7 91 0000000000000376-0000000000000376 (prio 0, RW): alias ide @ide 0000000000000376-0000000000000376 92 00000000000003b4-00000000000003b5 (prio 0, RW): alias vga @vga 00000000000003b4-00000000000003b5 93 00000000000003ba-00000000000003ba (prio 0, RW): alias vga @vga 00000000000003ba-00000000000003ba 94 00000000000003c0-00000000000003cf (prio 0, RW): alias vga @vga 00000000000003c0-00000000000003cf 95 00000000000003d4-00000000000003d5 (prio 0, RW): alias vga @vga 00000000000003d4-00000000000003d5 96 00000000000003da-00000000000003da (prio 0, RW): alias vga @vga 00000000000003da-00000000000003da 97 00000000000003f1-00000000000003f5 (prio 0, RW): alias fdc @fdc 00000000000003f1-00000000000003f5 98 00000000000003f6-00000000000003f6 (prio 0, RW): alias ide @ide 00000000000003f6-00000000000003f6 99 00000000000003f7-00000000000003f7 (prio 0, RW): alias fdc @fdc 00000000000003f7-00000000000003f7 100 00000000000003f8-00000000000003ff (prio 0, RW): serial 101 00000000000004d0-00000000000004d0 (prio 0, RW): kvm-elcr 102 00000000000004d1-00000000000004d1 (prio 0, RW): kvm-elcr 103 0000000000000510-0000000000000511 (prio 0, RW): fwcfg 104 0000000000000600-000000000000063f (prio 0, RW): piix4-pm 105 0000000000000600-0000000000000603 (prio 0, RW): acpi-evt 106 0000000000000604-0000000000000605 (prio 0, RW): acpi-cnt 107 0000000000000608-000000000000060b (prio 0, RW): acpi-tmr 108 0000000000000700-000000000000073f (prio 0, RW): pm-smbus 109 0000000000000cf8-0000000000000cfb (prio 0, RW): pci-conf-idx 110 0000000000000cf9-0000000000000cf9 (prio 1, RW): piix3-reset-control 111 0000000000000cfc-0000000000000cff (prio 0, RW): pci-conf-data 112 0000000000005658-0000000000005658 (prio 0, RW): vmport 113 000000000000ae00-000000000000ae0e (prio 0, RW): apci-pci-hotplug 114 000000000000af00-000000000000af1f (prio 0, RW): apci-cpu-hotplug 115 000000000000afe0-000000000000afe3 (prio 0, RW): apci-gpe0 116 000000000000c000-000000000000c03f (prio 1, RW): virtio-pci 117 000000000000c040-000000000000c05f (prio 1, RW): uhci 118 000000000000c060-000000000000c07f (prio 1, RW): qxl-ioports 119 000000000000c080-000000000000c09f (prio 1, RW): virtio-pci 120 000000000000c0a0-000000000000c0bf (prio 1, RW): virtio-pci 121 000000000000c0c0-000000000000c0df (prio 1, RW): virtio-pci 122 000000000000c0e0-000000000000c0ff (prio 1, RW): virtio-pci 123 000000000000c100-000000000000c10f (prio 1, RW): piix-bmdma-container 124 000000000000c100-000000000000c103 (prio 0, RW): piix-bmdma 125 000000000000c104-000000000000c107 (prio 0, RW): bmdma 126 000000000000c108-000000000000c10b (prio 0, RW): piix-bmdma 127 000000000000c10c-000000000000c10f (prio 0, RW): bmdma 128 aliases 129 pc.ram 130 0000000000000000-000000007fffffff (prio 0, RW): pc.ram 131 pci 132 0000000000000000-7ffffffffffffffe (prio 0, RW): pci 133 00000000000a0000-00000000000affff (prio 2, RW): alias vga.chain4 @vga.vram 0000000000000000-000000000000ffff 134 00000000000a0000-00000000000bffff (prio 1, RW): vga-lowmem 135 00000000000c0000-00000000000dffff (prio 1, RW): pc.rom 136 00000000000e0000-00000000000fffff (prio 1, R-): alias isa-bios @pc.bios 0000000000020000-000000000003ffff 137 00000000f4000000-00000000f7ffffff (prio 1, RW): vga.vram 138 00000000f8000000-00000000fbffffff (prio 1, RW): alias qxl.vram32 @qxl.vram 0000000000000000-0000000003ffffff 139 00000000fc090000-00000000fc091fff (prio 1, RW): qxl.vrom 140 00000000fc092000-00000000fc092fff (prio 1, RW): virtio-net-pci-msix 141 00000000fc092000-00000000fc09202f (prio 0, RW): msix-table 142 00000000fc092800-00000000fc092807 (prio 0, RW): msix-pba 143 00000000fc093000-00000000fc093fff (prio 1, RW): virtio-net-pci-msix 144 00000000fc093000-00000000fc09302f (prio 0, RW): msix-table 145 00000000fc093800-00000000fc093807 (prio 0, RW): msix-pba 146 00000000fc094000-00000000fc094fff (prio 1, RW): virtio-blk-pci-msix 147 00000000fc094000-00000000fc09401f (prio 0, RW): msix-table 148 00000000fc094800-00000000fc094807 (prio 0, RW): msix-pba 149 00000000fc095000-00000000fc095fff (prio 1, RW): virtio-serial-pci-msix 150 00000000fc095000-00000000fc09501f (prio 0, RW): msix-table 151 00000000fc095800-00000000fc095807 (prio 0, RW): msix-pba 152 00000000fffc0000-00000000ffffffff (prio 0, R-): pc.bios 153 dma-page 154 0000000000000000-7ffffffffffffffe (prio 0, RW): dma-page 155 dma-page 156 0000000000000000-7ffffffffffffffe (prio 0, RW): dma-page 157 dma-page 158 0000000000000000-7ffffffffffffffe (prio 0, RW): dma-page 159 dma-page 160 0000000000000000-7ffffffffffffffe (prio 0, RW): dma-page 161 ide 162 0000000000000000-7ffffffffffffffe (prio 0, RW): ide 163 vbe 164 0000000000000000-7ffffffffffffffe (prio 0, RW): vbe 165 ide 166 0000000000000000-7ffffffffffffffe (prio 0, RW): ide 167 ide 168 0000000000000000-7ffffffffffffffe (prio 0, RW): ide 169 vga 170 0000000000000000-7ffffffffffffffe (prio 0, RW): vga 171 vga 172 0000000000000000-7ffffffffffffffe (prio 0, RW): vga 173 vga 174 0000000000000000-7ffffffffffffffe (prio 0, RW): vga 175 vga 176 0000000000000000-7ffffffffffffffe (prio 0, RW): vga 177 vga 178 0000000000000000-7ffffffffffffffe (prio 0, RW): vga 179 fdc 180 0000000000000000-7ffffffffffffffe (prio 0, RW): fdc 181 ide 182 0000000000000000-7ffffffffffffffe (prio 0, RW): ide 183 fdc 184 0000000000000000-7ffffffffffffffe (prio 0, RW): fdc 185 vga.vram 186 00000000f4000000-00000000f7ffffff (prio 1, RW): vga.vram 187 pc.bios 188 00000000fffc0000-00000000ffffffff (prio 0, R-): pc.bios 189 qxl.vram 190 0000000000000000-0000000003ffffff (prio 0, RW): qxl.vram
1 https://cloud.tencent.com/developer/article/1400629 2 https://www.linux-kvm.org/images/a/ac/02x03-Davit_Matalack-KVM_Message_passing_Performance.pdf 3 https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/virtualization_tuning_and_optimization_guide/sect-virtualization_tuning_optimization_guide-monitoring_tools-perf_kvm 4 5 perf kvm stat record -a sleep 20