perf_counter tools: Display percents of hits in callchain with overhead colors
authorFrederic Weisbecker <fweisbec@gmail.com>
Thu, 2 Jul 2009 18:14:35 +0000 (20:14 +0200)
committerIngo Molnar <mingo@elte.hu>
Thu, 2 Jul 2009 19:38:38 +0000 (21:38 +0200)
This adds the use of colors to signal at a glance the important
overhead thresholds in callchains hit rates.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Anton Blanchard <anton@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <1246558475-10624-3-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
tools/perf/builtin-report.c

index c9dbe33154973030f3dfb2d0e26359b161e6b2f2..283773d91aa048f1ef0e9737f3033a9e9c2dcf82 100644 (file)
@@ -824,7 +824,7 @@ ipchain__fprintf_graph(FILE *fp, struct callchain_list *chain, int depth,
                        double percent;
 
                        percent = hits * 100.0 / total_samples;
-                       ret += fprintf(fp, "--%2.2f%%-- ", percent);
+                       ret += percent_color_fprintf(fp, "--%2.2f%%-- ", percent);
                } else
                        ret += fprintf(fp, "%s", "          ");
        }
@@ -924,7 +924,8 @@ hist_entry_callchain__fprintf(FILE *fp, struct hist_entry *self,
                chain = rb_entry(rb_node, struct callchain_node, rb_node);
                percent = chain->hit * 100.0 / total_samples;
                if (callchain_mode == FLAT) {
-                       ret += fprintf(fp, "           %6.2f%%\n", percent);
+                       ret += percent_color_fprintf(fp, "           %6.2f%%\n",
+                                                    percent);
                        ret += callchain__fprintf_flat(fp, chain, total_samples);
                } else if (callchain_mode == GRAPH) {
                        ret += callchain__fprintf_graph(fp, chain,