^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) perf-kvm(1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) ===========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) ----
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) perf-kvm - Tool to trace/measure kvm guest os
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) SYNOPSIS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) --------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) [verse]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 'perf kvm' [--host] [--guest] [--guestmount=<path>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) [--guestkallsyms=<path> --guestmodules=<path> | --guestvmlinux=<path>]]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) {top|record|report|diff|buildid-list} [<options>]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 'perf kvm' [--host] [--guest] [--guestkallsyms=<path> --guestmodules=<path>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) | --guestvmlinux=<path>] {top|record|report|diff|buildid-list|stat} [<options>]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 'perf kvm stat [record|report|live] [<options>]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) DESCRIPTION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) -----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) There are a couple of variants of perf kvm:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 'perf kvm [options] top <command>' to generates and displays
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) a performance counter profile of guest os in realtime
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) of an arbitrary workload.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 'perf kvm record <command>' to record the performance counter profile
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) of an arbitrary workload and save it into a perf data file. We set the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) default behavior of perf kvm as --guest, so if neither --host nor --guest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) is input, the perf data file name is perf.data.guest. If --host is input,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) the perf data file name is perf.data.kvm. If you want to record data into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) perf.data.host, please input --host --no-guest. The behaviors are shown as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) following:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) Default('') -> perf.data.guest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) --host -> perf.data.kvm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) --guest -> perf.data.guest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) --host --guest -> perf.data.kvm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) --host --no-guest -> perf.data.host
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 'perf kvm report' to display the performance counter profile information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) recorded via perf kvm record.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 'perf kvm diff' to displays the performance difference amongst two perf.data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) files captured via perf record.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 'perf kvm buildid-list' to display the buildids found in a perf data file,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) so that other tools can be used to fetch packages with matching symbol tables
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) for use by perf report. As buildid is read from /sys/kernel/notes in os, then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) if you want to list the buildid for guest, please make sure your perf data file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) was captured with --guestmount in perf kvm record.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 'perf kvm stat <command>' to run a command and gather performance counter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) statistics.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) Especially, perf 'kvm stat record/report' generates a statistical analysis
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) of KVM events. Currently, vmexit, mmio (x86 only) and ioport (x86 only)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) events are supported. 'perf kvm stat record <command>' records kvm events
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) and the events between start and end <command>.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) And this command produces a file which contains tracing results of kvm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) events.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 'perf kvm stat report' reports statistical data which includes events
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) handled time, samples, and so on.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 'perf kvm stat live' reports statistical data in a live mode (similar to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) record + report but with statistical data updated live at a given display
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) rate).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) OPTIONS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) -------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) -i::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) --input=<path>::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) Input file name, for the 'report', 'diff' and 'buildid-list' subcommands.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) -o::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) --output=<path>::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) Output file name, for the 'record' subcommand. Doesn't work with 'report',
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) just redirect the output to a file when using 'report'.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) --host::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) Collect host side performance profile.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) --guest::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) Collect guest side performance profile.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) --guestmount=<path>::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) Guest os root file system mount directory. Users mounts guest os
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) root directories under <path> by a specific filesystem access method,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) typically, sshfs. For example, start 2 guest os. The one's pid is 8888
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) and the other's is 9999.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) #mkdir ~/guestmount; cd ~/guestmount
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) #sshfs -o allow_other,direct_io -p 5551 localhost:/ 8888/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) #sshfs -o allow_other,direct_io -p 5552 localhost:/ 9999/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) #perf kvm --host --guest --guestmount=~/guestmount top
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) --guestkallsyms=<path>::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) Guest os /proc/kallsyms file copy. 'perf' kvm' reads it to get guest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) kernel symbols. Users copy it out from guest os.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) --guestmodules=<path>::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) Guest os /proc/modules file copy. 'perf' kvm' reads it to get guest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) kernel module information. Users copy it out from guest os.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) --guestvmlinux=<path>::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) Guest os kernel vmlinux.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) -v::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) --verbose::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) Be more verbose (show counter open errors, etc).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) STAT REPORT OPTIONS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) -------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) --vcpu=<value>::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) analyze events which occur on this vcpu. (default: all vcpus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) --event=<value>::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) event to be analyzed. Possible values: vmexit, mmio (x86 only),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) ioport (x86 only). (default: vmexit)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) -k::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) --key=<value>::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) Sorting key. Possible values: sample (default, sort by samples
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) number), time (sort by average time).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) -p::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) --pid=::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) Analyze events only for given process ID(s) (comma separated list).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) STAT LIVE OPTIONS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) -----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) -d::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) --display::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) Time in seconds between display updates
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) -m::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) --mmap-pages=::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) Number of mmap data pages (must be a power of two) or size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) specification with appended unit character - B/K/M/G. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) size is rounded up to have nearest pages power of two value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) -a::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) --all-cpus::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) System-wide collection from all CPUs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) -p::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) --pid=::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) Analyze events only for given process ID(s) (comma separated list).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) --vcpu=<value>::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) analyze events which occur on this vcpu. (default: all vcpus)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) --event=<value>::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) event to be analyzed. Possible values: vmexit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) mmio (x86 only), ioport (x86 only).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) (default: vmexit)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) -k::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) --key=<value>::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) Sorting key. Possible values: sample (default, sort by samples
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) number), time (sort by average time).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) --duration=<value>::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) Show events other than HLT (x86 only) or Wait state (s390 only)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) that take longer than duration usecs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) --proc-map-timeout::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) When processing pre-existing threads /proc/XXX/mmap, it may take
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) a long time, because the file may be huge. A time out is needed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) in such cases.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) This option sets the time out limit. The default value is 500 ms.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) SEE ALSO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) --------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) linkperf:perf-top[1], linkperf:perf-record[1], linkperf:perf-report[1],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) linkperf:perf-diff[1], linkperf:perf-buildid-list[1],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) linkperf:perf-stat[1]