diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2017-05-26 04:17:37 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-06-30 10:50:55 -0400 |
commit | 38b65b0891dc129dc0a5ce148a21c481e667b395 (patch) | |
tree | f2d180d2fbf0f10a84d38b1bbeaa7413de7a0a3a /tools | |
parent | ead2bfdb85ab311bc3e1c2e55bff207aafaab096 (diff) |
perf intel-pt: Do not use TSC packets for calculating CPU cycles to TSC
CBR (core-to-bus ratio) packets provide an indication of CPU frequency. A
more accurate measure can be made by counting the cycles (given by CYC
packets) in between other timing packets (either MTC or TSC). Using TSC
packets has at least 2 issues: 1) timing might have stopped (e.g. mwait) or
2) TSC packets within PSB+ might slip past CYC packets. For now, simply do
not use TSC packets for calculating CPU cycles to TSC. That leaves the case
where 2 MTC packets are used, otherwise falling back to the CBR value.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/1495786658-18063-37-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 14 |
1 files changed, 14 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 5dea06289db5..aa1593ce551d 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | |||
@@ -711,6 +711,12 @@ static int intel_pt_calc_cyc_cb(struct intel_pt_pkt_info *pkt_info) | |||
711 | break; | 711 | break; |
712 | 712 | ||
713 | case INTEL_PT_TSC: | 713 | case INTEL_PT_TSC: |
714 | /* | ||
715 | * For now, do not support using TSC packets - refer | ||
716 | * intel_pt_calc_cyc_to_tsc(). | ||
717 | */ | ||
718 | if (data->from_mtc) | ||
719 | return 1; | ||
714 | timestamp = pkt_info->packet.payload | | 720 | timestamp = pkt_info->packet.payload | |
715 | (data->timestamp & (0xffULL << 56)); | 721 | (data->timestamp & (0xffULL << 56)); |
716 | if (data->from_mtc && timestamp < data->timestamp && | 722 | if (data->from_mtc && timestamp < data->timestamp && |
@@ -828,6 +834,14 @@ static void intel_pt_calc_cyc_to_tsc(struct intel_pt_decoder *decoder, | |||
828 | .cbr_cyc_to_tsc = 0, | 834 | .cbr_cyc_to_tsc = 0, |
829 | }; | 835 | }; |
830 | 836 | ||
837 | /* | ||
838 | * For now, do not support using TSC packets for at least the reasons: | ||
839 | * 1) timing might have stopped | ||
840 | * 2) TSC packets within PSB+ can slip against CYC packets | ||
841 | */ | ||
842 | if (!from_mtc) | ||
843 | return; | ||
844 | |||
831 | intel_pt_pkt_lookahead(decoder, intel_pt_calc_cyc_cb, &data); | 845 | intel_pt_pkt_lookahead(decoder, intel_pt_calc_cyc_cb, &data); |
832 | } | 846 | } |
833 | 847 | ||