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