diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2017-05-26 04:17:16 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-06-21 10:35:51 -0400 |
commit | 0a7c700d23450bd4467855d5162920d5edf314b0 (patch) | |
tree | d1f1bb03ad91d69357a73aab78233f3e388e1607 /tools/perf | |
parent | 26fb2fb19c28ec692d6604bb01cbb4f03a4ee009 (diff) |
perf intel-pt: Add decoder support for CBR events
Add decoder support for informing the tools of changes to the core-to-bus
ratio (CBR).
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/1495786658-18063-16-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 19 | ||||
-rw-r--r-- | tools/perf/util/intel-pt-decoder/intel-pt-decoder.h | 2 |
2 files changed, 21 insertions, 0 deletions
diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c index 96bf8d8e83c0..5dea06289db5 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | |||
@@ -141,6 +141,7 @@ struct intel_pt_decoder { | |||
141 | int pkt_len; | 141 | int pkt_len; |
142 | int last_packet_type; | 142 | int last_packet_type; |
143 | unsigned int cbr; | 143 | unsigned int cbr; |
144 | unsigned int cbr_seen; | ||
144 | unsigned int max_non_turbo_ratio; | 145 | unsigned int max_non_turbo_ratio; |
145 | double max_non_turbo_ratio_fp; | 146 | double max_non_turbo_ratio_fp; |
146 | double cbr_cyc_to_tsc; | 147 | double cbr_cyc_to_tsc; |
@@ -167,6 +168,7 @@ struct intel_pt_decoder { | |||
167 | uint64_t fup_ptw_payload; | 168 | uint64_t fup_ptw_payload; |
168 | uint64_t fup_mwait_payload; | 169 | uint64_t fup_mwait_payload; |
169 | uint64_t fup_pwre_payload; | 170 | uint64_t fup_pwre_payload; |
171 | uint64_t cbr_payload; | ||
170 | uint64_t timestamp_insn_cnt; | 172 | uint64_t timestamp_insn_cnt; |
171 | uint64_t sample_insn_cnt; | 173 | uint64_t sample_insn_cnt; |
172 | uint64_t stuck_ip; | 174 | uint64_t stuck_ip; |
@@ -1446,6 +1448,8 @@ static void intel_pt_calc_cbr(struct intel_pt_decoder *decoder) | |||
1446 | { | 1448 | { |
1447 | unsigned int cbr = decoder->packet.payload & 0xff; | 1449 | unsigned int cbr = decoder->packet.payload & 0xff; |
1448 | 1450 | ||
1451 | decoder->cbr_payload = decoder->packet.payload; | ||
1452 | |||
1449 | if (decoder->cbr == cbr) | 1453 | if (decoder->cbr == cbr) |
1450 | return; | 1454 | return; |
1451 | 1455 | ||
@@ -1806,6 +1810,16 @@ next: | |||
1806 | 1810 | ||
1807 | case INTEL_PT_CBR: | 1811 | case INTEL_PT_CBR: |
1808 | intel_pt_calc_cbr(decoder); | 1812 | intel_pt_calc_cbr(decoder); |
1813 | if (!decoder->branch_enable && | ||
1814 | decoder->cbr != decoder->cbr_seen) { | ||
1815 | decoder->cbr_seen = decoder->cbr; | ||
1816 | decoder->state.type = INTEL_PT_CBR_CHG; | ||
1817 | decoder->state.from_ip = decoder->ip; | ||
1818 | decoder->state.to_ip = 0; | ||
1819 | decoder->state.cbr_payload = | ||
1820 | decoder->packet.payload; | ||
1821 | return 0; | ||
1822 | } | ||
1809 | break; | 1823 | break; |
1810 | 1824 | ||
1811 | case INTEL_PT_MODE_EXEC: | 1825 | case INTEL_PT_MODE_EXEC: |
@@ -2343,6 +2357,11 @@ const struct intel_pt_state *intel_pt_decode(struct intel_pt_decoder *decoder) | |||
2343 | decoder->sample_insn_cnt = decoder->timestamp_insn_cnt; | 2357 | decoder->sample_insn_cnt = decoder->timestamp_insn_cnt; |
2344 | } else { | 2358 | } else { |
2345 | decoder->state.err = 0; | 2359 | decoder->state.err = 0; |
2360 | if (decoder->cbr != decoder->cbr_seen && decoder->state.type) { | ||
2361 | decoder->cbr_seen = decoder->cbr; | ||
2362 | decoder->state.type |= INTEL_PT_CBR_CHG; | ||
2363 | decoder->state.cbr_payload = decoder->cbr_payload; | ||
2364 | } | ||
2346 | if (intel_pt_sample_time(decoder->pkt_state)) { | 2365 | if (intel_pt_sample_time(decoder->pkt_state)) { |
2347 | decoder->sample_timestamp = decoder->timestamp; | 2366 | decoder->sample_timestamp = decoder->timestamp; |
2348 | decoder->sample_insn_cnt = decoder->timestamp_insn_cnt; | 2367 | decoder->sample_insn_cnt = decoder->timestamp_insn_cnt; |
diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.h b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.h index 414c88e9e0da..921b22e8ca0e 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.h +++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.h | |||
@@ -36,6 +36,7 @@ enum intel_pt_sample_type { | |||
36 | INTEL_PT_PWR_ENTRY = 1 << 5, | 36 | INTEL_PT_PWR_ENTRY = 1 << 5, |
37 | INTEL_PT_EX_STOP = 1 << 6, | 37 | INTEL_PT_EX_STOP = 1 << 6, |
38 | INTEL_PT_PWR_EXIT = 1 << 7, | 38 | INTEL_PT_PWR_EXIT = 1 << 7, |
39 | INTEL_PT_CBR_CHG = 1 << 8, | ||
39 | }; | 40 | }; |
40 | 41 | ||
41 | enum intel_pt_period_type { | 42 | enum intel_pt_period_type { |
@@ -73,6 +74,7 @@ struct intel_pt_state { | |||
73 | uint64_t mwait_payload; | 74 | uint64_t mwait_payload; |
74 | uint64_t pwre_payload; | 75 | uint64_t pwre_payload; |
75 | uint64_t pwrx_payload; | 76 | uint64_t pwrx_payload; |
77 | uint64_t cbr_payload; | ||
76 | uint32_t flags; | 78 | uint32_t flags; |
77 | enum intel_pt_insn_op insn_op; | 79 | enum intel_pt_insn_op insn_op; |
78 | int insn_len; | 80 | int insn_len; |