diff options
Diffstat (limited to 'tools/perf/util')
-rwxr-xr-x | tools/perf/util/PERF-VERSION-GEN | 8 | ||||
-rw-r--r-- | tools/perf/util/annotate.c | 2 | ||||
-rw-r--r-- | tools/perf/util/parse-events.c | 22 | ||||
-rw-r--r-- | tools/perf/util/parse-events.h | 1 | ||||
-rw-r--r-- | tools/perf/util/scripting-engines/trace-event-perl.c | 11 | ||||
-rw-r--r-- | tools/perf/util/scripting-engines/trace-event-python.c | 11 | ||||
-rw-r--r-- | tools/perf/util/session.c | 61 | ||||
-rw-r--r-- | tools/perf/util/session.h | 4 | ||||
-rw-r--r-- | tools/perf/util/symbol.c | 64 | ||||
-rw-r--r-- | tools/perf/util/symbol.h | 31 | ||||
-rw-r--r-- | tools/perf/util/top.c | 6 | ||||
-rw-r--r-- | tools/perf/util/top.h | 4 | ||||
-rw-r--r-- | tools/perf/util/trace-event-parse.c | 110 | ||||
-rw-r--r-- | tools/perf/util/trace-event-scripting.c | 9 | ||||
-rw-r--r-- | tools/perf/util/trace-event.h | 10 |
15 files changed, 183 insertions, 171 deletions
diff --git a/tools/perf/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN index 97d76562a1a0..26d4d3fd6deb 100755 --- a/tools/perf/util/PERF-VERSION-GEN +++ b/tools/perf/util/PERF-VERSION-GEN | |||
@@ -23,10 +23,10 @@ if test -d ../../.git -o -f ../../.git && | |||
23 | then | 23 | then |
24 | VN=$(echo "$VN" | sed -e 's/-/./g'); | 24 | VN=$(echo "$VN" | sed -e 's/-/./g'); |
25 | else | 25 | else |
26 | eval `grep '^VERSION\s*=' ../../Makefile|tr -d ' '` | 26 | eval $(grep '^VERSION[[:space:]]*=' ../../Makefile|tr -d ' ') |
27 | eval `grep '^PATCHLEVEL\s*=' ../../Makefile|tr -d ' '` | 27 | eval $(grep '^PATCHLEVEL[[:space:]]*=' ../../Makefile|tr -d ' ') |
28 | eval `grep '^SUBLEVEL\s*=' ../../Makefile|tr -d ' '` | 28 | eval $(grep '^SUBLEVEL[[:space:]]*=' ../../Makefile|tr -d ' ') |
29 | eval `grep '^EXTRAVERSION\s*=' ../../Makefile|tr -d ' '` | 29 | eval $(grep '^EXTRAVERSION[[:space:]]*=' ../../Makefile|tr -d ' ') |
30 | 30 | ||
31 | VN="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}" | 31 | VN="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}" |
32 | fi | 32 | fi |
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 0d0830c98cd7..e01af2b1a469 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -294,7 +294,7 @@ fallback: | |||
294 | free_filename = false; | 294 | free_filename = false; |
295 | } | 295 | } |
296 | 296 | ||
297 | if (dso->origin == DSO__ORIG_KERNEL) { | 297 | if (dso->symtab_type == SYMTAB__KALLSYMS) { |
298 | char bf[BUILD_ID_SIZE * 2 + 16] = " with build id "; | 298 | char bf[BUILD_ID_SIZE * 2 + 16] = " with build id "; |
299 | char *build_id_msg = NULL; | 299 | char *build_id_msg = NULL; |
300 | 300 | ||
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 54a7e2634d58..952b4ae3d954 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -263,6 +263,28 @@ static char *event_cache_name(u8 cache_type, u8 cache_op, u8 cache_result) | |||
263 | return name; | 263 | return name; |
264 | } | 264 | } |
265 | 265 | ||
266 | const char *event_type(int type) | ||
267 | { | ||
268 | switch (type) { | ||
269 | case PERF_TYPE_HARDWARE: | ||
270 | return "hardware"; | ||
271 | |||
272 | case PERF_TYPE_SOFTWARE: | ||
273 | return "software"; | ||
274 | |||
275 | case PERF_TYPE_TRACEPOINT: | ||
276 | return "tracepoint"; | ||
277 | |||
278 | case PERF_TYPE_HW_CACHE: | ||
279 | return "hardware-cache"; | ||
280 | |||
281 | default: | ||
282 | break; | ||
283 | } | ||
284 | |||
285 | return "unknown"; | ||
286 | } | ||
287 | |||
266 | const char *event_name(struct perf_evsel *evsel) | 288 | const char *event_name(struct perf_evsel *evsel) |
267 | { | 289 | { |
268 | u64 config = evsel->attr.config; | 290 | u64 config = evsel->attr.config; |
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 212f88e07a9c..746d3fcbfc2a 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h | |||
@@ -20,6 +20,7 @@ struct tracepoint_path { | |||
20 | extern struct tracepoint_path *tracepoint_id_to_path(u64 config); | 20 | extern struct tracepoint_path *tracepoint_id_to_path(u64 config); |
21 | extern bool have_tracepoints(struct list_head *evlist); | 21 | extern bool have_tracepoints(struct list_head *evlist); |
22 | 22 | ||
23 | const char *event_type(int type); | ||
23 | const char *event_name(struct perf_evsel *event); | 24 | const char *event_name(struct perf_evsel *event); |
24 | extern const char *__event_name(int type, u64 config); | 25 | extern const char *__event_name(int type, u64 config); |
25 | 26 | ||
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c index 93680818e244..621427212e86 100644 --- a/tools/perf/util/scripting-engines/trace-event-perl.c +++ b/tools/perf/util/scripting-engines/trace-event-perl.c | |||
@@ -245,9 +245,10 @@ static inline struct event *find_cache_event(int type) | |||
245 | return event; | 245 | return event; |
246 | } | 246 | } |
247 | 247 | ||
248 | static void perl_process_event(int cpu, void *data, | 248 | static void perl_process_event(union perf_event *pevent __unused, |
249 | int size __unused, | 249 | struct perf_sample *sample, |
250 | unsigned long long nsecs, char *comm) | 250 | struct perf_session *session __unused, |
251 | struct thread *thread) | ||
251 | { | 252 | { |
252 | struct format_field *field; | 253 | struct format_field *field; |
253 | static char handler[256]; | 254 | static char handler[256]; |
@@ -256,6 +257,10 @@ static void perl_process_event(int cpu, void *data, | |||
256 | struct event *event; | 257 | struct event *event; |
257 | int type; | 258 | int type; |
258 | int pid; | 259 | int pid; |
260 | int cpu = sample->cpu; | ||
261 | void *data = sample->raw_data; | ||
262 | unsigned long long nsecs = sample->time; | ||
263 | char *comm = thread->comm; | ||
259 | 264 | ||
260 | dSP; | 265 | dSP; |
261 | 266 | ||
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index 2040b8538527..1b85d6055159 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c | |||
@@ -204,9 +204,10 @@ static inline struct event *find_cache_event(int type) | |||
204 | return event; | 204 | return event; |
205 | } | 205 | } |
206 | 206 | ||
207 | static void python_process_event(int cpu, void *data, | 207 | static void python_process_event(union perf_event *pevent __unused, |
208 | int size __unused, | 208 | struct perf_sample *sample, |
209 | unsigned long long nsecs, char *comm) | 209 | struct perf_session *session __unused, |
210 | struct thread *thread) | ||
210 | { | 211 | { |
211 | PyObject *handler, *retval, *context, *t, *obj, *dict = NULL; | 212 | PyObject *handler, *retval, *context, *t, *obj, *dict = NULL; |
212 | static char handler_name[256]; | 213 | static char handler_name[256]; |
@@ -217,6 +218,10 @@ static void python_process_event(int cpu, void *data, | |||
217 | unsigned n = 0; | 218 | unsigned n = 0; |
218 | int type; | 219 | int type; |
219 | int pid; | 220 | int pid; |
221 | int cpu = sample->cpu; | ||
222 | void *data = sample->raw_data; | ||
223 | unsigned long long nsecs = sample->time; | ||
224 | char *comm = thread->comm; | ||
220 | 225 | ||
221 | t = PyTuple_New(MAX_FIELDS); | 226 | t = PyTuple_New(MAX_FIELDS); |
222 | if (!t) | 227 | if (!t) |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index f26639fa0fb3..c68cf40764f9 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -1134,3 +1134,64 @@ size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp) | |||
1134 | 1134 | ||
1135 | return ret; | 1135 | return ret; |
1136 | } | 1136 | } |
1137 | |||
1138 | void perf_session__print_symbols(union perf_event *event, | ||
1139 | struct perf_sample *sample, | ||
1140 | struct perf_session *session) | ||
1141 | { | ||
1142 | struct addr_location al; | ||
1143 | const char *symname, *dsoname; | ||
1144 | struct callchain_cursor *cursor = &session->callchain_cursor; | ||
1145 | struct callchain_cursor_node *node; | ||
1146 | |||
1147 | if (perf_event__preprocess_sample(event, session, &al, sample, | ||
1148 | NULL) < 0) { | ||
1149 | error("problem processing %d event, skipping it.\n", | ||
1150 | event->header.type); | ||
1151 | return; | ||
1152 | } | ||
1153 | |||
1154 | if (symbol_conf.use_callchain && sample->callchain) { | ||
1155 | |||
1156 | if (perf_session__resolve_callchain(session, al.thread, | ||
1157 | sample->callchain, NULL) != 0) { | ||
1158 | if (verbose) | ||
1159 | error("Failed to resolve callchain. Skipping\n"); | ||
1160 | return; | ||
1161 | } | ||
1162 | callchain_cursor_commit(cursor); | ||
1163 | |||
1164 | while (1) { | ||
1165 | node = callchain_cursor_current(cursor); | ||
1166 | if (!node) | ||
1167 | break; | ||
1168 | |||
1169 | if (node->sym && node->sym->name) | ||
1170 | symname = node->sym->name; | ||
1171 | else | ||
1172 | symname = ""; | ||
1173 | |||
1174 | if (node->map && node->map->dso && node->map->dso->name) | ||
1175 | dsoname = node->map->dso->name; | ||
1176 | else | ||
1177 | dsoname = ""; | ||
1178 | |||
1179 | printf("\t%16" PRIx64 " %s (%s)\n", node->ip, symname, dsoname); | ||
1180 | |||
1181 | callchain_cursor_advance(cursor); | ||
1182 | } | ||
1183 | |||
1184 | } else { | ||
1185 | if (al.sym && al.sym->name) | ||
1186 | symname = al.sym->name; | ||
1187 | else | ||
1188 | symname = ""; | ||
1189 | |||
1190 | if (al.map && al.map->dso && al.map->dso->name) | ||
1191 | dsoname = al.map->dso->name; | ||
1192 | else | ||
1193 | dsoname = ""; | ||
1194 | |||
1195 | printf("%16" PRIx64 " %s (%s)", al.addr, symname, dsoname); | ||
1196 | } | ||
1197 | } | ||
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h index b5b148b0aaca..0b3c9afecaa9 100644 --- a/tools/perf/util/session.h +++ b/tools/perf/util/session.h | |||
@@ -159,4 +159,8 @@ static inline int perf_session__parse_sample(struct perf_session *session, | |||
159 | session->sample_id_all, sample); | 159 | session->sample_id_all, sample); |
160 | } | 160 | } |
161 | 161 | ||
162 | void perf_session__print_symbols(union perf_event *event, | ||
163 | struct perf_sample *sample, | ||
164 | struct perf_session *session); | ||
165 | |||
162 | #endif /* __PERF_SESSION_H */ | 166 | #endif /* __PERF_SESSION_H */ |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 00014e32c288..651dbfe7f4f3 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -207,7 +207,7 @@ struct dso *dso__new(const char *name) | |||
207 | dso__set_short_name(self, self->name); | 207 | dso__set_short_name(self, self->name); |
208 | for (i = 0; i < MAP__NR_TYPES; ++i) | 208 | for (i = 0; i < MAP__NR_TYPES; ++i) |
209 | self->symbols[i] = self->symbol_names[i] = RB_ROOT; | 209 | self->symbols[i] = self->symbol_names[i] = RB_ROOT; |
210 | self->origin = DSO__ORIG_NOT_FOUND; | 210 | self->symtab_type = SYMTAB__NOT_FOUND; |
211 | self->loaded = 0; | 211 | self->loaded = 0; |
212 | self->sorted_by_name = 0; | 212 | self->sorted_by_name = 0; |
213 | self->has_build_id = 0; | 213 | self->has_build_id = 0; |
@@ -680,9 +680,9 @@ int dso__load_kallsyms(struct dso *self, const char *filename, | |||
680 | return -1; | 680 | return -1; |
681 | 681 | ||
682 | if (self->kernel == DSO_TYPE_GUEST_KERNEL) | 682 | if (self->kernel == DSO_TYPE_GUEST_KERNEL) |
683 | self->origin = DSO__ORIG_GUEST_KERNEL; | 683 | self->symtab_type = SYMTAB__GUEST_KALLSYMS; |
684 | else | 684 | else |
685 | self->origin = DSO__ORIG_KERNEL; | 685 | self->symtab_type = SYMTAB__KALLSYMS; |
686 | 686 | ||
687 | return dso__split_kallsyms(self, map, filter); | 687 | return dso__split_kallsyms(self, map, filter); |
688 | } | 688 | } |
@@ -1204,7 +1204,7 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name, | |||
1204 | } | 1204 | } |
1205 | curr_map->map_ip = identity__map_ip; | 1205 | curr_map->map_ip = identity__map_ip; |
1206 | curr_map->unmap_ip = identity__map_ip; | 1206 | curr_map->unmap_ip = identity__map_ip; |
1207 | curr_dso->origin = self->origin; | 1207 | curr_dso->symtab_type = self->symtab_type; |
1208 | map_groups__insert(kmap->kmaps, curr_map); | 1208 | map_groups__insert(kmap->kmaps, curr_map); |
1209 | dsos__add(&self->node, curr_dso); | 1209 | dsos__add(&self->node, curr_dso); |
1210 | dso__set_loaded(curr_dso, map->type); | 1210 | dso__set_loaded(curr_dso, map->type); |
@@ -1430,21 +1430,21 @@ out: | |||
1430 | char dso__symtab_origin(const struct dso *self) | 1430 | char dso__symtab_origin(const struct dso *self) |
1431 | { | 1431 | { |
1432 | static const char origin[] = { | 1432 | static const char origin[] = { |
1433 | [DSO__ORIG_KERNEL] = 'k', | 1433 | [SYMTAB__KALLSYMS] = 'k', |
1434 | [DSO__ORIG_JAVA_JIT] = 'j', | 1434 | [SYMTAB__JAVA_JIT] = 'j', |
1435 | [DSO__ORIG_BUILD_ID_CACHE] = 'B', | 1435 | [SYMTAB__BUILD_ID_CACHE] = 'B', |
1436 | [DSO__ORIG_FEDORA] = 'f', | 1436 | [SYMTAB__FEDORA_DEBUGINFO] = 'f', |
1437 | [DSO__ORIG_UBUNTU] = 'u', | 1437 | [SYMTAB__UBUNTU_DEBUGINFO] = 'u', |
1438 | [DSO__ORIG_BUILDID] = 'b', | 1438 | [SYMTAB__BUILDID_DEBUGINFO] = 'b', |
1439 | [DSO__ORIG_DSO] = 'd', | 1439 | [SYMTAB__SYSTEM_PATH_DSO] = 'd', |
1440 | [DSO__ORIG_KMODULE] = 'K', | 1440 | [SYMTAB__SYSTEM_PATH_KMODULE] = 'K', |
1441 | [DSO__ORIG_GUEST_KERNEL] = 'g', | 1441 | [SYMTAB__GUEST_KALLSYMS] = 'g', |
1442 | [DSO__ORIG_GUEST_KMODULE] = 'G', | 1442 | [SYMTAB__GUEST_KMODULE] = 'G', |
1443 | }; | 1443 | }; |
1444 | 1444 | ||
1445 | if (self == NULL || self->origin == DSO__ORIG_NOT_FOUND) | 1445 | if (self == NULL || self->symtab_type == SYMTAB__NOT_FOUND) |
1446 | return '!'; | 1446 | return '!'; |
1447 | return origin[self->origin]; | 1447 | return origin[self->symtab_type]; |
1448 | } | 1448 | } |
1449 | 1449 | ||
1450 | int dso__load(struct dso *self, struct map *map, symbol_filter_t filter) | 1450 | int dso__load(struct dso *self, struct map *map, symbol_filter_t filter) |
@@ -1477,8 +1477,8 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter) | |||
1477 | 1477 | ||
1478 | if (strncmp(self->name, "/tmp/perf-", 10) == 0) { | 1478 | if (strncmp(self->name, "/tmp/perf-", 10) == 0) { |
1479 | ret = dso__load_perf_map(self, map, filter); | 1479 | ret = dso__load_perf_map(self, map, filter); |
1480 | self->origin = ret > 0 ? DSO__ORIG_JAVA_JIT : | 1480 | self->symtab_type = ret > 0 ? SYMTAB__JAVA_JIT : |
1481 | DSO__ORIG_NOT_FOUND; | 1481 | SYMTAB__NOT_FOUND; |
1482 | return ret; | 1482 | return ret; |
1483 | } | 1483 | } |
1484 | 1484 | ||
@@ -1486,26 +1486,26 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter) | |||
1486 | * On the first pass, only load images if they have a full symtab. | 1486 | * On the first pass, only load images if they have a full symtab. |
1487 | * Failing that, do a second pass where we accept .dynsym also | 1487 | * Failing that, do a second pass where we accept .dynsym also |
1488 | */ | 1488 | */ |
1489 | for (self->origin = DSO__ORIG_BUILD_ID_CACHE, want_symtab = 1; | 1489 | for (self->symtab_type = SYMTAB__BUILD_ID_CACHE, want_symtab = 1; |
1490 | self->origin != DSO__ORIG_NOT_FOUND; | 1490 | self->symtab_type != SYMTAB__NOT_FOUND; |
1491 | self->origin++) { | 1491 | self->symtab_type++) { |
1492 | switch (self->origin) { | 1492 | switch (self->symtab_type) { |
1493 | case DSO__ORIG_BUILD_ID_CACHE: | 1493 | case SYMTAB__BUILD_ID_CACHE: |
1494 | /* skip the locally configured cache if a symfs is given */ | 1494 | /* skip the locally configured cache if a symfs is given */ |
1495 | if (symbol_conf.symfs[0] || | 1495 | if (symbol_conf.symfs[0] || |
1496 | (dso__build_id_filename(self, name, size) == NULL)) { | 1496 | (dso__build_id_filename(self, name, size) == NULL)) { |
1497 | continue; | 1497 | continue; |
1498 | } | 1498 | } |
1499 | break; | 1499 | break; |
1500 | case DSO__ORIG_FEDORA: | 1500 | case SYMTAB__FEDORA_DEBUGINFO: |
1501 | snprintf(name, size, "%s/usr/lib/debug%s.debug", | 1501 | snprintf(name, size, "%s/usr/lib/debug%s.debug", |
1502 | symbol_conf.symfs, self->long_name); | 1502 | symbol_conf.symfs, self->long_name); |
1503 | break; | 1503 | break; |
1504 | case DSO__ORIG_UBUNTU: | 1504 | case SYMTAB__UBUNTU_DEBUGINFO: |
1505 | snprintf(name, size, "%s/usr/lib/debug%s", | 1505 | snprintf(name, size, "%s/usr/lib/debug%s", |
1506 | symbol_conf.symfs, self->long_name); | 1506 | symbol_conf.symfs, self->long_name); |
1507 | break; | 1507 | break; |
1508 | case DSO__ORIG_BUILDID: { | 1508 | case SYMTAB__BUILDID_DEBUGINFO: { |
1509 | char build_id_hex[BUILD_ID_SIZE * 2 + 1]; | 1509 | char build_id_hex[BUILD_ID_SIZE * 2 + 1]; |
1510 | 1510 | ||
1511 | if (!self->has_build_id) | 1511 | if (!self->has_build_id) |
@@ -1519,11 +1519,11 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter) | |||
1519 | symbol_conf.symfs, build_id_hex, build_id_hex + 2); | 1519 | symbol_conf.symfs, build_id_hex, build_id_hex + 2); |
1520 | } | 1520 | } |
1521 | break; | 1521 | break; |
1522 | case DSO__ORIG_DSO: | 1522 | case SYMTAB__SYSTEM_PATH_DSO: |
1523 | snprintf(name, size, "%s%s", | 1523 | snprintf(name, size, "%s%s", |
1524 | symbol_conf.symfs, self->long_name); | 1524 | symbol_conf.symfs, self->long_name); |
1525 | break; | 1525 | break; |
1526 | case DSO__ORIG_GUEST_KMODULE: | 1526 | case SYMTAB__GUEST_KMODULE: |
1527 | if (map->groups && machine) | 1527 | if (map->groups && machine) |
1528 | root_dir = machine->root_dir; | 1528 | root_dir = machine->root_dir; |
1529 | else | 1529 | else |
@@ -1532,7 +1532,7 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter) | |||
1532 | root_dir, self->long_name); | 1532 | root_dir, self->long_name); |
1533 | break; | 1533 | break; |
1534 | 1534 | ||
1535 | case DSO__ORIG_KMODULE: | 1535 | case SYMTAB__SYSTEM_PATH_KMODULE: |
1536 | snprintf(name, size, "%s%s", symbol_conf.symfs, | 1536 | snprintf(name, size, "%s%s", symbol_conf.symfs, |
1537 | self->long_name); | 1537 | self->long_name); |
1538 | break; | 1538 | break; |
@@ -1544,7 +1544,7 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter) | |||
1544 | */ | 1544 | */ |
1545 | if (want_symtab) { | 1545 | if (want_symtab) { |
1546 | want_symtab = 0; | 1546 | want_symtab = 0; |
1547 | self->origin = DSO__ORIG_BUILD_ID_CACHE; | 1547 | self->symtab_type = SYMTAB__BUILD_ID_CACHE; |
1548 | } else | 1548 | } else |
1549 | continue; | 1549 | continue; |
1550 | } | 1550 | } |
@@ -1757,9 +1757,9 @@ struct map *machine__new_module(struct machine *self, u64 start, | |||
1757 | return NULL; | 1757 | return NULL; |
1758 | 1758 | ||
1759 | if (machine__is_host(self)) | 1759 | if (machine__is_host(self)) |
1760 | dso->origin = DSO__ORIG_KMODULE; | 1760 | dso->symtab_type = SYMTAB__SYSTEM_PATH_KMODULE; |
1761 | else | 1761 | else |
1762 | dso->origin = DSO__ORIG_GUEST_KMODULE; | 1762 | dso->symtab_type = SYMTAB__GUEST_KMODULE; |
1763 | map_groups__insert(&self->kmaps, map); | 1763 | map_groups__insert(&self->kmaps, map); |
1764 | return map; | 1764 | return map; |
1765 | } | 1765 | } |
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 4d7ed09fe332..713b0b40cc4a 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -48,12 +48,17 @@ char *strxfrchar(char *s, char from, char to); | |||
48 | 48 | ||
49 | #define BUILD_ID_SIZE 20 | 49 | #define BUILD_ID_SIZE 20 |
50 | 50 | ||
51 | /** struct symbol - symtab entry | ||
52 | * | ||
53 | * @ignore - resolvable but tools ignore it (e.g. idle routines) | ||
54 | */ | ||
51 | struct symbol { | 55 | struct symbol { |
52 | struct rb_node rb_node; | 56 | struct rb_node rb_node; |
53 | u64 start; | 57 | u64 start; |
54 | u64 end; | 58 | u64 end; |
55 | u16 namelen; | 59 | u16 namelen; |
56 | u8 binding; | 60 | u8 binding; |
61 | bool ignore; | ||
57 | char name[0]; | 62 | char name[0]; |
58 | }; | 63 | }; |
59 | 64 | ||
@@ -137,7 +142,7 @@ struct dso { | |||
137 | u8 annotate_warned:1; | 142 | u8 annotate_warned:1; |
138 | u8 sname_alloc:1; | 143 | u8 sname_alloc:1; |
139 | u8 lname_alloc:1; | 144 | u8 lname_alloc:1; |
140 | unsigned char origin; | 145 | unsigned char symtab_type; |
141 | u8 sorted_by_name; | 146 | u8 sorted_by_name; |
142 | u8 loaded; | 147 | u8 loaded; |
143 | u8 build_id[BUILD_ID_SIZE]; | 148 | u8 build_id[BUILD_ID_SIZE]; |
@@ -188,18 +193,18 @@ size_t dso__fprintf_buildid(struct dso *self, FILE *fp); | |||
188 | size_t dso__fprintf_symbols_by_name(struct dso *self, enum map_type type, FILE *fp); | 193 | size_t dso__fprintf_symbols_by_name(struct dso *self, enum map_type type, FILE *fp); |
189 | size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp); | 194 | size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp); |
190 | 195 | ||
191 | enum dso_origin { | 196 | enum symtab_type { |
192 | DSO__ORIG_KERNEL = 0, | 197 | SYMTAB__KALLSYMS = 0, |
193 | DSO__ORIG_GUEST_KERNEL, | 198 | SYMTAB__GUEST_KALLSYMS, |
194 | DSO__ORIG_JAVA_JIT, | 199 | SYMTAB__JAVA_JIT, |
195 | DSO__ORIG_BUILD_ID_CACHE, | 200 | SYMTAB__BUILD_ID_CACHE, |
196 | DSO__ORIG_FEDORA, | 201 | SYMTAB__FEDORA_DEBUGINFO, |
197 | DSO__ORIG_UBUNTU, | 202 | SYMTAB__UBUNTU_DEBUGINFO, |
198 | DSO__ORIG_BUILDID, | 203 | SYMTAB__BUILDID_DEBUGINFO, |
199 | DSO__ORIG_DSO, | 204 | SYMTAB__SYSTEM_PATH_DSO, |
200 | DSO__ORIG_GUEST_KMODULE, | 205 | SYMTAB__GUEST_KMODULE, |
201 | DSO__ORIG_KMODULE, | 206 | SYMTAB__SYSTEM_PATH_KMODULE, |
202 | DSO__ORIG_NOT_FOUND, | 207 | SYMTAB__NOT_FOUND, |
203 | }; | 208 | }; |
204 | 209 | ||
205 | char dso__symtab_origin(const struct dso *self); | 210 | char dso__symtab_origin(const struct dso *self); |
diff --git a/tools/perf/util/top.c b/tools/perf/util/top.c index 75cfe4d45119..a11f60735a18 100644 --- a/tools/perf/util/top.c +++ b/tools/perf/util/top.c | |||
@@ -171,7 +171,7 @@ float perf_top__decay_samples(struct perf_top *top, struct rb_root *root) | |||
171 | { | 171 | { |
172 | struct sym_entry *syme, *n; | 172 | struct sym_entry *syme, *n; |
173 | float sum_ksamples = 0.0; | 173 | float sum_ksamples = 0.0; |
174 | int snap = !top->display_weighted ? top->sym_counter : 0, j; | 174 | int snap = !top->display_weighted ? top->sym_evsel->idx : 0, j; |
175 | 175 | ||
176 | /* Sort the active symbols */ | 176 | /* Sort the active symbols */ |
177 | pthread_mutex_lock(&top->active_symbols_lock); | 177 | pthread_mutex_lock(&top->active_symbols_lock); |
@@ -184,9 +184,9 @@ float perf_top__decay_samples(struct perf_top *top, struct rb_root *root) | |||
184 | if (syme->snap_count != 0) { | 184 | if (syme->snap_count != 0) { |
185 | 185 | ||
186 | if ((top->hide_user_symbols && | 186 | if ((top->hide_user_symbols && |
187 | syme->origin == PERF_RECORD_MISC_USER) || | 187 | syme->map->dso->kernel == DSO_TYPE_USER) || |
188 | (top->hide_kernel_symbols && | 188 | (top->hide_kernel_symbols && |
189 | syme->origin == PERF_RECORD_MISC_KERNEL)) { | 189 | syme->map->dso->kernel == DSO_TYPE_KERNEL)) { |
190 | perf_top__remove_active_sym(top, syme); | 190 | perf_top__remove_active_sym(top, syme); |
191 | continue; | 191 | continue; |
192 | } | 192 | } |
diff --git a/tools/perf/util/top.h b/tools/perf/util/top.h index 96d1cb78af01..bfbf95bcc603 100644 --- a/tools/perf/util/top.h +++ b/tools/perf/util/top.h | |||
@@ -16,8 +16,6 @@ struct sym_entry { | |||
16 | struct list_head node; | 16 | struct list_head node; |
17 | unsigned long snap_count; | 17 | unsigned long snap_count; |
18 | double weight; | 18 | double weight; |
19 | int skip; | ||
20 | u8 origin; | ||
21 | struct map *map; | 19 | struct map *map; |
22 | unsigned long count[0]; | 20 | unsigned long count[0]; |
23 | }; | 21 | }; |
@@ -41,7 +39,7 @@ struct perf_top { | |||
41 | u64 exact_samples; | 39 | u64 exact_samples; |
42 | u64 guest_us_samples, guest_kernel_samples; | 40 | u64 guest_us_samples, guest_kernel_samples; |
43 | int print_entries, count_filter, delay_secs; | 41 | int print_entries, count_filter, delay_secs; |
44 | int display_weighted, freq, rb_entries, sym_counter; | 42 | int display_weighted, freq, rb_entries; |
45 | pid_t target_pid, target_tid; | 43 | pid_t target_pid, target_tid; |
46 | bool hide_kernel_symbols, hide_user_symbols, zero; | 44 | bool hide_kernel_symbols, hide_user_symbols, zero; |
47 | const char *cpu_list; | 45 | const char *cpu_list; |
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index d8e622dd738a..0a7ed5b5e281 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c | |||
@@ -2643,68 +2643,13 @@ static void print_lat_fmt(void *data, int size __unused) | |||
2643 | printf("."); | 2643 | printf("."); |
2644 | 2644 | ||
2645 | if (lock_depth < 0) | 2645 | if (lock_depth < 0) |
2646 | printf("."); | 2646 | printf(". "); |
2647 | else | 2647 | else |
2648 | printf("%d", lock_depth); | 2648 | printf("%d ", lock_depth); |
2649 | } | 2649 | } |
2650 | 2650 | ||
2651 | /* taken from Linux, written by Frederic Weisbecker */ | ||
2652 | static void print_graph_cpu(int cpu) | ||
2653 | { | ||
2654 | int i; | ||
2655 | int log10_this = log10_cpu(cpu); | ||
2656 | int log10_all = log10_cpu(cpus); | ||
2657 | |||
2658 | |||
2659 | /* | ||
2660 | * Start with a space character - to make it stand out | ||
2661 | * to the right a bit when trace output is pasted into | ||
2662 | * email: | ||
2663 | */ | ||
2664 | printf(" "); | ||
2665 | |||
2666 | /* | ||
2667 | * Tricky - we space the CPU field according to the max | ||
2668 | * number of online CPUs. On a 2-cpu system it would take | ||
2669 | * a maximum of 1 digit - on a 128 cpu system it would | ||
2670 | * take up to 3 digits: | ||
2671 | */ | ||
2672 | for (i = 0; i < log10_all - log10_this; i++) | ||
2673 | printf(" "); | ||
2674 | |||
2675 | printf("%d) ", cpu); | ||
2676 | } | ||
2677 | |||
2678 | #define TRACE_GRAPH_PROCINFO_LENGTH 14 | ||
2679 | #define TRACE_GRAPH_INDENT 2 | 2651 | #define TRACE_GRAPH_INDENT 2 |
2680 | 2652 | ||
2681 | static void print_graph_proc(int pid, const char *comm) | ||
2682 | { | ||
2683 | /* sign + log10(MAX_INT) + '\0' */ | ||
2684 | char pid_str[11]; | ||
2685 | int spaces = 0; | ||
2686 | int len; | ||
2687 | int i; | ||
2688 | |||
2689 | sprintf(pid_str, "%d", pid); | ||
2690 | |||
2691 | /* 1 stands for the "-" character */ | ||
2692 | len = strlen(comm) + strlen(pid_str) + 1; | ||
2693 | |||
2694 | if (len < TRACE_GRAPH_PROCINFO_LENGTH) | ||
2695 | spaces = TRACE_GRAPH_PROCINFO_LENGTH - len; | ||
2696 | |||
2697 | /* First spaces to align center */ | ||
2698 | for (i = 0; i < spaces / 2; i++) | ||
2699 | printf(" "); | ||
2700 | |||
2701 | printf("%s-%s", comm, pid_str); | ||
2702 | |||
2703 | /* Last spaces to align center */ | ||
2704 | for (i = 0; i < spaces - (spaces / 2); i++) | ||
2705 | printf(" "); | ||
2706 | } | ||
2707 | |||
2708 | static struct record * | 2653 | static struct record * |
2709 | get_return_for_leaf(int cpu, int cur_pid, unsigned long long cur_func, | 2654 | get_return_for_leaf(int cpu, int cur_pid, unsigned long long cur_func, |
2710 | struct record *next) | 2655 | struct record *next) |
@@ -2876,21 +2821,13 @@ static void print_graph_nested(struct event *event, void *data) | |||
2876 | 2821 | ||
2877 | static void | 2822 | static void |
2878 | pretty_print_func_ent(void *data, int size, struct event *event, | 2823 | pretty_print_func_ent(void *data, int size, struct event *event, |
2879 | int cpu, int pid, const char *comm, | 2824 | int cpu, int pid) |
2880 | unsigned long secs, unsigned long usecs) | ||
2881 | { | 2825 | { |
2882 | struct format_field *field; | 2826 | struct format_field *field; |
2883 | struct record *rec; | 2827 | struct record *rec; |
2884 | void *copy_data; | 2828 | void *copy_data; |
2885 | unsigned long val; | 2829 | unsigned long val; |
2886 | 2830 | ||
2887 | printf("%5lu.%06lu | ", secs, usecs); | ||
2888 | |||
2889 | print_graph_cpu(cpu); | ||
2890 | print_graph_proc(pid, comm); | ||
2891 | |||
2892 | printf(" | "); | ||
2893 | |||
2894 | if (latency_format) { | 2831 | if (latency_format) { |
2895 | print_lat_fmt(data, size); | 2832 | print_lat_fmt(data, size); |
2896 | printf(" | "); | 2833 | printf(" | "); |
@@ -2923,22 +2860,13 @@ out_free: | |||
2923 | } | 2860 | } |
2924 | 2861 | ||
2925 | static void | 2862 | static void |
2926 | pretty_print_func_ret(void *data, int size __unused, struct event *event, | 2863 | pretty_print_func_ret(void *data, int size __unused, struct event *event) |
2927 | int cpu, int pid, const char *comm, | ||
2928 | unsigned long secs, unsigned long usecs) | ||
2929 | { | 2864 | { |
2930 | unsigned long long rettime, calltime; | 2865 | unsigned long long rettime, calltime; |
2931 | unsigned long long duration, depth; | 2866 | unsigned long long duration, depth; |
2932 | struct format_field *field; | 2867 | struct format_field *field; |
2933 | int i; | 2868 | int i; |
2934 | 2869 | ||
2935 | printf("%5lu.%06lu | ", secs, usecs); | ||
2936 | |||
2937 | print_graph_cpu(cpu); | ||
2938 | print_graph_proc(pid, comm); | ||
2939 | |||
2940 | printf(" | "); | ||
2941 | |||
2942 | if (latency_format) { | 2870 | if (latency_format) { |
2943 | print_lat_fmt(data, size); | 2871 | print_lat_fmt(data, size); |
2944 | printf(" | "); | 2872 | printf(" | "); |
@@ -2976,31 +2904,21 @@ pretty_print_func_ret(void *data, int size __unused, struct event *event, | |||
2976 | 2904 | ||
2977 | static void | 2905 | static void |
2978 | pretty_print_func_graph(void *data, int size, struct event *event, | 2906 | pretty_print_func_graph(void *data, int size, struct event *event, |
2979 | int cpu, int pid, const char *comm, | 2907 | int cpu, int pid) |
2980 | unsigned long secs, unsigned long usecs) | ||
2981 | { | 2908 | { |
2982 | if (event->flags & EVENT_FL_ISFUNCENT) | 2909 | if (event->flags & EVENT_FL_ISFUNCENT) |
2983 | pretty_print_func_ent(data, size, event, | 2910 | pretty_print_func_ent(data, size, event, cpu, pid); |
2984 | cpu, pid, comm, secs, usecs); | ||
2985 | else if (event->flags & EVENT_FL_ISFUNCRET) | 2911 | else if (event->flags & EVENT_FL_ISFUNCRET) |
2986 | pretty_print_func_ret(data, size, event, | 2912 | pretty_print_func_ret(data, size, event); |
2987 | cpu, pid, comm, secs, usecs); | ||
2988 | printf("\n"); | 2913 | printf("\n"); |
2989 | } | 2914 | } |
2990 | 2915 | ||
2991 | void print_event(int cpu, void *data, int size, unsigned long long nsecs, | 2916 | void print_trace_event(int cpu, void *data, int size) |
2992 | char *comm) | ||
2993 | { | 2917 | { |
2994 | struct event *event; | 2918 | struct event *event; |
2995 | unsigned long secs; | ||
2996 | unsigned long usecs; | ||
2997 | int type; | 2919 | int type; |
2998 | int pid; | 2920 | int pid; |
2999 | 2921 | ||
3000 | secs = nsecs / NSECS_PER_SEC; | ||
3001 | nsecs -= secs * NSECS_PER_SEC; | ||
3002 | usecs = nsecs / NSECS_PER_USEC; | ||
3003 | |||
3004 | type = trace_parse_common_type(data); | 2922 | type = trace_parse_common_type(data); |
3005 | 2923 | ||
3006 | event = trace_find_event(type); | 2924 | event = trace_find_event(type); |
@@ -3012,17 +2930,10 @@ void print_event(int cpu, void *data, int size, unsigned long long nsecs, | |||
3012 | pid = trace_parse_common_pid(data); | 2930 | pid = trace_parse_common_pid(data); |
3013 | 2931 | ||
3014 | if (event->flags & (EVENT_FL_ISFUNCENT | EVENT_FL_ISFUNCRET)) | 2932 | if (event->flags & (EVENT_FL_ISFUNCENT | EVENT_FL_ISFUNCRET)) |
3015 | return pretty_print_func_graph(data, size, event, cpu, | 2933 | return pretty_print_func_graph(data, size, event, cpu, pid); |
3016 | pid, comm, secs, usecs); | ||
3017 | 2934 | ||
3018 | if (latency_format) { | 2935 | if (latency_format) |
3019 | printf("%8.8s-%-5d %3d", | ||
3020 | comm, pid, cpu); | ||
3021 | print_lat_fmt(data, size); | 2936 | print_lat_fmt(data, size); |
3022 | } else | ||
3023 | printf("%16s-%-5d [%03d]", comm, pid, cpu); | ||
3024 | |||
3025 | printf(" %5lu.%06lu: %s: ", secs, usecs, event->name); | ||
3026 | 2937 | ||
3027 | if (event->flags & EVENT_FL_FAILED) { | 2938 | if (event->flags & EVENT_FL_FAILED) { |
3028 | printf("EVENT '%s' FAILED TO PARSE\n", | 2939 | printf("EVENT '%s' FAILED TO PARSE\n", |
@@ -3031,7 +2942,6 @@ void print_event(int cpu, void *data, int size, unsigned long long nsecs, | |||
3031 | } | 2942 | } |
3032 | 2943 | ||
3033 | pretty_print(data, size, event); | 2944 | pretty_print(data, size, event); |
3034 | printf("\n"); | ||
3035 | } | 2945 | } |
3036 | 2946 | ||
3037 | static void print_fields(struct print_flag_sym *field) | 2947 | static void print_fields(struct print_flag_sym *field) |
diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c index f7af2fca965d..66f4b78737ab 100644 --- a/tools/perf/util/trace-event-scripting.c +++ b/tools/perf/util/trace-event-scripting.c | |||
@@ -36,11 +36,10 @@ static int stop_script_unsupported(void) | |||
36 | return 0; | 36 | return 0; |
37 | } | 37 | } |
38 | 38 | ||
39 | static void process_event_unsupported(int cpu __unused, | 39 | static void process_event_unsupported(union perf_event *event __unused, |
40 | void *data __unused, | 40 | struct perf_sample *sample __unused, |
41 | int size __unused, | 41 | struct perf_session *session __unused, |
42 | unsigned long long nsecs __unused, | 42 | struct thread *thread __unused) |
43 | char *comm __unused) | ||
44 | { | 43 | { |
45 | } | 44 | } |
46 | 45 | ||
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h index b5f12ca24d99..b04da5722437 100644 --- a/tools/perf/util/trace-event.h +++ b/tools/perf/util/trace-event.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <stdbool.h> | 4 | #include <stdbool.h> |
5 | #include "parse-events.h" | 5 | #include "parse-events.h" |
6 | #include "session.h" | ||
6 | 7 | ||
7 | #define __unused __attribute__((unused)) | 8 | #define __unused __attribute__((unused)) |
8 | 9 | ||
@@ -176,8 +177,7 @@ void print_printk(void); | |||
176 | 177 | ||
177 | int parse_ftrace_file(char *buf, unsigned long size); | 178 | int parse_ftrace_file(char *buf, unsigned long size); |
178 | int parse_event_file(char *buf, unsigned long size, char *sys); | 179 | int parse_event_file(char *buf, unsigned long size, char *sys); |
179 | void print_event(int cpu, void *data, int size, unsigned long long nsecs, | 180 | void print_trace_event(int cpu, void *data, int size); |
180 | char *comm); | ||
181 | 181 | ||
182 | extern int file_bigendian; | 182 | extern int file_bigendian; |
183 | extern int host_bigendian; | 183 | extern int host_bigendian; |
@@ -278,8 +278,10 @@ struct scripting_ops { | |||
278 | const char *name; | 278 | const char *name; |
279 | int (*start_script) (const char *script, int argc, const char **argv); | 279 | int (*start_script) (const char *script, int argc, const char **argv); |
280 | int (*stop_script) (void); | 280 | int (*stop_script) (void); |
281 | void (*process_event) (int cpu, void *data, int size, | 281 | void (*process_event) (union perf_event *event, |
282 | unsigned long long nsecs, char *comm); | 282 | struct perf_sample *sample, |
283 | struct perf_session *session, | ||
284 | struct thread *thread); | ||
283 | int (*generate_script) (const char *outfile); | 285 | int (*generate_script) (const char *outfile); |
284 | }; | 286 | }; |
285 | 287 | ||