diff options
author | Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> | 2012-09-17 04:31:15 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-09-21 11:51:22 -0400 |
commit | bcf6edcd6fdb8965290f0b635a530fa3c6c212e1 (patch) | |
tree | f07af361e02f82408bdad2122d93b739b4470484 /tools/perf/Documentation/perf-kvm.txt | |
parent | 26bf264e871a4b9a8ac09c21a2b518e7f23830d5 (diff) |
perf kvm: Events analysis tool
Add 'perf kvm stat' support to analyze kvm vmexit/mmio/ioport smartly
Usage:
- kvm stat
run a command and gather performance counter statistics, it is the alias of
perf stat
- trace kvm events:
perf kvm stat record, or, if other tracepoints are interesting as well, we
can append the events like this:
perf kvm stat record -e timer:* -a
If many guests are running, we can track the specified guest by using -p or
--pid, -a is used to track events generated by all guests.
- show the result:
perf kvm stat report
The output example is following:
13005
13059
total 2 guests are running on the host
Then, track the guest whose pid is 13059:
^C[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.253 MB perf.data.guest (~11065 samples) ]
See the vmexit events:
Analyze events for all VCPUs:
VM-EXIT Samples Samples% Time% Avg time
APIC_ACCESS 460 70.55% 0.01% 22.44us ( +- 1.75% )
HLT 93 14.26% 99.98% 832077.26us ( +- 10.42% )
EXTERNAL_INTERRUPT 64 9.82% 0.00% 35.35us ( +- 14.21% )
PENDING_INTERRUPT 24 3.68% 0.00% 9.29us ( +- 31.39% )
CR_ACCESS 7 1.07% 0.00% 8.12us ( +- 5.76% )
IO_INSTRUCTION 3 0.46% 0.00% 18.00us ( +- 11.79% )
EXCEPTION_NMI 1 0.15% 0.00% 5.83us ( +- -nan% )
Total Samples:652, Total events handled time:77396109.80us.
See the mmio events:
Analyze events for all VCPUs:
MMIO Access Samples Samples% Time% Avg time
0xfee00380:W 387 84.31% 79.28% 8.29us ( +- 3.32% )
0xfee00300:W 24 5.23% 9.96% 16.79us ( +- 1.97% )
0xfee00300:R 24 5.23% 7.83% 13.20us ( +- 3.00% )
0xfee00310:W 24 5.23% 2.93% 4.94us ( +- 3.84% )
Total Samples:459, Total events handled time:4044.59us.
See the ioport event:
Analyze events for all VCPUs:
IO Port Access Samples Samples% Time% Avg time
0xc050:POUT 3 100.00% 100.00% 13.75us ( +- 10.83% )
Total Samples:3, Total events handled time:41.26us.
And, --vcpu is used to track the specified vcpu and --key is used to sort the
result:
Analyze events for VCPU 0:
VM-EXIT Samples Samples% Time% Avg time
HLT 27 13.85% 99.97% 405790.24us ( +- 12.70% )
EXTERNAL_INTERRUPT 13 6.67% 0.00% 27.94us ( +- 22.26% )
APIC_ACCESS 146 74.87% 0.03% 21.69us ( +- 2.91% )
IO_INSTRUCTION 2 1.03% 0.00% 17.77us ( +- 20.56% )
CR_ACCESS 2 1.03% 0.00% 8.55us ( +- 6.47% )
PENDING_INTERRUPT 5 2.56% 0.00% 6.27us ( +- 3.94% )
Total Samples:195, Total events handled time:10959950.90us.
Signed-off-by: Dong Hao <haodong@linux.vnet.ibm.com>
Signed-off-by: Runzhen Wang <runzhen@linux.vnet.ibm.com>
[ Dong Hao <haodong@linux.vnet.ibm.com>
Runzhen Wang <runzhen@linux.vnet.ibm.com>:
- rebase it on current acme's tree
- fix the compiling-error on i386 ]
Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Acked-by: David Ahern <dsahern@gmail.com>
Cc: Avi Kivity <avi@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org
Cc: Runzhen Wang <runzhen@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/1347870675-31495-4-git-send-email-haodong@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/Documentation/perf-kvm.txt')
-rw-r--r-- | tools/perf/Documentation/perf-kvm.txt | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/tools/perf/Documentation/perf-kvm.txt b/tools/perf/Documentation/perf-kvm.txt index dd84cb2f0a88..326f2cb333cb 100644 --- a/tools/perf/Documentation/perf-kvm.txt +++ b/tools/perf/Documentation/perf-kvm.txt | |||
@@ -12,7 +12,7 @@ SYNOPSIS | |||
12 | [--guestkallsyms=<path> --guestmodules=<path> | --guestvmlinux=<path>]] | 12 | [--guestkallsyms=<path> --guestmodules=<path> | --guestvmlinux=<path>]] |
13 | {top|record|report|diff|buildid-list} | 13 | {top|record|report|diff|buildid-list} |
14 | 'perf kvm' [--host] [--guest] [--guestkallsyms=<path> --guestmodules=<path> | 14 | 'perf kvm' [--host] [--guest] [--guestkallsyms=<path> --guestmodules=<path> |
15 | | --guestvmlinux=<path>] {top|record|report|diff|buildid-list} | 15 | | --guestvmlinux=<path>] {top|record|report|diff|buildid-list|stat} |
16 | 16 | ||
17 | DESCRIPTION | 17 | DESCRIPTION |
18 | ----------- | 18 | ----------- |
@@ -38,6 +38,18 @@ There are a couple of variants of perf kvm: | |||
38 | so that other tools can be used to fetch packages with matching symbol tables | 38 | so that other tools can be used to fetch packages with matching symbol tables |
39 | for use by perf report. | 39 | for use by perf report. |
40 | 40 | ||
41 | 'perf kvm stat <command>' to run a command and gather performance counter | ||
42 | statistics. | ||
43 | Especially, perf 'kvm stat record/report' generates a statistical analysis | ||
44 | of KVM events. Currently, vmexit, mmio and ioport events are supported. | ||
45 | 'perf kvm stat record <command>' records kvm events and the events between | ||
46 | start and end <command>. | ||
47 | And this command produces a file which contains tracing results of kvm | ||
48 | events. | ||
49 | |||
50 | 'perf kvm stat report' reports statistical data which includes events | ||
51 | handled time, samples, and so on. | ||
52 | |||
41 | OPTIONS | 53 | OPTIONS |
42 | ------- | 54 | ------- |
43 | -i:: | 55 | -i:: |
@@ -68,7 +80,21 @@ OPTIONS | |||
68 | --guestvmlinux=<path>:: | 80 | --guestvmlinux=<path>:: |
69 | Guest os kernel vmlinux. | 81 | Guest os kernel vmlinux. |
70 | 82 | ||
83 | STAT REPORT OPTIONS | ||
84 | ------------------- | ||
85 | --vcpu=<value>:: | ||
86 | analyze events which occures on this vcpu. (default: all vcpus) | ||
87 | |||
88 | --events=<value>:: | ||
89 | events to be analyzed. Possible values: vmexit, mmio, ioport. | ||
90 | (default: vmexit) | ||
91 | -k:: | ||
92 | --key=<value>:: | ||
93 | Sorting key. Possible values: sample (default, sort by samples | ||
94 | number), time (sort by average time). | ||
95 | |||
71 | SEE ALSO | 96 | SEE ALSO |
72 | -------- | 97 | -------- |
73 | linkperf:perf-top[1], linkperf:perf-record[1], linkperf:perf-report[1], | 98 | linkperf:perf-top[1], linkperf:perf-record[1], linkperf:perf-report[1], |
74 | linkperf:perf-diff[1], linkperf:perf-buildid-list[1] | 99 | linkperf:perf-diff[1], linkperf:perf-buildid-list[1], |
100 | linkperf:perf-stat[1] | ||