aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/event.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/event.c')
-rw-r--r--tools/perf/util/event.c368
1 files changed, 277 insertions, 91 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 705ec63548b4..50771b5813ee 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -7,6 +7,23 @@
7#include "strlist.h" 7#include "strlist.h"
8#include "thread.h" 8#include "thread.h"
9 9
10const char *event__name[] = {
11 [0] = "TOTAL",
12 [PERF_RECORD_MMAP] = "MMAP",
13 [PERF_RECORD_LOST] = "LOST",
14 [PERF_RECORD_COMM] = "COMM",
15 [PERF_RECORD_EXIT] = "EXIT",
16 [PERF_RECORD_THROTTLE] = "THROTTLE",
17 [PERF_RECORD_UNTHROTTLE] = "UNTHROTTLE",
18 [PERF_RECORD_FORK] = "FORK",
19 [PERF_RECORD_READ] = "READ",
20 [PERF_RECORD_SAMPLE] = "SAMPLE",
21 [PERF_RECORD_HEADER_ATTR] = "ATTR",
22 [PERF_RECORD_HEADER_EVENT_TYPE] = "EVENT_TYPE",
23 [PERF_RECORD_HEADER_TRACING_DATA] = "TRACING_DATA",
24 [PERF_RECORD_HEADER_BUILD_ID] = "BUILD_ID",
25};
26
10static pid_t event__synthesize_comm(pid_t pid, int full, 27static pid_t event__synthesize_comm(pid_t pid, int full,
11 event__handler_t process, 28 event__handler_t process,
12 struct perf_session *session) 29 struct perf_session *session)
@@ -112,7 +129,11 @@ static int event__synthesize_mmap_events(pid_t pid, pid_t tgid,
112 event_t ev = { 129 event_t ev = {
113 .header = { 130 .header = {
114 .type = PERF_RECORD_MMAP, 131 .type = PERF_RECORD_MMAP,
115 .misc = 0, /* Just like the kernel, see kernel/perf_event.c __perf_event_mmap */ 132 /*
133 * Just like the kernel, see __perf_event_mmap
134 * in kernel/perf_event.c
135 */
136 .misc = PERF_RECORD_MISC_USER,
116 }, 137 },
117 }; 138 };
118 int n; 139 int n;
@@ -130,6 +151,7 @@ static int event__synthesize_mmap_events(pid_t pid, pid_t tgid,
130 continue; 151 continue;
131 pbf += n + 3; 152 pbf += n + 3;
132 if (*pbf == 'x') { /* vm_exec */ 153 if (*pbf == 'x') { /* vm_exec */
154 u64 vm_pgoff;
133 char *execname = strchr(bf, '/'); 155 char *execname = strchr(bf, '/');
134 156
135 /* Catch VDSO */ 157 /* Catch VDSO */
@@ -139,6 +161,14 @@ static int event__synthesize_mmap_events(pid_t pid, pid_t tgid,
139 if (execname == NULL) 161 if (execname == NULL)
140 continue; 162 continue;
141 163
164 pbf += 3;
165 n = hex2u64(pbf, &vm_pgoff);
166 /* pgoff is in bytes, not pages */
167 if (n >= 0)
168 ev.mmap.pgoff = vm_pgoff << getpagesize();
169 else
170 ev.mmap.pgoff = 0;
171
142 size = strlen(execname); 172 size = strlen(execname);
143 execname[size - 1] = '\0'; /* Remove \n */ 173 execname[size - 1] = '\0'; /* Remove \n */
144 memcpy(ev.mmap.filename, execname, size); 174 memcpy(ev.mmap.filename, execname, size);
@@ -158,11 +188,23 @@ static int event__synthesize_mmap_events(pid_t pid, pid_t tgid,
158} 188}
159 189
160int event__synthesize_modules(event__handler_t process, 190int event__synthesize_modules(event__handler_t process,
161 struct perf_session *session) 191 struct perf_session *session,
192 struct machine *machine)
162{ 193{
163 struct rb_node *nd; 194 struct rb_node *nd;
195 struct map_groups *kmaps = &machine->kmaps;
196 u16 misc;
197
198 /*
199 * kernel uses 0 for user space maps, see kernel/perf_event.c
200 * __perf_event_mmap
201 */
202 if (machine__is_host(machine))
203 misc = PERF_RECORD_MISC_KERNEL;
204 else
205 misc = PERF_RECORD_MISC_GUEST_KERNEL;
164 206
165 for (nd = rb_first(&session->kmaps.maps[MAP__FUNCTION]); 207 for (nd = rb_first(&kmaps->maps[MAP__FUNCTION]);
166 nd; nd = rb_next(nd)) { 208 nd; nd = rb_next(nd)) {
167 event_t ev; 209 event_t ev;
168 size_t size; 210 size_t size;
@@ -173,12 +215,13 @@ int event__synthesize_modules(event__handler_t process,
173 215
174 size = ALIGN(pos->dso->long_name_len + 1, sizeof(u64)); 216 size = ALIGN(pos->dso->long_name_len + 1, sizeof(u64));
175 memset(&ev, 0, sizeof(ev)); 217 memset(&ev, 0, sizeof(ev));
176 ev.mmap.header.misc = 1; /* kernel uses 0 for user space maps, see kernel/perf_event.c __perf_event_mmap */ 218 ev.mmap.header.misc = misc;
177 ev.mmap.header.type = PERF_RECORD_MMAP; 219 ev.mmap.header.type = PERF_RECORD_MMAP;
178 ev.mmap.header.size = (sizeof(ev.mmap) - 220 ev.mmap.header.size = (sizeof(ev.mmap) -
179 (sizeof(ev.mmap.filename) - size)); 221 (sizeof(ev.mmap.filename) - size));
180 ev.mmap.start = pos->start; 222 ev.mmap.start = pos->start;
181 ev.mmap.len = pos->end - pos->start; 223 ev.mmap.len = pos->end - pos->start;
224 ev.mmap.pid = machine->pid;
182 225
183 memcpy(ev.mmap.filename, pos->dso->long_name, 226 memcpy(ev.mmap.filename, pos->dso->long_name,
184 pos->dso->long_name_len + 1); 227 pos->dso->long_name_len + 1);
@@ -241,13 +284,18 @@ static int find_symbol_cb(void *arg, const char *name, char type, u64 start)
241 284
242int event__synthesize_kernel_mmap(event__handler_t process, 285int event__synthesize_kernel_mmap(event__handler_t process,
243 struct perf_session *session, 286 struct perf_session *session,
287 struct machine *machine,
244 const char *symbol_name) 288 const char *symbol_name)
245{ 289{
246 size_t size; 290 size_t size;
291 const char *filename, *mmap_name;
292 char path[PATH_MAX];
293 char name_buff[PATH_MAX];
294 struct map *map;
295
247 event_t ev = { 296 event_t ev = {
248 .header = { 297 .header = {
249 .type = PERF_RECORD_MMAP, 298 .type = PERF_RECORD_MMAP,
250 .misc = 1, /* kernel uses 0 for user space maps, see kernel/perf_event.c __perf_event_mmap */
251 }, 299 },
252 }; 300 };
253 /* 301 /*
@@ -257,16 +305,37 @@ int event__synthesize_kernel_mmap(event__handler_t process,
257 */ 305 */
258 struct process_symbol_args args = { .name = symbol_name, }; 306 struct process_symbol_args args = { .name = symbol_name, };
259 307
260 if (kallsyms__parse("/proc/kallsyms", &args, find_symbol_cb) <= 0) 308 mmap_name = machine__mmap_name(machine, name_buff, sizeof(name_buff));
309 if (machine__is_host(machine)) {
310 /*
311 * kernel uses PERF_RECORD_MISC_USER for user space maps,
312 * see kernel/perf_event.c __perf_event_mmap
313 */
314 ev.header.misc = PERF_RECORD_MISC_KERNEL;
315 filename = "/proc/kallsyms";
316 } else {
317 ev.header.misc = PERF_RECORD_MISC_GUEST_KERNEL;
318 if (machine__is_default_guest(machine))
319 filename = (char *) symbol_conf.default_guest_kallsyms;
320 else {
321 sprintf(path, "%s/proc/kallsyms", machine->root_dir);
322 filename = path;
323 }
324 }
325
326 if (kallsyms__parse(filename, &args, find_symbol_cb) <= 0)
261 return -ENOENT; 327 return -ENOENT;
262 328
329 map = machine->vmlinux_maps[MAP__FUNCTION];
263 size = snprintf(ev.mmap.filename, sizeof(ev.mmap.filename), 330 size = snprintf(ev.mmap.filename, sizeof(ev.mmap.filename),
264 "[kernel.kallsyms.%s]", symbol_name) + 1; 331 "%s%s", mmap_name, symbol_name) + 1;
265 size = ALIGN(size, sizeof(u64)); 332 size = ALIGN(size, sizeof(u64));
266 ev.mmap.header.size = (sizeof(ev.mmap) - (sizeof(ev.mmap.filename) - size)); 333 ev.mmap.header.size = (sizeof(ev.mmap) -
334 (sizeof(ev.mmap.filename) - size));
267 ev.mmap.pgoff = args.start; 335 ev.mmap.pgoff = args.start;
268 ev.mmap.start = session->vmlinux_maps[MAP__FUNCTION]->start; 336 ev.mmap.start = map->start;
269 ev.mmap.len = session->vmlinux_maps[MAP__FUNCTION]->end - ev.mmap.start ; 337 ev.mmap.len = map->end - ev.mmap.start;
338 ev.mmap.pid = machine->pid;
270 339
271 return process(&ev, session); 340 return process(&ev, session);
272} 341}
@@ -316,26 +385,54 @@ int event__process_comm(event_t *self, struct perf_session *session)
316int event__process_lost(event_t *self, struct perf_session *session) 385int event__process_lost(event_t *self, struct perf_session *session)
317{ 386{
318 dump_printf(": id:%Ld: lost:%Ld\n", self->lost.id, self->lost.lost); 387 dump_printf(": id:%Ld: lost:%Ld\n", self->lost.id, self->lost.lost);
319 session->events_stats.lost += self->lost.lost; 388 session->hists.stats.total_lost += self->lost.lost;
320 return 0; 389 return 0;
321} 390}
322 391
323int event__process_mmap(event_t *self, struct perf_session *session) 392static void event_set_kernel_mmap_len(struct map **maps, event_t *self)
393{
394 maps[MAP__FUNCTION]->start = self->mmap.start;
395 maps[MAP__FUNCTION]->end = self->mmap.start + self->mmap.len;
396 /*
397 * Be a bit paranoid here, some perf.data file came with
398 * a zero sized synthesized MMAP event for the kernel.
399 */
400 if (maps[MAP__FUNCTION]->end == 0)
401 maps[MAP__FUNCTION]->end = ~0UL;
402}
403
404static int event__process_kernel_mmap(event_t *self,
405 struct perf_session *session)
324{ 406{
325 struct thread *thread;
326 struct map *map; 407 struct map *map;
408 char kmmap_prefix[PATH_MAX];
409 struct machine *machine;
410 enum dso_kernel_type kernel_type;
411 bool is_kernel_mmap;
412
413 machine = perf_session__findnew_machine(session, self->mmap.pid);
414 if (!machine) {
415 pr_err("Can't find id %d's machine\n", self->mmap.pid);
416 goto out_problem;
417 }
327 418
328 dump_printf(" %d/%d: [%#Lx(%#Lx) @ %#Lx]: %s\n", 419 machine__mmap_name(machine, kmmap_prefix, sizeof(kmmap_prefix));
329 self->mmap.pid, self->mmap.tid, self->mmap.start, 420 if (machine__is_host(machine))
330 self->mmap.len, self->mmap.pgoff, self->mmap.filename); 421 kernel_type = DSO_TYPE_KERNEL;
422 else
423 kernel_type = DSO_TYPE_GUEST_KERNEL;
331 424
332 if (self->mmap.pid == 0) { 425 is_kernel_mmap = memcmp(self->mmap.filename,
333 static const char kmmap_prefix[] = "[kernel.kallsyms."; 426 kmmap_prefix,
427 strlen(kmmap_prefix)) == 0;
428 if (self->mmap.filename[0] == '/' ||
429 (!is_kernel_mmap && self->mmap.filename[0] == '[')) {
334 430
335 if (self->mmap.filename[0] == '/') { 431 char short_module_name[1024];
336 char short_module_name[1024]; 432 char *name, *dot;
337 char *name = strrchr(self->mmap.filename, '/'), *dot;
338 433
434 if (self->mmap.filename[0] == '/') {
435 name = strrchr(self->mmap.filename, '/');
339 if (name == NULL) 436 if (name == NULL)
340 goto out_problem; 437 goto out_problem;
341 438
@@ -343,58 +440,84 @@ int event__process_mmap(event_t *self, struct perf_session *session)
343 dot = strrchr(name, '.'); 440 dot = strrchr(name, '.');
344 if (dot == NULL) 441 if (dot == NULL)
345 goto out_problem; 442 goto out_problem;
346
347 snprintf(short_module_name, sizeof(short_module_name), 443 snprintf(short_module_name, sizeof(short_module_name),
348 "[%.*s]", (int)(dot - name), name); 444 "[%.*s]", (int)(dot - name), name);
349 strxfrchar(short_module_name, '-', '_'); 445 strxfrchar(short_module_name, '-', '_');
350 446 } else
351 map = perf_session__new_module_map(session, 447 strcpy(short_module_name, self->mmap.filename);
352 self->mmap.start, 448
353 self->mmap.filename); 449 map = machine__new_module(machine, self->mmap.start,
354 if (map == NULL) 450 self->mmap.filename);
355 goto out_problem; 451 if (map == NULL)
356 452 goto out_problem;
357 name = strdup(short_module_name); 453
358 if (name == NULL) 454 name = strdup(short_module_name);
359 goto out_problem; 455 if (name == NULL)
360 456 goto out_problem;
361 map->dso->short_name = name; 457
362 map->end = map->start + self->mmap.len; 458 map->dso->short_name = name;
363 } else if (memcmp(self->mmap.filename, kmmap_prefix, 459 map->end = map->start + self->mmap.len;
364 sizeof(kmmap_prefix) - 1) == 0) { 460 } else if (is_kernel_mmap) {
365 const char *symbol_name = (self->mmap.filename + 461 const char *symbol_name = (self->mmap.filename +
366 sizeof(kmmap_prefix) - 1); 462 strlen(kmmap_prefix));
463 /*
464 * Should be there already, from the build-id table in
465 * the header.
466 */
467 struct dso *kernel = __dsos__findnew(&machine->kernel_dsos,
468 kmmap_prefix);
469 if (kernel == NULL)
470 goto out_problem;
471
472 kernel->kernel = kernel_type;
473 if (__machine__create_kernel_maps(machine, kernel) < 0)
474 goto out_problem;
475
476 event_set_kernel_mmap_len(machine->vmlinux_maps, self);
477 perf_session__set_kallsyms_ref_reloc_sym(machine->vmlinux_maps,
478 symbol_name,
479 self->mmap.pgoff);
480 if (machine__is_default_guest(machine)) {
367 /* 481 /*
368 * Should be there already, from the build-id table in 482 * preload dso of guest kernel and modules
369 * the header.
370 */ 483 */
371 struct dso *kernel = __dsos__findnew(&dsos__kernel, 484 dso__load(kernel, machine->vmlinux_maps[MAP__FUNCTION],
372 "[kernel.kallsyms]"); 485 NULL);
373 if (kernel == NULL) 486 }
374 goto out_problem; 487 }
375 488 return 0;
376 kernel->kernel = 1; 489out_problem:
377 if (__perf_session__create_kernel_maps(session, kernel) < 0) 490 return -1;
378 goto out_problem; 491}
379 492
380 session->vmlinux_maps[MAP__FUNCTION]->start = self->mmap.start; 493int event__process_mmap(event_t *self, struct perf_session *session)
381 session->vmlinux_maps[MAP__FUNCTION]->end = self->mmap.start + self->mmap.len; 494{
382 /* 495 struct machine *machine;
383 * Be a bit paranoid here, some perf.data file came with 496 struct thread *thread;
384 * a zero sized synthesized MMAP event for the kernel. 497 struct map *map;
385 */ 498 u8 cpumode = self->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
386 if (session->vmlinux_maps[MAP__FUNCTION]->end == 0) 499 int ret = 0;
387 session->vmlinux_maps[MAP__FUNCTION]->end = ~0UL;
388 500
389 perf_session__set_kallsyms_ref_reloc_sym(session, symbol_name, 501 dump_printf(" %d/%d: [%#Lx(%#Lx) @ %#Lx]: %s\n",
390 self->mmap.pgoff); 502 self->mmap.pid, self->mmap.tid, self->mmap.start,
391 } 503 self->mmap.len, self->mmap.pgoff, self->mmap.filename);
504
505 if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL ||
506 cpumode == PERF_RECORD_MISC_KERNEL) {
507 ret = event__process_kernel_mmap(self, session);
508 if (ret < 0)
509 goto out_problem;
392 return 0; 510 return 0;
393 } 511 }
394 512
513 machine = perf_session__find_host_machine(session);
514 if (machine == NULL)
515 goto out_problem;
395 thread = perf_session__findnew(session, self->mmap.pid); 516 thread = perf_session__findnew(session, self->mmap.pid);
396 map = map__new(&self->mmap, MAP__FUNCTION, 517 map = map__new(&machine->user_dsos, self->mmap.start,
397 session->cwd, session->cwdlen); 518 self->mmap.len, self->mmap.pgoff,
519 self->mmap.pid, self->mmap.filename,
520 MAP__FUNCTION, session->cwd, session->cwdlen);
398 521
399 if (thread == NULL || map == NULL) 522 if (thread == NULL || map == NULL)
400 goto out_problem; 523 goto out_problem;
@@ -434,22 +557,56 @@ int event__process_task(event_t *self, struct perf_session *session)
434 557
435void thread__find_addr_map(struct thread *self, 558void thread__find_addr_map(struct thread *self,
436 struct perf_session *session, u8 cpumode, 559 struct perf_session *session, u8 cpumode,
437 enum map_type type, u64 addr, 560 enum map_type type, pid_t pid, u64 addr,
438 struct addr_location *al) 561 struct addr_location *al)
439{ 562{
440 struct map_groups *mg = &self->mg; 563 struct map_groups *mg = &self->mg;
564 struct machine *machine = NULL;
441 565
442 al->thread = self; 566 al->thread = self;
443 al->addr = addr; 567 al->addr = addr;
568 al->cpumode = cpumode;
569 al->filtered = false;
444 570
445 if (cpumode == PERF_RECORD_MISC_KERNEL) { 571 if (cpumode == PERF_RECORD_MISC_KERNEL && perf_host) {
446 al->level = 'k'; 572 al->level = 'k';
447 mg = &session->kmaps; 573 machine = perf_session__find_host_machine(session);
448 } else if (cpumode == PERF_RECORD_MISC_USER) 574 if (machine == NULL) {
575 al->map = NULL;
576 return;
577 }
578 mg = &machine->kmaps;
579 } else if (cpumode == PERF_RECORD_MISC_USER && perf_host) {
449 al->level = '.'; 580 al->level = '.';
450 else { 581 machine = perf_session__find_host_machine(session);
451 al->level = 'H'; 582 } else if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL && perf_guest) {
583 al->level = 'g';
584 machine = perf_session__find_machine(session, pid);
585 if (machine == NULL) {
586 al->map = NULL;
587 return;
588 }
589 mg = &machine->kmaps;
590 } else {
591 /*
592 * 'u' means guest os user space.
593 * TODO: We don't support guest user space. Might support late.
594 */
595 if (cpumode == PERF_RECORD_MISC_GUEST_USER && perf_guest)
596 al->level = 'u';
597 else
598 al->level = 'H';
452 al->map = NULL; 599 al->map = NULL;
600
601 if ((cpumode == PERF_RECORD_MISC_GUEST_USER ||
602 cpumode == PERF_RECORD_MISC_GUEST_KERNEL) &&
603 !perf_guest)
604 al->filtered = true;
605 if ((cpumode == PERF_RECORD_MISC_USER ||
606 cpumode == PERF_RECORD_MISC_KERNEL) &&
607 !perf_host)
608 al->filtered = true;
609
453 return; 610 return;
454 } 611 }
455try_again: 612try_again:
@@ -464,8 +621,10 @@ try_again:
464 * "[vdso]" dso, but for now lets use the old trick of looking 621 * "[vdso]" dso, but for now lets use the old trick of looking
465 * in the whole kernel symbol list. 622 * in the whole kernel symbol list.
466 */ 623 */
467 if ((long long)al->addr < 0 && mg != &session->kmaps) { 624 if ((long long)al->addr < 0 &&
468 mg = &session->kmaps; 625 cpumode == PERF_RECORD_MISC_KERNEL &&
626 machine && mg != &machine->kmaps) {
627 mg = &machine->kmaps;
469 goto try_again; 628 goto try_again;
470 } 629 }
471 } else 630 } else
@@ -474,11 +633,11 @@ try_again:
474 633
475void thread__find_addr_location(struct thread *self, 634void thread__find_addr_location(struct thread *self,
476 struct perf_session *session, u8 cpumode, 635 struct perf_session *session, u8 cpumode,
477 enum map_type type, u64 addr, 636 enum map_type type, pid_t pid, u64 addr,
478 struct addr_location *al, 637 struct addr_location *al,
479 symbol_filter_t filter) 638 symbol_filter_t filter)
480{ 639{
481 thread__find_addr_map(self, session, cpumode, type, addr, al); 640 thread__find_addr_map(self, session, cpumode, type, pid, addr, al);
482 if (al->map != NULL) 641 if (al->map != NULL)
483 al->sym = map__find_symbol(al->map, al->addr, filter); 642 al->sym = map__find_symbol(al->map, al->addr, filter);
484 else 643 else
@@ -490,8 +649,10 @@ static void dso__calc_col_width(struct dso *self)
490 if (!symbol_conf.col_width_list_str && !symbol_conf.field_sep && 649 if (!symbol_conf.col_width_list_str && !symbol_conf.field_sep &&
491 (!symbol_conf.dso_list || 650 (!symbol_conf.dso_list ||
492 strlist__has_entry(symbol_conf.dso_list, self->name))) { 651 strlist__has_entry(symbol_conf.dso_list, self->name))) {
493 unsigned int slen = strlen(self->name); 652 u16 slen = self->short_name_len;
494 if (slen > dsos__col_width) 653 if (verbose)
654 slen = self->long_name_len;
655 if (dsos__col_width < slen)
495 dsos__col_width = slen; 656 dsos__col_width = slen;
496 } 657 }
497 658
@@ -512,31 +673,55 @@ int event__preprocess_sample(const event_t *self, struct perf_session *session,
512 goto out_filtered; 673 goto out_filtered;
513 674
514 dump_printf(" ... thread: %s:%d\n", thread->comm, thread->pid); 675 dump_printf(" ... thread: %s:%d\n", thread->comm, thread->pid);
676 /*
677 * Have we already created the kernel maps for the host machine?
678 *
679 * This should have happened earlier, when we processed the kernel MMAP
680 * events, but for older perf.data files there was no such thing, so do
681 * it now.
682 */
683 if (cpumode == PERF_RECORD_MISC_KERNEL &&
684 session->host_machine.vmlinux_maps[MAP__FUNCTION] == NULL)
685 machine__create_kernel_maps(&session->host_machine);
515 686
516 thread__find_addr_location(thread, session, cpumode, MAP__FUNCTION, 687 thread__find_addr_map(thread, session, cpumode, MAP__FUNCTION,
517 self->ip.ip, al, filter); 688 self->ip.pid, self->ip.ip, al);
518 dump_printf(" ...... dso: %s\n", 689 dump_printf(" ...... dso: %s\n",
519 al->map ? al->map->dso->long_name : 690 al->map ? al->map->dso->long_name :
520 al->level == 'H' ? "[hypervisor]" : "<not found>"); 691 al->level == 'H' ? "[hypervisor]" : "<not found>");
521 /* 692 al->sym = NULL;
522 * We have to do this here as we may have a dso with no symbol hit that 693
523 * has a name longer than the ones with symbols sampled. 694 if (al->map) {
524 */ 695 if (symbol_conf.dso_list &&
525 if (al->map && !sort_dso.elide && !al->map->dso->slen_calculated) 696 (!al->map || !al->map->dso ||
526 dso__calc_col_width(al->map->dso); 697 !(strlist__has_entry(symbol_conf.dso_list,
527 698 al->map->dso->short_name) ||
528 if (symbol_conf.dso_list && 699 (al->map->dso->short_name != al->map->dso->long_name &&
529 (!al->map || !al->map->dso || 700 strlist__has_entry(symbol_conf.dso_list,
530 !(strlist__has_entry(symbol_conf.dso_list, al->map->dso->short_name) || 701 al->map->dso->long_name)))))
531 (al->map->dso->short_name != al->map->dso->long_name && 702 goto out_filtered;
532 strlist__has_entry(symbol_conf.dso_list, al->map->dso->long_name))))) 703 /*
533 goto out_filtered; 704 * We have to do this here as we may have a dso with no symbol
705 * hit that has a name longer than the ones with symbols
706 * sampled.
707 */
708 if (!sort_dso.elide && !al->map->dso->slen_calculated)
709 dso__calc_col_width(al->map->dso);
710
711 al->sym = map__find_symbol(al->map, al->addr, filter);
712 } else {
713 const unsigned int unresolved_col_width = BITS_PER_LONG / 4;
714
715 if (dsos__col_width < unresolved_col_width &&
716 !symbol_conf.col_width_list_str && !symbol_conf.field_sep &&
717 !symbol_conf.dso_list)
718 dsos__col_width = unresolved_col_width;
719 }
534 720
535 if (symbol_conf.sym_list && al->sym && 721 if (symbol_conf.sym_list && al->sym &&
536 !strlist__has_entry(symbol_conf.sym_list, al->sym->name)) 722 !strlist__has_entry(symbol_conf.sym_list, al->sym->name))
537 goto out_filtered; 723 goto out_filtered;
538 724
539 al->filtered = false;
540 return 0; 725 return 0;
541 726
542out_filtered: 727out_filtered:
@@ -570,6 +755,7 @@ int event__parse_sample(event_t *event, u64 type, struct sample_data *data)
570 array++; 755 array++;
571 } 756 }
572 757
758 data->id = -1ULL;
573 if (type & PERF_SAMPLE_ID) { 759 if (type & PERF_SAMPLE_ID) {
574 data->id = *array; 760 data->id = *array;
575 array++; 761 array++;