From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Linux Weekly News <lwn@lwn.net>,
Adrian Hunter <adrian.hunter@intel.com>,
Jiri Olsa <jolsa@redhat.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 16/27] perf intel-pt: Add support for recording the max non-turbo ratio
Date: Thu, 29 Sep 2016 11:35:45 -0300 [thread overview]
Message-ID: <1475159756-21326-17-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1475159756-21326-1-git-send-email-acme@kernel.org>
From: Adrian Hunter <adrian.hunter@intel.com>
Previously the maximum non-turbo ratio was calculated from TSC assuming
a 100 MHz multiplier which is correct for current hardware supporting
Intel PT. However more recent kernels also now export the value, so use
that in preference to the calculated value.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: http://lkml.kernel.org/r/1474641528-18776-11-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/arch/x86/util/intel-pt.c | 6 ++++++
tools/perf/util/intel-pt.c | 14 +++++++++++++-
tools/perf/util/intel-pt.h | 1 +
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
index a2412e9d883b..18b21514c153 100644
--- a/tools/perf/arch/x86/util/intel-pt.c
+++ b/tools/perf/arch/x86/util/intel-pt.c
@@ -302,6 +302,7 @@ static int intel_pt_info_fill(struct auxtrace_record *itr,
bool cap_user_time_zero = false, per_cpu_mmaps;
u64 tsc_bit, mtc_bit, mtc_freq_bits, cyc_bit, noretcomp_bit;
u32 tsc_ctc_ratio_n, tsc_ctc_ratio_d;
+ unsigned long max_non_turbo_ratio;
int err;
if (priv_size != INTEL_PT_AUXTRACE_PRIV_SIZE)
@@ -317,6 +318,10 @@ static int intel_pt_info_fill(struct auxtrace_record *itr,
intel_pt_tsc_ctc_ratio(&tsc_ctc_ratio_n, &tsc_ctc_ratio_d);
+ if (perf_pmu__scan_file(intel_pt_pmu, "max_nonturbo_ratio",
+ "%lu", &max_non_turbo_ratio) != 1)
+ max_non_turbo_ratio = 0;
+
if (!session->evlist->nr_mmaps)
return -EINVAL;
@@ -351,6 +356,7 @@ static int intel_pt_info_fill(struct auxtrace_record *itr,
auxtrace_info->priv[INTEL_PT_TSC_CTC_N] = tsc_ctc_ratio_n;
auxtrace_info->priv[INTEL_PT_TSC_CTC_D] = tsc_ctc_ratio_d;
auxtrace_info->priv[INTEL_PT_CYC_BIT] = cyc_bit;
+ auxtrace_info->priv[INTEL_PT_MAX_NONTURBO_RATIO] = max_non_turbo_ratio;
return 0;
}
diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index b744ea812a2e..77fbf02c8e41 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -2023,6 +2023,7 @@ static const char * const intel_pt_info_fmts[] = {
[INTEL_PT_TSC_CTC_N] = " TSC:CTC numerator %"PRIu64"\n",
[INTEL_PT_TSC_CTC_D] = " TSC:CTC denominator %"PRIu64"\n",
[INTEL_PT_CYC_BIT] = " CYC bit %#"PRIx64"\n",
+ [INTEL_PT_MAX_NONTURBO_RATIO] = " Max non-turbo ratio %"PRIu64"\n",
};
static void intel_pt_print_info(u64 *arr, int start, int finish)
@@ -2087,6 +2088,15 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
INTEL_PT_CYC_BIT);
}
+ if (auxtrace_info->header.size >= sizeof(struct auxtrace_info_event) +
+ (sizeof(u64) * INTEL_PT_MAX_NONTURBO_RATIO)) {
+ pt->max_non_turbo_ratio =
+ auxtrace_info->priv[INTEL_PT_MAX_NONTURBO_RATIO];
+ intel_pt_print_info(&auxtrace_info->priv[0],
+ INTEL_PT_MAX_NONTURBO_RATIO,
+ INTEL_PT_MAX_NONTURBO_RATIO);
+ }
+
pt->timeless_decoding = intel_pt_timeless_decoding(pt);
pt->have_tsc = intel_pt_have_tsc(pt);
pt->sampling_mode = false;
@@ -2156,7 +2166,9 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
if (pt->tc.time_mult) {
u64 tsc_freq = intel_pt_ns_to_ticks(pt, 1000000000);
- pt->max_non_turbo_ratio = (tsc_freq + 50000000) / 100000000;
+ if (!pt->max_non_turbo_ratio)
+ pt->max_non_turbo_ratio =
+ (tsc_freq + 50000000) / 100000000;
intel_pt_log("TSC frequency %"PRIu64"\n", tsc_freq);
intel_pt_log("Maximum non-turbo ratio %u\n",
pt->max_non_turbo_ratio);
diff --git a/tools/perf/util/intel-pt.h b/tools/perf/util/intel-pt.h
index 0065949df693..8b8356233e6a 100644
--- a/tools/perf/util/intel-pt.h
+++ b/tools/perf/util/intel-pt.h
@@ -34,6 +34,7 @@ enum {
INTEL_PT_TSC_CTC_N,
INTEL_PT_TSC_CTC_D,
INTEL_PT_CYC_BIT,
+ INTEL_PT_MAX_NONTURBO_RATIO,
INTEL_PT_AUXTRACE_PRIV_MAX,
};
--
2.7.4
next prev parent reply other threads:[~2016-09-29 14:39 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-29 14:35 [GIT PULL 00/27] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 01/27] perf record: Fix documentation 'event_sources' -> 'event_source' Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 02/27] perf tools: Fix MMAP event synthesis broken by MAP_HUGETLB change Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 03/27] perf data: Fix building in 32 bit platform with libbabeltrace Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 04/27] perf trace: Beautify sched_[gs]et_attr return value Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 05/27] perf tools: Update documentation info about quipper Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 06/27] perf tools: Make perf_evsel__append_filter() generic Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 07/27] perf evsel: New tracepoint specific function Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 08/27] perf evsel: Add support for address filters Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 09/27] perf script: Fix vanished idle symbols Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 10/27] perf record: Rename label 'out_symbol_exit' Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 11/27] perf record: Fix error paths Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 12/27] perf symbols: Add dso__last_symbol() Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 13/27] perf record: Add support for using symbols in address filters Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 14/27] perf probe: Increase debug level of SDT debug messages Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 15/27] perf intel-pt: Fix snapshot overlap detection decoder errors Arnaldo Carvalho de Melo
2016-09-29 14:35 ` Arnaldo Carvalho de Melo [this message]
2016-09-29 14:35 ` [PATCH 17/27] perf intel-pt: Fix missing error codes processing auxtrace_info Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 18/27] perf intel-pt: Add a helper function for processing AUXTRACE_INFO Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 19/27] perf intel-pt: Record address filter in AUXTRACE_INFO event Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 20/27] perf intel-pt: Read address filter from " Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 21/27] perf intel-pt: Enable decoder to handle TIP.PGD with missing IP Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 22/27] perf intel-pt: Fix decoding when there are address filters Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 23/27] perf probe: Ignore the error of finding inline instance Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 24/27] perf probe: Skip if the function address is 0 Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 25/27] perf probe: Fix to cut off incompatible chars from group name Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 26/27] perf probe: Match linkage name with mangled name Arnaldo Carvalho de Melo
2016-09-29 14:35 ` [PATCH 27/27] perf tests: Add dwarf unwind test for powerpc Arnaldo Carvalho de Melo
2016-09-29 17:11 ` [GIT PULL 00/27] perf/core improvements and fixes Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1475159756-21326-17-git-send-email-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lwn@lwn.net \
--cc=mathieu.poirier@linaro.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).