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.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 375fb6dca1cf..bf491fda1f47 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -2,7 +2,9 @@
2#include "event.h" 2#include "event.h"
3#include "debug.h" 3#include "debug.h"
4#include "session.h" 4#include "session.h"
5#include "sort.h"
5#include "string.h" 6#include "string.h"
7#include "strlist.h"
6#include "thread.h" 8#include "thread.h"
7 9
8static pid_t event__synthesize_comm(pid_t pid, int full, 10static pid_t event__synthesize_comm(pid_t pid, int full,
@@ -299,6 +301,19 @@ try_again:
299 } 301 }
300} 302}
301 303
304static void dso__calc_col_width(struct dso *self)
305{
306 if (!symbol_conf.col_width_list_str && !symbol_conf.field_sep &&
307 (!symbol_conf.dso_list ||
308 strlist__has_entry(symbol_conf.dso_list, self->name))) {
309 unsigned int slen = strlen(self->name);
310 if (slen > dsos__col_width)
311 dsos__col_width = slen;
312 }
313
314 self->slen_calculated = 1;
315}
316
302int event__preprocess_sample(const event_t *self, struct perf_session *session, 317int event__preprocess_sample(const event_t *self, struct perf_session *session,
303 struct addr_location *al, symbol_filter_t filter) 318 struct addr_location *al, symbol_filter_t filter)
304{ 319{
@@ -308,6 +323,10 @@ int event__preprocess_sample(const event_t *self, struct perf_session *session,
308 if (thread == NULL) 323 if (thread == NULL)
309 return -1; 324 return -1;
310 325
326 if (symbol_conf.comm_list &&
327 !strlist__has_entry(symbol_conf.comm_list, thread->comm))
328 goto out_filtered;
329
311 dump_printf(" ... thread: %s:%d\n", thread->comm, thread->pid); 330 dump_printf(" ... thread: %s:%d\n", thread->comm, thread->pid);
312 331
313 thread__find_addr_location(thread, session, cpumode, MAP__FUNCTION, 332 thread__find_addr_location(thread, session, cpumode, MAP__FUNCTION,
@@ -315,6 +334,29 @@ int event__preprocess_sample(const event_t *self, struct perf_session *session,
315 dump_printf(" ...... dso: %s\n", 334 dump_printf(" ...... dso: %s\n",
316 al->map ? al->map->dso->long_name : 335 al->map ? al->map->dso->long_name :
317 al->level == 'H' ? "[hypervisor]" : "<not found>"); 336 al->level == 'H' ? "[hypervisor]" : "<not found>");
337 /*
338 * We have to do this here as we may have a dso with no symbol hit that
339 * has a name longer than the ones with symbols sampled.
340 */
341 if (al->map && !sort_dso.elide && !al->map->dso->slen_calculated)
342 dso__calc_col_width(al->map->dso);
343
344 if (symbol_conf.dso_list &&
345 (!al->map || !al->map->dso ||
346 !(strlist__has_entry(symbol_conf.dso_list, al->map->dso->short_name) ||
347 (al->map->dso->short_name != al->map->dso->long_name &&
348 strlist__has_entry(symbol_conf.dso_list, al->map->dso->long_name)))))
349 goto out_filtered;
350
351 if (symbol_conf.sym_list && al->sym &&
352 !strlist__has_entry(symbol_conf.sym_list, al->sym->name))
353 goto out_filtered;
354
355 al->filtered = false;
356 return 0;
357
358out_filtered:
359 al->filtered = true;
318 return 0; 360 return 0;
319} 361}
320 362