[PATCH 3/3] perfcounter: Display percents of hits in callchain with overhead colors

From: Frederic Weisbecker
Date: Thu Jul 02 2009 - 14:15:52 EST


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@xxxxxxxxx>
---
tools/perf/builtin-report.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index bfca1e4..01902f0 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -819,7 +819,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", " ");
}
@@ -919,7 +919,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,
--
1.6.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/