lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1343120493-23059-10-git-send-email-namhyung@kernel.org>
Date:	Tue, 24 Jul 2012 18:01:30 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc:	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Paul Mackerras <paulus@...ba.org>,
	Ingo Molnar <mingo@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Stephane Eranian <eranian@...gle.com>,
	Jiri Olsa <jolsa@...hat.com>,
	Ulrich Drepper <drepper@...il.com>,
	Andi Kleen <andi@...stfloor.org>,
	Namhyung Kim <namhyung.kim@....com>,
	Pekka Enberg <penberg@...nel.org>
Subject: [PATCH 09/12] perf ui/gtk: Add support to group viewing

From: Namhyung Kim <namhyung.kim@....com>

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

Cc: Stephane Eranian <eranian@...gle.com>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Pekka Enberg <penberg@...nel.org>
Signed-off-by: Namhyung Kim <namhyung@...nel.org>
---
 tools/perf/ui/gtk/browser.c |   57 +++++++++++++++++++++++++++++++++----------
 1 file changed, 44 insertions(+), 13 deletions(-)

diff --git a/tools/perf/ui/gtk/browser.c b/tools/perf/ui/gtk/browser.c
index 91e11f7bffbf..e39c83cd5ac5 100644
--- a/tools/perf/ui/gtk/browser.c
+++ b/tools/perf/ui/gtk/browser.c
@@ -44,25 +44,56 @@ static const char *perf_gtk__get_percent_color(double percent)
 	return NULL;
 }
 
+static int perf_gtk__percent_color_snprintf(char *s, size_t size,
+					    u64 period, u64 total_period)
+{
+	double percent = 100.0 * period / total_period;
+	const char *markup;
+	int ret = 0;
+
+	markup = perf_gtk__get_percent_color(percent);
+	if (markup)
+		ret += scnprintf(s, size, "%s", markup);
+
+	ret += scnprintf(s + ret, size - ret, "%5.2f%%", percent);
+
+	if (markup)
+		ret += scnprintf(s + ret, size - ret, "</span>");
+
+	return ret;
+}
+
+static int perf_gtk__hpp_color_overhead(struct hist_print_context *ctx,
+					struct hist_entry *he)
+{
+	int ret;
+
+	ret = perf_gtk__percent_color_snprintf(ctx->s, ctx->size,
+					he->stat.period, ctx->total_period);
+
+	if (symbol_conf.report_group) {
+		int i;
+		struct perf_evsel *evsel = hists_2_evsel(ctx->hists);
+
+		for (i = 0; i < evsel->nr_children; i++) {
+			ret += scnprintf(ctx->s + ret, ctx->size - ret, "  ");
+			ret += perf_gtk__percent_color_snprintf(ctx->s + ret,
+					ctx->size - ret,
+					he->group_stats[i].period,
+					ctx->hists->group_stats[i].total_period);
+		}
+	}
+	return ret;
+}
+
 #define HPP_COLOR_FN(_name, _field)						\
 static int perf_gtk__hpp_color_ ## _name(struct hist_print_context *ctx,	\
 					 struct hist_entry *he)			\
 {										\
-	double percent = 100.0 * he->stat._field / ctx->total_period;		\
-	const char *markup;							\
-	int ret = 0;								\
-										\
-	markup = perf_gtk__get_percent_color(percent);				\
-	if (markup)								\
-		ret += scnprintf(ctx->s, ctx->size, "%s", markup);		\
-	ret += scnprintf(ctx->s + ret, ctx->size - ret, "%5.2f%%", percent); 	\
-	if (markup)								\
-		ret += scnprintf(ctx->s + ret, ctx->size - ret, "</span>"); 	\
-										\
-	return ret;								\
+	return perf_gtk__percent_color_snprintf(ctx->s, ctx->size,		\
+					he->stat._field, ctx->total_period); 	\
 }
 
-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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ