diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2016-09-23 10:38:44 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-09-29 10:17:04 -0400 |
commit | 40b746a06332799786ba557fe84184428bef62fb (patch) | |
tree | d0145c17f71f206bb39b60a7477f026d5de0c4bd /tools/perf | |
parent | 4d34e10a9f9a38c611cac0deda8f91b064282747 (diff) |
perf intel-pt: Add a helper function for processing AUXTRACE_INFO
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>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/intel-pt.c | 12 |
1 files 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) | |||
2037 | fprintf(stdout, intel_pt_info_fmts[i], arr[i]); | 2037 | fprintf(stdout, intel_pt_info_fmts[i], arr[i]); |
2038 | } | 2038 | } |
2039 | 2039 | ||
2040 | static bool intel_pt_has(struct auxtrace_info_event *auxtrace_info, int pos) | ||
2041 | { | ||
2042 | return auxtrace_info->header.size >= | ||
2043 | sizeof(struct auxtrace_info_event) + (sizeof(u64) * (pos + 1)); | ||
2044 | } | ||
2045 | |||
2040 | int intel_pt_process_auxtrace_info(union perf_event *event, | 2046 | int intel_pt_process_auxtrace_info(union perf_event *event, |
2041 | struct perf_session *session) | 2047 | struct perf_session *session) |
2042 | { | 2048 | { |
@@ -2077,8 +2083,7 @@ int intel_pt_process_auxtrace_info(union perf_event *event, | |||
2077 | intel_pt_print_info(&auxtrace_info->priv[0], INTEL_PT_PMU_TYPE, | 2083 | intel_pt_print_info(&auxtrace_info->priv[0], INTEL_PT_PMU_TYPE, |
2078 | INTEL_PT_PER_CPU_MMAPS); | 2084 | INTEL_PT_PER_CPU_MMAPS); |
2079 | 2085 | ||
2080 | if (auxtrace_info->header.size >= sizeof(struct auxtrace_info_event) + | 2086 | if (intel_pt_has(auxtrace_info, INTEL_PT_CYC_BIT)) { |
2081 | (sizeof(u64) * INTEL_PT_CYC_BIT)) { | ||
2082 | pt->mtc_bit = auxtrace_info->priv[INTEL_PT_MTC_BIT]; | 2087 | pt->mtc_bit = auxtrace_info->priv[INTEL_PT_MTC_BIT]; |
2083 | pt->mtc_freq_bits = auxtrace_info->priv[INTEL_PT_MTC_FREQ_BITS]; | 2088 | pt->mtc_freq_bits = auxtrace_info->priv[INTEL_PT_MTC_FREQ_BITS]; |
2084 | pt->tsc_ctc_ratio_n = auxtrace_info->priv[INTEL_PT_TSC_CTC_N]; | 2089 | 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, | |||
2088 | INTEL_PT_CYC_BIT); | 2093 | INTEL_PT_CYC_BIT); |
2089 | } | 2094 | } |
2090 | 2095 | ||
2091 | if (auxtrace_info->header.size >= sizeof(struct auxtrace_info_event) + | 2096 | if (intel_pt_has(auxtrace_info, INTEL_PT_MAX_NONTURBO_RATIO)) { |
2092 | (sizeof(u64) * INTEL_PT_MAX_NONTURBO_RATIO)) { | ||
2093 | pt->max_non_turbo_ratio = | 2097 | pt->max_non_turbo_ratio = |
2094 | auxtrace_info->priv[INTEL_PT_MAX_NONTURBO_RATIO]; | 2098 | auxtrace_info->priv[INTEL_PT_MAX_NONTURBO_RATIO]; |
2095 | intel_pt_print_info(&auxtrace_info->priv[0], | 2099 | intel_pt_print_info(&auxtrace_info->priv[0], |