aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/hist.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-03-12 10:46:48 -0500
committerIngo Molnar <mingo@elte.hu>2010-03-12 14:31:53 -0500
commit3997d3776a6e89586e76a0ef355bfbbd8a76966c (patch)
treeed0456b210e3d806430ff9c6699c69404a6337a0 /tools/perf/util/hist.c
parentcb7afb7092bc502b890f0a897ffd67c2b078d347 (diff)
perf hist: Don't fprintf the callgraph unconditionally
[root@doppio ~]# perf report -i newt.data | head -10 # Samples: 11999679868 # # Overhead Command Shared Object Symbol # ........ ....... ............................. ...... # 63.61% perf libslang.so.2.1.4 [.] SLsmg_write_chars 6.30% perf perf [.] symbols__find 2.19% perf libnewt.so.0.52.10 [.] newtListboxAppendEntry 2.08% perf libslang.so.2.1.4 [.] SLsmg_write_chars@plt 1.99% perf libc-2.10.2.so [.] _IO_vfprintf_internal [root@doppio ~]# Not good, the newt form for report works, but slang has to eat the cost of the additional callgraph lines everytime it prints a line, and the callgraph doesn't appear on the screen, so move the callgraph printing to a separate function and don't use it in newt.c. Newt tree widgets are being investigated to properly support callgraphs, but till that gets merged, lets remove this huge overhead and show at least the symbol overheads for a callgraph rich perf.data with good performance. 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: <1268408808-13595-2-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/hist.c')
-rw-r--r--tools/perf/util/hist.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index d43be344a889..1a4e8376d843 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -532,23 +532,23 @@ size_t hist_entry__fprintf(struct hist_entry *self,
532 ret += se->print(fp, self, se->width ? *se->width : 0); 532 ret += se->print(fp, self, se->width ? *se->width : 0);
533 } 533 }
534 534
535 ret += fprintf(fp, "\n"); 535 return ret + fprintf(fp, "\n");
536 536}
537 if (symbol_conf.use_callchain) {
538 int left_margin = 0;
539 537
540 if (sort__first_dimension == SORT_COMM) { 538static size_t hist_entry__fprintf_callchain(struct hist_entry *self, FILE *fp,
541 se = list_first_entry(&hist_entry__sort_list, typeof(*se), 539 u64 session_total)
542 list); 540{
543 left_margin = se->width ? *se->width : 0; 541 int left_margin = 0;
544 left_margin -= thread__comm_len(self->thread);
545 }
546 542
547 ret += hist_entry_callchain__fprintf(fp, self, session_total, 543 if (sort__first_dimension == SORT_COMM) {
548 left_margin); 544 struct sort_entry *se = list_first_entry(&hist_entry__sort_list,
545 typeof(*se), list);
546 left_margin = se->width ? *se->width : 0;
547 left_margin -= thread__comm_len(self->thread);
549 } 548 }
550 549
551 return ret; 550 return hist_entry_callchain__fprintf(fp, self, session_total,
551 left_margin);
552} 552}
553 553
554size_t perf_session__fprintf_hists(struct rb_root *hists, 554size_t perf_session__fprintf_hists(struct rb_root *hists,
@@ -655,6 +655,10 @@ print_entries:
655 } 655 }
656 ret += hist_entry__fprintf(h, pair, show_displacement, 656 ret += hist_entry__fprintf(h, pair, show_displacement,
657 displacement, fp, session_total); 657 displacement, fp, session_total);
658
659 if (symbol_conf.use_callchain)
660 ret += hist_entry__fprintf_callchain(h, fp, session_total);
661
658 if (h->map == NULL && verbose > 1) { 662 if (h->map == NULL && verbose > 1) {
659 __map_groups__fprintf_maps(&h->thread->mg, 663 __map_groups__fprintf_maps(&h->thread->mg,
660 MAP__FUNCTION, fp); 664 MAP__FUNCTION, fp);