diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2016-09-23 10:38:39 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-09-29 10:17:02 -0400 |
commit | 1b36c03e356936d62abbe2accaae1573d3b66f14 (patch) | |
tree | 6eb7cc8ca62751aba4661d07823a6cea3cb912e7 /tools/perf/util/auxtrace.h | |
parent | cd67f99fe90dcf515f1c70c474b84d56b6236cbb (diff) |
perf record: Add support for using symbols in address filters
Symbols come from either the DSO or /proc/kallsyms for the kernel.
Details of the functionality can be found in Documentation/perf-record.txt.
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-8-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/auxtrace.h')
-rw-r--r-- | tools/perf/util/auxtrace.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h index 09286f193532..26fb1ee5746a 100644 --- a/tools/perf/util/auxtrace.h +++ b/tools/perf/util/auxtrace.h | |||
@@ -318,6 +318,48 @@ struct auxtrace_record { | |||
318 | unsigned int alignment; | 318 | unsigned int alignment; |
319 | }; | 319 | }; |
320 | 320 | ||
321 | /** | ||
322 | * struct addr_filter - address filter. | ||
323 | * @list: list node | ||
324 | * @range: true if it is a range filter | ||
325 | * @start: true if action is 'filter' or 'start' | ||
326 | * @action: 'filter', 'start' or 'stop' ('tracestop' is accepted but converted | ||
327 | * to 'stop') | ||
328 | * @sym_from: symbol name for the filter address | ||
329 | * @sym_to: symbol name that determines the filter size | ||
330 | * @sym_from_idx: selects n'th from symbols with the same name (0 means global | ||
331 | * and less than 0 means symbol must be unique) | ||
332 | * @sym_to_idx: same as @sym_from_idx but for @sym_to | ||
333 | * @addr: filter address | ||
334 | * @size: filter region size (for range filters) | ||
335 | * @filename: DSO file name or NULL for the kernel | ||
336 | * @str: allocated string that contains the other string members | ||
337 | */ | ||
338 | struct addr_filter { | ||
339 | struct list_head list; | ||
340 | bool range; | ||
341 | bool start; | ||
342 | const char *action; | ||
343 | const char *sym_from; | ||
344 | const char *sym_to; | ||
345 | int sym_from_idx; | ||
346 | int sym_to_idx; | ||
347 | u64 addr; | ||
348 | u64 size; | ||
349 | const char *filename; | ||
350 | char *str; | ||
351 | }; | ||
352 | |||
353 | /** | ||
354 | * struct addr_filters - list of address filters. | ||
355 | * @head: list of address filters | ||
356 | * @cnt: number of address filters | ||
357 | */ | ||
358 | struct addr_filters { | ||
359 | struct list_head head; | ||
360 | int cnt; | ||
361 | }; | ||
362 | |||
321 | #ifdef HAVE_AUXTRACE_SUPPORT | 363 | #ifdef HAVE_AUXTRACE_SUPPORT |
322 | 364 | ||
323 | /* | 365 | /* |
@@ -482,6 +524,12 @@ void perf_session__auxtrace_error_inc(struct perf_session *session, | |||
482 | union perf_event *event); | 524 | union perf_event *event); |
483 | void events_stats__auxtrace_error_warn(const struct events_stats *stats); | 525 | void events_stats__auxtrace_error_warn(const struct events_stats *stats); |
484 | 526 | ||
527 | void addr_filters__init(struct addr_filters *filts); | ||
528 | void addr_filters__exit(struct addr_filters *filts); | ||
529 | int addr_filters__parse_bare_filter(struct addr_filters *filts, | ||
530 | const char *filter); | ||
531 | int auxtrace_parse_filters(struct perf_evlist *evlist); | ||
532 | |||
485 | static inline int auxtrace__process_event(struct perf_session *session, | 533 | static inline int auxtrace__process_event(struct perf_session *session, |
486 | union perf_event *event, | 534 | union perf_event *event, |
487 | struct perf_sample *sample, | 535 | struct perf_sample *sample, |
@@ -640,6 +688,12 @@ void auxtrace_index__free(struct list_head *head __maybe_unused) | |||
640 | { | 688 | { |
641 | } | 689 | } |
642 | 690 | ||
691 | static inline | ||
692 | int auxtrace_parse_filters(struct perf_evlist *evlist __maybe_unused) | ||
693 | { | ||
694 | return 0; | ||
695 | } | ||
696 | |||
643 | int auxtrace_mmap__mmap(struct auxtrace_mmap *mm, | 697 | int auxtrace_mmap__mmap(struct auxtrace_mmap *mm, |
644 | struct auxtrace_mmap_params *mp, | 698 | struct auxtrace_mmap_params *mp, |
645 | void *userpg, int fd); | 699 | void *userpg, int fd); |