diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2014-07-22 16:17:39 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-07-25 12:08:34 -0300 |
commit | 9b0d2d875d57d85fdfb35ac27f89951520a8b473 (patch) | |
tree | 2b5007f4e01912ee107f28fa8e4fc16e4448db7f /tools/perf/builtin-script.c | |
parent | f1dd1460a40894b00bbeacd753025e9251ec11bd (diff) | |
download | linux-9b0d2d875d57d85fdfb35ac27f89951520a8b473.tar.gz linux-9b0d2d875d57d85fdfb35ac27f89951520a8b473.tar.bz2 linux-9b0d2d875d57d85fdfb35ac27f89951520a8b473.zip |
perf tools: Expose 'addr' functions so they can be reused
Move some functions and functionality related to the use of
'addr' out of builtin-script so they can be reused.
The moved functions are: is_bts_event() and sample_addr_correlates_sym()
and a new function perf_event__preprocess_sample_addr() is created from
bits of print_sample_addr().
perf_event__preprocess_sample_addr() is the equivalent of
perf_event__preprocess_sample() but for 'addr' instead of 'ip'.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1406035081-14301-31-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-script.c')
-rw-r--r-- | tools/perf/builtin-script.c | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 582da97872e5..f57035b89c15 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -358,27 +358,6 @@ static void print_sample_start(struct perf_sample *sample, } } -static bool is_bts_event(struct perf_event_attr *attr) -{ - return ((attr->type == PERF_TYPE_HARDWARE) && - (attr->config & PERF_COUNT_HW_BRANCH_INSTRUCTIONS) && - (attr->sample_period == 1)); -} - -static bool sample_addr_correlates_sym(struct perf_event_attr *attr) -{ - if ((attr->type == PERF_TYPE_SOFTWARE) && - ((attr->config == PERF_COUNT_SW_PAGE_FAULTS) || - (attr->config == PERF_COUNT_SW_PAGE_FAULTS_MIN) || - (attr->config == PERF_COUNT_SW_PAGE_FAULTS_MAJ))) - return true; - - if (is_bts_event(attr)) - return true; - - return false; -} - static void print_sample_addr(union perf_event *event, struct perf_sample *sample, struct machine *machine, @@ -386,24 +365,13 @@ static void print_sample_addr(union perf_event *event, struct perf_event_attr *attr) { struct addr_location al; - u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; printf("%16" PRIx64, sample->addr); if (!sample_addr_correlates_sym(attr)) return; - thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION, - sample->addr, &al); - if (!al.map) - thread__find_addr_map(thread, machine, cpumode, MAP__VARIABLE, - sample->addr, &al); - - al.cpu = sample->cpu; - al.sym = NULL; - - if (al.map) - al.sym = map__find_symbol(al.map, al.addr, NULL); + perf_event__preprocess_sample_addr(event, sample, machine, thread, &al); if (PRINT_FIELD(SYM)) { printf(" "); |