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