PERF-KVM(1)
π
PERF-KVM(1) β the perf manual, kvm edition π
okay bestie, sit down, grab a boba, because we're diving into perf-kvm, aka the tool to trace/measure kvm guest os. yes that's the whole NAME section, she's short but she's iconic β¨
πΈ SYNOPSIS πΈ
like, here's the vibe of how you actually call her:
perf kvm [--host] [--guest] [--guestmount=<path>
[--guestkallsyms=<path> --guestmodules=<path> | --guestvmlinux=<path>]]
{top|record|report|diff|buildid-list} [<options>]
perf kvm [--host] [--guest] [--guestkallsyms=<path> --guestmodules=<path>
| --guestvmlinux=<path>] {top|record|report|diff|buildid-list|stat} [<options>]
'perf kvm stat [record|report|live] [<options>]
periodt, those are the three shapes she comes in π«Ά
π DESCRIPTION π
so there are, like, a couple of variants of perf kvm, and each one is doing her own main character thing:
'perf kvm [options] top <command>'β generates and displays a performance counter profile of guest os in realtime, of an arbitrary workload. live numbers, live vibes π₯'perf kvm record <command>'β records the performance counter profile of an arbitrary workload and saves it into a perf data file. and here's the tea: we set the default behavior ofperf kvmas--guest, so if neither--hostnor--guestis input, the perf data file name isperf.data.guest. if--hostis input, the perf data file name isperf.data.kvm. and if you want to record data intoperf.data.host, please input--host --no-guest. the behaviors are shown as following, no cap:
Default('') -> perf.data.guest
--host -> perf.data.kvm
--guest -> perf.data.guest
--host --guest -> perf.data.kvm
--host --no-guest -> perf.data.host
'perf kvm report'β to display the performance counter profile information recorded viaperf kvm record. it's giving "read back what you wrote" π'perf kvm diff'β to displays the performance difference amongst two perf.data files captured viaperf record. comparison era π¦'perf kvm buildid-list'β to display the buildids found in a perf data file, so that other tools can be used to fetch packages with matching symbol tables for use byperf report. literally so useful. BUT β as buildid is read from/sys/kernel/notesin os, then if you want to list the buildid for guest, please make sure your perf data file was captured with--guestmountinperf kvm record. don't skip this step bestie π'perf kvm stat <command>'β to run a command and gather performance counter statistics. especially,perf 'kvm stat record/report'generates a statistical analysis of KVM events. currently,vmexit,mmio(x86 only) andioport(x86 only) events are supported.'perf kvm stat record <command>'records kvm events and the events between start and end<command>. and this command produces a file which contains tracing results of kvm events π'perf kvm stat report'reports statistical data which includes events handled sample,percent_sample,time,percent_time,max_t,min_t,mean_t.'perf kvm stat live'reports statistical data in a live mode (similar to record + report but with statistical data updated live at a given display rate). live updating stats?? we love to see it β¨
π OPTIONS π
-i,--input=<path>β Input file name, for thereport,diffandbuildid-listsubcommands.-o,--output=<path>β Output file name, for therecordsubcommand. Doesnβt work withreport, just redirect the output to a file when usingreport. (yes that's the workaround, she said what she said π )--hostβ Collect host side performance profile.--guestβ Collect guest side performance profile.--guestmount=<path>β Guest OS root file system mount directory. Users mount guest OS root directories under<path>by a specific filesystem access method, typically,sshfs. for example, start 2 guest OS, oneβs pid is8888and the otherβs is9999:
$ mkdir ~/guestmount
$ cd ~/guestmount
$ sshfs -o allow_other,direct_io -p 5551 localhost:/ 8888/
$ sshfs -o allow_other,direct_io -p 5552 localhost:/ 9999/
$ perf kvm --host --guest --guestmount=~/guestmount top
--guestkallsyms=<path>β Guest OS/proc/kallsymsfile copy.perfreads it to get guest kernel symbols. Users copy it out from guest OS.--guestmodules=<path>β Guest OS/proc/modulesfile copy.perfreads it to get guest kernel module information. Users copy it out from guest OS.--guestvmlinux=<path>β Guest OS kernelvmlinux.--guest-codeβ Indicate that guest code can be found in the hypervisor process, which is a common case for KVM test programs.--stdioβ Use the stdio interface.-v,--verboseβ Be more verbose (show counter open errors, etc).
π STAT REPORT OPTIONS π
--vcpu=<value>β analyze events which occur on this vcpu. (default: all vcpus)--event=<value>β event to be analyzed. Possible values:vmexit,mmio(x86 only),ioport(x86 only). (default:vmexit)-k,--key=<value>β Sorting key. Possible values:sample(default, sort by samples number),percent_sample(sort by sample percentage),time(sort by average time),precent_time(sort by time percentage),max_t(sort by maximum time),min_t(sort by minimum time),mean_t(sort by mean time). (and yes,precent_timeis spelled exactly like that in the original β keep it, she's quirky like that π)-p,--pid=β Analyze events only for given process ID(s) (comma separated list).
π¦ STAT LIVE OPTIONS π¦
-d,--displayβ Time in seconds between display updates-m,--mmap-pages=β Number of mmap data pages (must be a power of two) or size specification in bytes with appended unit character -B/K/M/G. the size is rounded up to the nearest power-of-two page value.-a,--all-cpusβ System-wide collection from all CPUs.-p,--pid=β Analyze events only for given process ID(s) (comma separated list).--vcpu=<value>β analyze events which occur on this vcpu. (default: all vcpus)--event=<value>β event to be analyzed. Possible values:vmexit,mmio(x86 only),ioport(x86 only). (default:vmexit)-k,--key=<value>β Sorting key. Possible values:sample(default, sort by samples number),time(sort by average time). (heads up β live mode's key list is shorter than report mode's, that's not a typo, that's just how she is π§)--duration=<value>β Show events other than HLT (x86 only) or Wait state (s390 only) that take longer than duration usecs.--proc-map-timeoutβ When processing pre-existing threads/proc/XXX/mmap, it may take a long time, because the file may be huge. a time out is needed in such cases. this option sets the time out limit. the default value is500 ms. literally the "bestie please don't hang forever" option π«Ά
β SEE ALSO β
perf-top(1), perf-record(1), perf-report(1), perf-diff(1), perf-buildid-list(1), perf-stat(1)
go read those next, iykyk π
and that's the whole page, bestie β mwah π this iconic little number comes from perf, dated 10/31/2026, and it's filed under PERF-KVM(1). go forth and trace your guests πβ¨
π¦ where this page comes from
- arch rolling: perf 7.3.1-1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms