aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-report.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-12-16 10:49:27 -0500
committerIngo Molnar <mingo@elte.hu>2009-12-16 10:53:37 -0500
commitc351c2816177eb7d2979ec874b9b895abe9d6e5c (patch)
treeb6dd7fb4a5e048168319111e18082025c2e93f1b /tools/perf/builtin-report.c
parent125c4fad1e60751ceaab1ee2a73bddf31213e5ca (diff)
perf diff: Use perf_session__fprintf_hists just like 'perf record'
That means that almost everything you can do with 'perf report' can be done with 'perf diff', for instance: $ perf record -f find / > /dev/null [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.062 MB perf.data (~2699 samples) ] $ perf record -f find / > /dev/null [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.062 MB perf.data (~2687 samples) ] perf diff | head -8 9.02% +1.00% find libc-2.10.1.so [.] _IO_vfprintf_internal 2.91% -1.00% find [kernel] [k] __kmalloc 2.85% -1.00% find [kernel] [k] ext4_htree_store_dirent 1.99% -1.00% find [kernel] [k] _atomic_dec_and_lock 2.44% find [kernel] [k] half_md4_transform $ So if you want to zoom into libc: $ perf diff --dsos libc-2.10.1.so | head -8 37.34% find [.] _IO_vfprintf_internal 10.34% find [.] __GI_memmove 8.25% +2.00% find [.] _int_malloc 5.07% -1.00% find [.] __GI_mempcpy 7.62% +2.00% find [.] _int_free $ And if there were multiple commands using libc, it is also possible to aggregate them all by using --sort symbol: $ perf diff --dsos libc-2.10.1.so --sort symbol | head -8 37.34% [.] _IO_vfprintf_internal 10.34% [.] __GI_memmove 8.25% +2.00% [.] _int_malloc 5.07% -1.00% [.] __GI_mempcpy 7.62% +2.00% [.] _int_free $ The displacement column now is off by default, to use it: perf diff -m --dsos libc-2.10.1.so --sort symbol | head -8 37.34% [.] _IO_vfprintf_internal 10.34% [.] __GI_memmove 8.25% +2.00% [.] _int_malloc 5.07% -1.00% +2 [.] __GI_mempcpy 7.62% +2.00% -1 [.] _int_free $ Using -t/--field-separator can be used for scripting: $ perf diff -t, -m --dsos libc-2.10.1.so --sort symbol | head -8 37.34, , ,[.] _IO_vfprintf_internal 10.34, , ,[.] __GI_memmove 8.25,+2.00%, ,[.] _int_malloc 5.07,-1.00%, +2,[.] __GI_mempcpy 7.62,+2.00%, -1,[.] _int_free 6.99,+1.00%, -1,[.] _IO_new_file_xsputn 1.89,-2.00%, +4,[.] __readdir64 $ 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: <1260978567-550-1-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r--tools/perf/builtin-report.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index cf1d370f51cb..e50a6b10ee6f 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -225,7 +225,7 @@ static int __cmd_report(void)
225 perf_session__collapse_resort(session); 225 perf_session__collapse_resort(session);
226 perf_session__output_resort(session, session->events_stats.total); 226 perf_session__output_resort(session, session->events_stats.total);
227 fprintf(stdout, "# Samples: %ld\n#\n", session->events_stats.total); 227 fprintf(stdout, "# Samples: %ld\n#\n", session->events_stats.total);
228 perf_session__fprintf_hists(session, stdout); 228 perf_session__fprintf_hists(session, NULL, false, stdout);
229 if (sort_order == default_sort_order && 229 if (sort_order == default_sort_order &&
230 parent_pattern == default_parent_pattern) 230 parent_pattern == default_parent_pattern)
231 fprintf(stdout, "#\n# (For a higher level overview, try: perf report --sort comm,dso)\n#\n"); 231 fprintf(stdout, "#\n# (For a higher level overview, try: perf report --sort comm,dso)\n#\n");
@@ -344,16 +344,6 @@ static const struct option options[] = {
344 OPT_END() 344 OPT_END()
345}; 345};
346 346
347static void sort_entry__setup_elide(struct sort_entry *self,
348 struct strlist *list,
349 const char *list_name, FILE *fp)
350{
351 if (list && strlist__nr_entries(list) == 1) {
352 fprintf(fp, "# %s: %s\n", list_name, strlist__entry(list, 0)->s);
353 self->elide = true;
354 }
355}
356
357int cmd_report(int argc, const char **argv, const char *prefix __used) 347int cmd_report(int argc, const char **argv, const char *prefix __used)
358{ 348{
359 argc = parse_options(argc, argv, options, report_usage, 0); 349 argc = parse_options(argc, argv, options, report_usage, 0);