.. | .. |
---|
4 | 4 | #include <stdbool.h> |
---|
5 | 5 | #include <traceevent/event-parse.h> |
---|
6 | 6 | #include "evsel.h" |
---|
| 7 | +#include "util/evsel_fprintf.h" |
---|
| 8 | +#include "util/event.h" |
---|
7 | 9 | #include "callchain.h" |
---|
8 | 10 | #include "map.h" |
---|
9 | 11 | #include "strlist.h" |
---|
.. | .. |
---|
33 | 35 | return comma_fprintf(fp, (bool *)priv, " %s: %s", name, val); |
---|
34 | 36 | } |
---|
35 | 37 | |
---|
36 | | -int perf_evsel__fprintf(struct perf_evsel *evsel, |
---|
37 | | - struct perf_attr_details *details, FILE *fp) |
---|
| 38 | +int evsel__fprintf(struct evsel *evsel, struct perf_attr_details *details, FILE *fp) |
---|
38 | 39 | { |
---|
39 | 40 | bool first = true; |
---|
40 | 41 | int printed = 0; |
---|
41 | 42 | |
---|
42 | 43 | if (details->event_group) { |
---|
43 | | - struct perf_evsel *pos; |
---|
| 44 | + struct evsel *pos; |
---|
44 | 45 | |
---|
45 | | - if (!perf_evsel__is_group_leader(evsel)) |
---|
| 46 | + if (!evsel__is_group_leader(evsel)) |
---|
46 | 47 | return 0; |
---|
47 | 48 | |
---|
48 | | - if (evsel->nr_members > 1) |
---|
| 49 | + if (evsel->core.nr_members > 1) |
---|
49 | 50 | printed += fprintf(fp, "%s{", evsel->group_name ?: ""); |
---|
50 | 51 | |
---|
51 | | - printed += fprintf(fp, "%s", perf_evsel__name(evsel)); |
---|
| 52 | + printed += fprintf(fp, "%s", evsel__name(evsel)); |
---|
52 | 53 | for_each_group_member(pos, evsel) |
---|
53 | | - printed += fprintf(fp, ",%s", perf_evsel__name(pos)); |
---|
| 54 | + printed += fprintf(fp, ",%s", evsel__name(pos)); |
---|
54 | 55 | |
---|
55 | | - if (evsel->nr_members > 1) |
---|
| 56 | + if (evsel->core.nr_members > 1) |
---|
56 | 57 | printed += fprintf(fp, "}"); |
---|
57 | 58 | goto out; |
---|
58 | 59 | } |
---|
59 | 60 | |
---|
60 | | - printed += fprintf(fp, "%s", perf_evsel__name(evsel)); |
---|
| 61 | + printed += fprintf(fp, "%s", evsel__name(evsel)); |
---|
61 | 62 | |
---|
62 | 63 | if (details->verbose) { |
---|
63 | | - printed += perf_event_attr__fprintf(fp, &evsel->attr, |
---|
| 64 | + printed += perf_event_attr__fprintf(fp, &evsel->core.attr, |
---|
64 | 65 | __print_attr__fprintf, &first); |
---|
65 | 66 | } else if (details->freq) { |
---|
66 | 67 | const char *term = "sample_freq"; |
---|
67 | 68 | |
---|
68 | | - if (!evsel->attr.freq) |
---|
| 69 | + if (!evsel->core.attr.freq) |
---|
69 | 70 | term = "sample_period"; |
---|
70 | 71 | |
---|
71 | 72 | printed += comma_fprintf(fp, &first, " %s=%" PRIu64, |
---|
72 | | - term, (u64)evsel->attr.sample_freq); |
---|
| 73 | + term, (u64)evsel->core.attr.sample_freq); |
---|
73 | 74 | } |
---|
74 | 75 | |
---|
75 | 76 | if (details->trace_fields) { |
---|
76 | | - struct format_field *field; |
---|
| 77 | + struct tep_format_field *field; |
---|
77 | 78 | |
---|
78 | | - if (evsel->attr.type != PERF_TYPE_TRACEPOINT) { |
---|
| 79 | + if (evsel->core.attr.type != PERF_TYPE_TRACEPOINT) { |
---|
79 | 80 | printed += comma_fprintf(fp, &first, " (not a tracepoint)"); |
---|
80 | 81 | goto out; |
---|
81 | 82 | } |
---|
.. | .. |
---|
101 | 102 | |
---|
102 | 103 | int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment, |
---|
103 | 104 | unsigned int print_opts, struct callchain_cursor *cursor, |
---|
104 | | - FILE *fp) |
---|
| 105 | + struct strlist *bt_stop_list, FILE *fp) |
---|
105 | 106 | { |
---|
106 | 107 | int printed = 0; |
---|
107 | 108 | struct callchain_cursor_node *node; |
---|
.. | .. |
---|
123 | 124 | callchain_cursor_commit(cursor); |
---|
124 | 125 | |
---|
125 | 126 | while (1) { |
---|
| 127 | + struct symbol *sym; |
---|
| 128 | + struct map *map; |
---|
126 | 129 | u64 addr = 0; |
---|
127 | 130 | |
---|
128 | 131 | node = callchain_cursor_current(cursor); |
---|
129 | 132 | if (!node) |
---|
130 | 133 | break; |
---|
131 | 134 | |
---|
132 | | - if (node->sym && node->sym->ignore && print_skip_ignored) |
---|
| 135 | + sym = node->ms.sym; |
---|
| 136 | + map = node->ms.map; |
---|
| 137 | + |
---|
| 138 | + if (sym && sym->ignore && print_skip_ignored) |
---|
133 | 139 | goto next; |
---|
134 | 140 | |
---|
135 | 141 | printed += fprintf(fp, "%-*.*s", left_alignment, left_alignment, " "); |
---|
.. | .. |
---|
140 | 146 | if (print_ip) |
---|
141 | 147 | printed += fprintf(fp, "%c%16" PRIx64, s, node->ip); |
---|
142 | 148 | |
---|
143 | | - if (node->map) |
---|
144 | | - addr = node->map->map_ip(node->map, node->ip); |
---|
| 149 | + if (map) |
---|
| 150 | + addr = map->map_ip(map, node->ip); |
---|
145 | 151 | |
---|
146 | 152 | if (print_sym) { |
---|
147 | 153 | printed += fprintf(fp, " "); |
---|
148 | 154 | node_al.addr = addr; |
---|
149 | | - node_al.map = node->map; |
---|
| 155 | + node_al.map = map; |
---|
150 | 156 | |
---|
151 | 157 | if (print_symoffset) { |
---|
152 | | - printed += __symbol__fprintf_symname_offs(node->sym, &node_al, |
---|
| 158 | + printed += __symbol__fprintf_symname_offs(sym, &node_al, |
---|
153 | 159 | print_unknown_as_addr, |
---|
154 | 160 | true, fp); |
---|
155 | 161 | } else { |
---|
156 | | - printed += __symbol__fprintf_symname(node->sym, &node_al, |
---|
| 162 | + printed += __symbol__fprintf_symname(sym, &node_al, |
---|
157 | 163 | print_unknown_as_addr, fp); |
---|
158 | 164 | } |
---|
159 | 165 | } |
---|
160 | 166 | |
---|
161 | | - if (print_dso && (!node->sym || !node->sym->inlined)) { |
---|
| 167 | + if (print_dso && (!sym || !sym->inlined)) { |
---|
162 | 168 | printed += fprintf(fp, " ("); |
---|
163 | | - printed += map__fprintf_dsoname(node->map, fp); |
---|
| 169 | + printed += map__fprintf_dsoname(map, fp); |
---|
164 | 170 | printed += fprintf(fp, ")"); |
---|
165 | 171 | } |
---|
166 | 172 | |
---|
167 | 173 | if (print_srcline) |
---|
168 | | - printed += map__fprintf_srcline(node->map, addr, "\n ", fp); |
---|
| 174 | + printed += map__fprintf_srcline(map, addr, "\n ", fp); |
---|
169 | 175 | |
---|
170 | | - if (node->sym && node->sym->inlined) |
---|
| 176 | + if (sym && sym->inlined) |
---|
171 | 177 | printed += fprintf(fp, " (inlined)"); |
---|
172 | 178 | |
---|
173 | 179 | if (!print_oneline) |
---|
174 | 180 | printed += fprintf(fp, "\n"); |
---|
175 | 181 | |
---|
176 | | - if (symbol_conf.bt_stop_list && |
---|
177 | | - node->sym && |
---|
178 | | - strlist__has_entry(symbol_conf.bt_stop_list, |
---|
179 | | - node->sym->name)) { |
---|
| 182 | + /* Add srccode here too? */ |
---|
| 183 | + if (bt_stop_list && sym && |
---|
| 184 | + strlist__has_entry(bt_stop_list, sym->name)) { |
---|
180 | 185 | break; |
---|
181 | 186 | } |
---|
182 | 187 | |
---|
.. | .. |
---|
191 | 196 | |
---|
192 | 197 | int sample__fprintf_sym(struct perf_sample *sample, struct addr_location *al, |
---|
193 | 198 | int left_alignment, unsigned int print_opts, |
---|
194 | | - struct callchain_cursor *cursor, FILE *fp) |
---|
| 199 | + struct callchain_cursor *cursor, struct strlist *bt_stop_list, FILE *fp) |
---|
195 | 200 | { |
---|
196 | 201 | int printed = 0; |
---|
197 | 202 | int print_ip = print_opts & EVSEL__PRINT_IP; |
---|
.. | .. |
---|
202 | 207 | int print_unknown_as_addr = print_opts & EVSEL__PRINT_UNKNOWN_AS_ADDR; |
---|
203 | 208 | |
---|
204 | 209 | if (cursor != NULL) { |
---|
205 | | - printed += sample__fprintf_callchain(sample, left_alignment, |
---|
206 | | - print_opts, cursor, fp); |
---|
| 210 | + printed += sample__fprintf_callchain(sample, left_alignment, print_opts, |
---|
| 211 | + cursor, bt_stop_list, fp); |
---|
207 | 212 | } else { |
---|
208 | 213 | printed += fprintf(fp, "%-*.*s", left_alignment, left_alignment, " "); |
---|
209 | 214 | |
---|