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