[PATCH 08/12] perf ui/browser: Add support to group viewing

From: Namhyung Kim
Date: Tue Jul 24 2012 - 05:09:54 EST


From: Namhyung Kim <namhyung.kim@xxxxxxx>

Show group members' overhead also when showing the leader's.

Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/ui/browsers/hists.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 69584d79097e..bdb1b2f9f819 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -553,6 +553,33 @@ static int hist_browser__show_callchain(struct hist_browser *browser,
return row - first_row;
}

+static int hist_browser__hpp_color_overhead(struct hist_print_context *ctx,
+ struct hist_entry *he)
+{
+ int ret;
+ double percent = 100.0 * he->stat.period / ctx->total_period;
+
+ /* the leader determines the color */
+ *(double *)ctx->ptr = percent;
+
+ ret = scnprintf(ctx->s, ctx->size, "%5.2f%%", percent);
+
+ if (symbol_conf.report_group) {
+ struct perf_evsel *evsel = hists_2_evsel(ctx->hists);
+ int i;
+
+ for (i = 0; i < evsel->nr_children; i++) {
+ u64 period = he->group_stats[i].period;
+ u64 total_period = ctx->hists->group_stats[i].total_period;
+
+ percent = 100.0 * period / total_period;
+ ret += scnprintf(ctx->s + ret, ctx->size - ret,
+ " %5.2f%%", percent);
+ }
+ }
+ return ret;
+}
+
#define HPP_COLOR_FN(_name, _field) \
static int hist_browser__hpp_color_ ## _name(struct hist_print_context *ctx, \
struct hist_entry *he) \
@@ -562,7 +589,6 @@ static int hist_browser__hpp_color_ ## _name(struct hist_print_context *ctx, \
return scnprintf(ctx->s, ctx->size, "%5.2f%%", percent); \
}

-HPP_COLOR_FN(overhead, period)
HPP_COLOR_FN(overhead_sys, period_sys)
HPP_COLOR_FN(overhead_us, period_us)
HPP_COLOR_FN(overhead_guest_sys, period_guest_sys)
--
1.7.10.4

--
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/