diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-12-15 23:04:41 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-16 08:53:49 +0100 |
commit | c410a33887c17cac95ed8b0d860cdfb5c087a7d8 (patch) | |
tree | 54fe6ed5ac64ff77763ff686af58bd36b04e73d6 /tools/perf/builtin-diff.c | |
parent | perf symbols: Adopt the strlists for dso, comm (diff) | |
download | linux-c410a33887c17cac95ed8b0d860cdfb5c087a7d8.tar.xz linux-c410a33887c17cac95ed8b0d860cdfb5c087a7d8.zip |
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/builtin-diff.c')
-rw-r--r-- | tools/perf/builtin-diff.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 4fde60655341..ff91e9c291bb 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -50,6 +50,9 @@ static int diff__process_sample_event(event_t *event, struct perf_session *sessi return -1; } + if (al.filtered) + return 0; + event__parse_sample(event, session->sample_type, &data); if (al.sym && perf_session__add_hist_entry(session, &al, data.period)) { @@ -182,10 +185,14 @@ blank: memset(displacement, ' ', sizeof(displacement)); printed = fprintf(fp, "%4lu %5.5s ", pos, displacement); if (show_percent) { - double old_percent = (old_count * 100) / pair_session->events_stats.total, - new_percent = (self->count * 100) / session->events_stats.total; - double diff = old_percent - new_percent; + double old_percent = 0, new_percent = 0, diff; + + if (pair_session->events_stats.total > 0) + old_percent = (old_count * 100) / pair_session->events_stats.total; + if (session->events_stats.total > 0) + new_percent = (self->count * 100) / session->events_stats.total; + diff = old_percent - new_percent; if (verbose) printed += fprintf(fp, " %3.2f%% %3.2f%%", old_percent, new_percent); @@ -260,6 +267,12 @@ static const struct option options[] = { "Don't shorten the pathnames taking into account the cwd"), OPT_BOOLEAN('P', "full-paths", &event_ops.full_paths, "Don't shorten the pathnames taking into account the cwd"), + OPT_STRING('d', "dsos", &symbol_conf.dso_list_str, "dso[,dso...]", + "only consider symbols in these dsos"), + OPT_STRING('C', "comms", &symbol_conf.comm_list_str, "comm[,comm...]", + "only consider symbols in these comms"), + OPT_STRING('S', "symbols", &symbol_conf.sym_list_str, "symbol[,symbol...]", + "only consider these symbols"), OPT_END() }; |