Zhang, Yanmin | a1645ce | 2010-04-19 13:32:50 +0800 | [diff] [blame] | 1 | perf-kvm(1) |
William Cohen | cfadf9d | 2010-04-23 16:36:21 -0400 | [diff] [blame] | 2 | =========== |
Zhang, Yanmin | a1645ce | 2010-04-19 13:32:50 +0800 | [diff] [blame] | 3 | |
| 4 | NAME |
| 5 | ---- |
| 6 | perf-kvm - Tool to trace/measure kvm guest os |
| 7 | |
| 8 | SYNOPSIS |
| 9 | -------- |
| 10 | [verse] |
| 11 | 'perf kvm' [--host] [--guest] [--guestmount=<path> |
| 12 | [--guestkallsyms=<path> --guestmodules=<path> | --guestvmlinux=<path>]] |
Dongsheng Yang | 100b907 | 2013-12-09 12:15:11 -0500 | [diff] [blame] | 13 | {top|record|report|diff|buildid-list} [<options>] |
Zhang, Yanmin | a1645ce | 2010-04-19 13:32:50 +0800 | [diff] [blame] | 14 | 'perf kvm' [--host] [--guest] [--guestkallsyms=<path> --guestmodules=<path> |
Dongsheng Yang | 100b907 | 2013-12-09 12:15:11 -0500 | [diff] [blame] | 15 | | --guestvmlinux=<path>] {top|record|report|diff|buildid-list|stat} [<options>] |
David Ahern | 9a6d316 | 2013-08-07 21:56:39 -0400 | [diff] [blame] | 16 | 'perf kvm stat [record|report|live] [<options>] |
Zhang, Yanmin | a1645ce | 2010-04-19 13:32:50 +0800 | [diff] [blame] | 17 | |
| 18 | DESCRIPTION |
| 19 | ----------- |
| 20 | There 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 | |
Shawn Bohrer | 5c0ef0a | 2010-11-30 19:57:13 -0600 | [diff] [blame] | 26 | 'perf kvm record <command>' to record the performance counter profile |
Dongsheng Yang | 8df0b4a | 2013-12-04 17:56:41 -0500 | [diff] [blame] | 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 |
Zhang, Yanmin | a1645ce | 2010-04-19 13:32:50 +0800 | [diff] [blame] | 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 |
Dongsheng Yang | ed086d5 | 2013-12-04 17:56:42 -0500 | [diff] [blame] | 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. |
Zhang, Yanmin | a1645ce | 2010-04-19 13:32:50 +0800 | [diff] [blame] | 50 | |
Xiao Guangrong | bcf6edc | 2012-09-17 16:31:15 +0800 | [diff] [blame] | 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 |
Alexander Yarygin | 3be8e2a | 2014-07-03 18:29:07 +0400 | [diff] [blame] | 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>. |
Xiao Guangrong | bcf6edc | 2012-09-17 16:31:15 +0800 | [diff] [blame] | 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 | |
David Ahern | 9a6d316 | 2013-08-07 21:56:39 -0400 | [diff] [blame] | 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 | |
Zhang, Yanmin | a1645ce | 2010-04-19 13:32:50 +0800 | [diff] [blame] | 67 | OPTIONS |
| 68 | ------- |
Shawn Bohrer | 5c0ef0a | 2010-11-30 19:57:13 -0600 | [diff] [blame] | 69 | -i:: |
Dongsheng Yang | 316bd98 | 2013-12-04 17:56:43 -0500 | [diff] [blame] | 70 | --input=<path>:: |
Shawn Bohrer | 5c0ef0a | 2010-11-30 19:57:13 -0600 | [diff] [blame] | 71 | Input file name. |
| 72 | -o:: |
Dongsheng Yang | 316bd98 | 2013-12-04 17:56:43 -0500 | [diff] [blame] | 73 | --output=<path>:: |
Shawn Bohrer | 5c0ef0a | 2010-11-30 19:57:13 -0600 | [diff] [blame] | 74 | Output file name. |
Dongsheng Yang | 316bd98 | 2013-12-04 17:56:43 -0500 | [diff] [blame] | 75 | --host:: |
William Cohen | cfadf9d | 2010-04-23 16:36:21 -0400 | [diff] [blame] | 76 | Collect host side performance profile. |
Dongsheng Yang | 316bd98 | 2013-12-04 17:56:43 -0500 | [diff] [blame] | 77 | --guest:: |
William Cohen | cfadf9d | 2010-04-23 16:36:21 -0400 | [diff] [blame] | 78 | Collect guest side performance profile. |
Zhang, Yanmin | a1645ce | 2010-04-19 13:32:50 +0800 | [diff] [blame] | 79 | --guestmount=<path>:: |
| 80 | Guest os root file system mount directory. Users mounts guest os |
| 81 | root directories under <path> by a specific filesystem access method, |
| 82 | typically, sshfs. For example, start 2 guest os. The one's pid is 8888 |
| 83 | and the other's is 9999. |
| 84 | #mkdir ~/guestmount; cd ~/guestmount |
| 85 | #sshfs -o allow_other,direct_io -p 5551 localhost:/ 8888/ |
| 86 | #sshfs -o allow_other,direct_io -p 5552 localhost:/ 9999/ |
| 87 | #perf kvm --host --guest --guestmount=~/guestmount top |
| 88 | --guestkallsyms=<path>:: |
| 89 | Guest os /proc/kallsyms file copy. 'perf' kvm' reads it to get guest |
| 90 | kernel symbols. Users copy it out from guest os. |
| 91 | --guestmodules=<path>:: |
| 92 | Guest os /proc/modules file copy. 'perf' kvm' reads it to get guest |
| 93 | kernel module information. Users copy it out from guest os. |
| 94 | --guestvmlinux=<path>:: |
| 95 | Guest os kernel vmlinux. |
Dongsheng Yang | 100b907 | 2013-12-09 12:15:11 -0500 | [diff] [blame] | 96 | -v:: |
| 97 | --verbose:: |
| 98 | Be more verbose (show counter open errors, etc). |
Zhang, Yanmin | a1645ce | 2010-04-19 13:32:50 +0800 | [diff] [blame] | 99 | |
Xiao Guangrong | bcf6edc | 2012-09-17 16:31:15 +0800 | [diff] [blame] | 100 | STAT REPORT OPTIONS |
| 101 | ------------------- |
| 102 | --vcpu=<value>:: |
Masanari Iida | 96355f2 | 2014-09-10 00:18:50 +0900 | [diff] [blame] | 103 | analyze events which occur on this vcpu. (default: all vcpus) |
Xiao Guangrong | bcf6edc | 2012-09-17 16:31:15 +0800 | [diff] [blame] | 104 | |
David Ahern | 9a6d316 | 2013-08-07 21:56:39 -0400 | [diff] [blame] | 105 | --event=<value>:: |
Alexander Yarygin | 3be8e2a | 2014-07-03 18:29:07 +0400 | [diff] [blame] | 106 | event to be analyzed. Possible values: vmexit, mmio (x86 only), |
| 107 | ioport (x86 only). (default: vmexit) |
Xiao Guangrong | bcf6edc | 2012-09-17 16:31:15 +0800 | [diff] [blame] | 108 | -k:: |
| 109 | --key=<value>:: |
| 110 | Sorting key. Possible values: sample (default, sort by samples |
| 111 | number), time (sort by average time). |
David Ahern | 9a6d316 | 2013-08-07 21:56:39 -0400 | [diff] [blame] | 112 | -p:: |
| 113 | --pid=:: |
| 114 | Analyze events only for given process ID(s) (comma separated list). |
| 115 | |
| 116 | STAT LIVE OPTIONS |
| 117 | ----------------- |
| 118 | -d:: |
| 119 | --display:: |
| 120 | Time in seconds between display updates |
| 121 | |
| 122 | -m:: |
| 123 | --mmap-pages=:: |
Jiri Olsa | 27050f5 | 2013-09-01 12:36:13 +0200 | [diff] [blame] | 124 | Number of mmap data pages (must be a power of two) or size |
| 125 | specification with appended unit character - B/K/M/G. The |
| 126 | size is rounded up to have nearest pages power of two value. |
David Ahern | 9a6d316 | 2013-08-07 21:56:39 -0400 | [diff] [blame] | 127 | |
| 128 | -a:: |
| 129 | --all-cpus:: |
| 130 | System-wide collection from all CPUs. |
| 131 | |
| 132 | -p:: |
| 133 | --pid=:: |
| 134 | Analyze events only for given process ID(s) (comma separated list). |
| 135 | |
| 136 | --vcpu=<value>:: |
Masanari Iida | 96355f2 | 2014-09-10 00:18:50 +0900 | [diff] [blame] | 137 | analyze events which occur on this vcpu. (default: all vcpus) |
David Ahern | 9a6d316 | 2013-08-07 21:56:39 -0400 | [diff] [blame] | 138 | |
| 139 | |
| 140 | --event=<value>:: |
Alexander Yarygin | 3be8e2a | 2014-07-03 18:29:07 +0400 | [diff] [blame] | 141 | event to be analyzed. Possible values: vmexit, |
| 142 | mmio (x86 only), ioport (x86 only). |
David Ahern | 9a6d316 | 2013-08-07 21:56:39 -0400 | [diff] [blame] | 143 | (default: vmexit) |
| 144 | |
| 145 | -k:: |
| 146 | --key=<value>:: |
| 147 | Sorting key. Possible values: sample (default, sort by samples |
| 148 | number), time (sort by average time). |
| 149 | |
| 150 | --duration=<value>:: |
Alexander Yarygin | 3be8e2a | 2014-07-03 18:29:07 +0400 | [diff] [blame] | 151 | Show events other than HLT (x86 only) or Wait state (s390 only) |
| 152 | that take longer than duration usecs. |
Xiao Guangrong | bcf6edc | 2012-09-17 16:31:15 +0800 | [diff] [blame] | 153 | |
Kan Liang | 9d9cad7 | 2015-06-17 09:51:11 -0400 | [diff] [blame] | 154 | --proc-map-timeout:: |
| 155 | When processing pre-existing threads /proc/XXX/mmap, it may take |
| 156 | a long time, because the file may be huge. A time out is needed |
| 157 | in such cases. |
| 158 | This option sets the time out limit. The default value is 500 ms. |
| 159 | |
Zhang, Yanmin | a1645ce | 2010-04-19 13:32:50 +0800 | [diff] [blame] | 160 | SEE ALSO |
| 161 | -------- |
William Cohen | cfadf9d | 2010-04-23 16:36:21 -0400 | [diff] [blame] | 162 | linkperf:perf-top[1], linkperf:perf-record[1], linkperf:perf-report[1], |
Xiao Guangrong | bcf6edc | 2012-09-17 16:31:15 +0800 | [diff] [blame] | 163 | linkperf:perf-diff[1], linkperf:perf-buildid-list[1], |
| 164 | linkperf:perf-stat[1] |