Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1493516
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 18/27] perf intel-pt: Add a helper function for processing AUXTRACE_INFO |
| Date | 2016-09-29 16:50 +0200 |
| Message-ID | <smKOS-5mW-25@gated-at.bofh.it> (permalink) |
| References | <smKFb-5jC-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Adrian Hunter <adrian.hunter@intel.com>
Add a helper function 'intel_pt_has()' to make it easier to determine
which members the AUXTRACE_INFO event contains.
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-13-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/intel-pt.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index 96519e801e53..f16b00f55a19 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -2037,6 +2037,12 @@ static void intel_pt_print_info(u64 *arr, int start, int finish)
fprintf(stdout, intel_pt_info_fmts[i], arr[i]);
}
+static bool intel_pt_has(struct auxtrace_info_event *auxtrace_info, int pos)
+{
+ return auxtrace_info->header.size >=
+ sizeof(struct auxtrace_info_event) + (sizeof(u64) * (pos + 1));
+}
+
int intel_pt_process_auxtrace_info(union perf_event *event,
struct perf_session *session)
{
@@ -2077,8 +2083,7 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
intel_pt_print_info(&auxtrace_info->priv[0], INTEL_PT_PMU_TYPE,
INTEL_PT_PER_CPU_MMAPS);
- if (auxtrace_info->header.size >= sizeof(struct auxtrace_info_event) +
- (sizeof(u64) * INTEL_PT_CYC_BIT)) {
+ if (intel_pt_has(auxtrace_info, INTEL_PT_CYC_BIT)) {
pt->mtc_bit = auxtrace_info->priv[INTEL_PT_MTC_BIT];
pt->mtc_freq_bits = auxtrace_info->priv[INTEL_PT_MTC_FREQ_BITS];
pt->tsc_ctc_ratio_n = auxtrace_info->priv[INTEL_PT_TSC_CTC_N];
@@ -2088,8 +2093,7 @@ 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)) {
+ if (intel_pt_has(auxtrace_info, 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],
--
2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[GIT PULL 00/27] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-29 16:40 +0200 [PATCH 23/27] perf probe: Ignore the error of finding inline instance Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-29 16:40 +0200 [PATCH 14/27] perf probe: Increase debug level of SDT debug messages Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-29 16:50 +0200 [PATCH 15/27] perf intel-pt: Fix snapshot overlap detection decoder errors Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-29 16:50 +0200 [PATCH 21/27] perf intel-pt: Enable decoder to handle TIP.PGD with missing IP Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-29 16:50 +0200 [PATCH 18/27] perf intel-pt: Add a helper function for processing AUXTRACE_INFO Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-29 16:50 +0200 [PATCH 11/27] perf record: Fix error paths Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-29 16:50 +0200 [PATCH 12/27] perf symbols: Add dso__last_symbol() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-29 16:50 +0200 [PATCH 08/27] perf evsel: Add support for address filters Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-29 16:50 +0200 [PATCH 25/27] perf probe: Fix to cut off incompatible chars from group name Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-29 16:50 +0200 Re: [GIT PULL 00/27] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2016-09-29 19:20 +0200
csiph-web