diff options
Diffstat (limited to 'tools/perf/util/evsel_fprintf.c')
-rw-r--r-- | tools/perf/util/evsel_fprintf.c | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/tools/perf/util/evsel_fprintf.c b/tools/perf/util/evsel_fprintf.c index 95ea147f9e18..3b4842840db0 100644 --- a/tools/perf/util/evsel_fprintf.c +++ b/tools/perf/util/evsel_fprintf.c @@ -4,6 +4,8 @@ #include <stdbool.h> #include <traceevent/event-parse.h> #include "evsel.h" +#include "util/evsel_fprintf.h" +#include "util/event.h" #include "callchain.h" #include "map.h" #include "strlist.h" @@ -33,26 +35,26 @@ static int __print_attr__fprintf(FILE *fp, const char *name, const char *val, vo return comma_fprintf(fp, (bool *)priv, " %s: %s", name, val); } -int perf_evsel__fprintf(struct perf_evsel *evsel, +int perf_evsel__fprintf(struct evsel *evsel, struct perf_attr_details *details, FILE *fp) { bool first = true; int printed = 0; if (details->event_group) { - struct perf_evsel *pos; + struct evsel *pos; if (!perf_evsel__is_group_leader(evsel)) return 0; - if (evsel->nr_members > 1) + if (evsel->core.nr_members > 1) printed += fprintf(fp, "%s{", evsel->group_name ?: ""); printed += fprintf(fp, "%s", perf_evsel__name(evsel)); for_each_group_member(pos, evsel) printed += fprintf(fp, ",%s", perf_evsel__name(pos)); - if (evsel->nr_members > 1) + if (evsel->core.nr_members > 1) printed += fprintf(fp, "}"); goto out; } @@ -60,22 +62,22 @@ int perf_evsel__fprintf(struct perf_evsel *evsel, printed += fprintf(fp, "%s", perf_evsel__name(evsel)); if (details->verbose) { - printed += perf_event_attr__fprintf(fp, &evsel->attr, + printed += perf_event_attr__fprintf(fp, &evsel->core.attr, __print_attr__fprintf, &first); } else if (details->freq) { const char *term = "sample_freq"; - if (!evsel->attr.freq) + if (!evsel->core.attr.freq) term = "sample_period"; printed += comma_fprintf(fp, &first, " %s=%" PRIu64, - term, (u64)evsel->attr.sample_freq); + term, (u64)evsel->core.attr.sample_freq); } if (details->trace_fields) { struct tep_format_field *field; - if (evsel->attr.type != PERF_TYPE_TRACEPOINT) { + if (evsel->core.attr.type != PERF_TYPE_TRACEPOINT) { printed += comma_fprintf(fp, &first, " (not a tracepoint)"); goto out; } @@ -101,7 +103,7 @@ out: int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment, unsigned int print_opts, struct callchain_cursor *cursor, - FILE *fp) + struct strlist *bt_stop_list, FILE *fp) { int printed = 0; struct callchain_cursor_node *node; @@ -123,13 +125,18 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment, callchain_cursor_commit(cursor); while (1) { + struct symbol *sym; + struct map *map; u64 addr = 0; node = callchain_cursor_current(cursor); if (!node) break; - if (node->sym && node->sym->ignore && print_skip_ignored) + sym = node->ms.sym; + map = node->ms.map; + + if (sym && sym->ignore && print_skip_ignored) goto next; printed += fprintf(fp, "%-*.*s", left_alignment, left_alignment, " "); @@ -140,44 +147,42 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment, if (print_ip) printed += fprintf(fp, "%c%16" PRIx64, s, node->ip); - if (node->map) - addr = node->map->map_ip(node->map, node->ip); + if (map) + addr = map->map_ip(map, node->ip); if (print_sym) { printed += fprintf(fp, " "); node_al.addr = addr; - node_al.map = node->map; + node_al.map = map; if (print_symoffset) { - printed += __symbol__fprintf_symname_offs(node->sym, &node_al, + printed += __symbol__fprintf_symname_offs(sym, &node_al, print_unknown_as_addr, true, fp); } else { - printed += __symbol__fprintf_symname(node->sym, &node_al, + printed += __symbol__fprintf_symname(sym, &node_al, print_unknown_as_addr, fp); } } - if (print_dso && (!node->sym || !node->sym->inlined)) { + if (print_dso && (!sym || !sym->inlined)) { printed += fprintf(fp, " ("); - printed += map__fprintf_dsoname(node->map, fp); + printed += map__fprintf_dsoname(map, fp); printed += fprintf(fp, ")"); } if (print_srcline) - printed += map__fprintf_srcline(node->map, addr, "\n ", fp); + printed += map__fprintf_srcline(map, addr, "\n ", fp); - if (node->sym && node->sym->inlined) + if (sym && sym->inlined) printed += fprintf(fp, " (inlined)"); if (!print_oneline) printed += fprintf(fp, "\n"); /* Add srccode here too? */ - if (symbol_conf.bt_stop_list && - node->sym && - strlist__has_entry(symbol_conf.bt_stop_list, - node->sym->name)) { + if (bt_stop_list && sym && + strlist__has_entry(bt_stop_list, sym->name)) { break; } @@ -192,7 +197,7 @@ next: int sample__fprintf_sym(struct perf_sample *sample, struct addr_location *al, int left_alignment, unsigned int print_opts, - struct callchain_cursor *cursor, FILE *fp) + struct callchain_cursor *cursor, struct strlist *bt_stop_list, FILE *fp) { int printed = 0; int print_ip = print_opts & EVSEL__PRINT_IP; @@ -203,8 +208,8 @@ int sample__fprintf_sym(struct perf_sample *sample, struct addr_location *al, int print_unknown_as_addr = print_opts & EVSEL__PRINT_UNKNOWN_AS_ADDR; if (cursor != NULL) { - printed += sample__fprintf_callchain(sample, left_alignment, - print_opts, cursor, fp); + printed += sample__fprintf_callchain(sample, left_alignment, print_opts, + cursor, bt_stop_list, fp); } else { printed += fprintf(fp, "%-*.*s", left_alignment, left_alignment, " "); |