aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/event.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-12-15 17:04:41 -0500
committerIngo Molnar <mingo@elte.hu>2009-12-16 02:53:49 -0500
commitc410a33887c17cac95ed8b0d860cdfb5c087a7d8 (patch)
tree54fe6ed5ac64ff77763ff686af58bd36b04e73d6 /tools/perf/util/event.c
parent655000e7c75a559681ee7f15f6fa870c80ae3194 (diff)
perf symbols: Move symbol filtering to event__preprocess_sample()
So that --dsos, --comm, --symbols can bem used in more tools, like in perf diff: $ perf record -f find / > /dev/null $ perf record -f find / > /dev/null $ perf diff --dsos /lib64/libc-2.10.1.so | head -5 1 +22392124 /lib64/libc-2.10.1.so _IO_vfprintf_internal 2 +6410655 /lib64/libc-2.10.1.so __GI_memmove 3 +1 +9192692 /lib64/libc-2.10.1.so _int_malloc 4 -1 -15158605 /lib64/libc-2.10.1.so _int_free 5 +45669 /lib64/libc-2.10.1.so _IO_new_file_xsputn $ Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> LKML-Reference: <1260914682-29652-3-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
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