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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1347520811-28150-13-git-send-email-namhyung@kernel.org>
Date:	Thu, 13 Sep 2012 16:20:08 +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>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Arun Sharma <asharma@...com>, David Ahern <dsahern@...il.com>,
	Jiri Olsa <jolsa@...hat.com>,
	Namhyung Kim <namhyung.kim@....com>
Subject: [PATCH 12/15] perf ui/hist: Add support to accumulated hist stat

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

Print accumulated stat of a hist entry if requested.

Cc: Arun Sharma <asharma@...com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Signed-off-by: Namhyung Kim <namhyung@...nel.org>
---
 tools/perf/ui/hist.c | 46 ++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 44 insertions(+), 2 deletions(-)

diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index d6ddeb10e678..7bf2999d2d17 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -22,6 +22,9 @@ static int hpp__color_overhead(struct perf_hpp *hpp, struct hist_entry *he)
 {
 	double percent = 100.0 * he->stat.period / hpp->total_period;
 
+	if (symbol_conf.cumulate_callchain)
+		percent = 100.0 * he->stat_acc->period / hpp->total_period;
+
 	if (hpp->ptr) {
 		struct hists *old_hists = hpp->ptr;
 		u64 total_period = old_hists->stats.total_period;
@@ -41,6 +44,9 @@ static int hpp__entry_overhead(struct perf_hpp *hpp, struct hist_entry *he)
 	double percent = 100.0 * he->stat.period / hpp->total_period;
 	const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%%";
 
+	if (symbol_conf.cumulate_callchain)
+		percent = 100.0 * he->stat_acc->period / hpp->total_period;
+
 	if (hpp->ptr) {
 		struct hists *old_hists = hpp->ptr;
 		u64 total_period = old_hists->stats.total_period;
@@ -70,6 +76,10 @@ static int hpp__width_overhead_sys(struct perf_hpp *hpp __maybe_unused)
 static int hpp__color_overhead_sys(struct perf_hpp *hpp, struct hist_entry *he)
 {
 	double percent = 100.0 * he->stat.period_sys / hpp->total_period;
+
+	if (symbol_conf.cumulate_callchain)
+		percent = 100.0 * he->stat_acc->period_sys / hpp->total_period;
+
 	return percent_color_snprintf(hpp->buf, hpp->size, "%6.2f%%", percent);
 }
 
@@ -78,6 +88,9 @@ static int hpp__entry_overhead_sys(struct perf_hpp *hpp, struct hist_entry *he)
 	double percent = 100.0 * he->stat.period_sys / hpp->total_period;
 	const char *fmt = symbol_conf.field_sep ? "%.2f" : "%6.2f%%";
 
+	if (symbol_conf.cumulate_callchain)
+		percent = 100.0 * he->stat_acc->period_sys / hpp->total_period;
+
 	return scnprintf(hpp->buf, hpp->size, fmt, percent);
 }
 
@@ -96,6 +109,10 @@ static int hpp__width_overhead_us(struct perf_hpp *hpp __maybe_unused)
 static int hpp__color_overhead_us(struct perf_hpp *hpp, struct hist_entry *he)
 {
 	double percent = 100.0 * he->stat.period_us / hpp->total_period;
+
+	if (symbol_conf.cumulate_callchain)
+		percent = 100.0 * he->stat_acc->period_us / hpp->total_period;
+
 	return percent_color_snprintf(hpp->buf, hpp->size, "%6.2f%%", percent);
 }
 
@@ -104,6 +121,9 @@ static int hpp__entry_overhead_us(struct perf_hpp *hpp, struct hist_entry *he)
 	double percent = 100.0 * he->stat.period_us / hpp->total_period;
 	const char *fmt = symbol_conf.field_sep ? "%.2f" : "%6.2f%%";
 
+	if (symbol_conf.cumulate_callchain)
+		percent = 100.0 * he->stat_acc->period_us / hpp->total_period;
+
 	return scnprintf(hpp->buf, hpp->size, fmt, percent);
 }
 
@@ -121,6 +141,10 @@ static int hpp__color_overhead_guest_sys(struct perf_hpp *hpp,
 					 struct hist_entry *he)
 {
 	double percent = 100.0 * he->stat.period_guest_sys / hpp->total_period;
+
+	if (symbol_conf.cumulate_callchain)
+		percent = 100.0 * he->stat_acc->period_guest_sys / hpp->total_period;
+
 	return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%% ", percent);
 }
 
@@ -130,6 +154,9 @@ static int hpp__entry_overhead_guest_sys(struct perf_hpp *hpp,
 	double percent = 100.0 * he->stat.period_guest_sys / hpp->total_period;
 	const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%% ";
 
+	if (symbol_conf.cumulate_callchain)
+		percent = 100.0 * he->stat_acc->period_guest_sys / hpp->total_period;
+
 	return scnprintf(hpp->buf, hpp->size, fmt, percent);
 }
 
@@ -147,6 +174,10 @@ static int hpp__color_overhead_guest_us(struct perf_hpp *hpp,
 					struct hist_entry *he)
 {
 	double percent = 100.0 * he->stat.period_guest_us / hpp->total_period;
+
+	if (symbol_conf.cumulate_callchain)
+		percent = 100.0 * he->stat_acc->period_guest_us / hpp->total_period;
+
 	return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%% ", percent);
 }
 
@@ -156,6 +187,9 @@ static int hpp__entry_overhead_guest_us(struct perf_hpp *hpp,
 	double percent = 100.0 * he->stat.period_guest_us / hpp->total_period;
 	const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%% ";
 
+	if (symbol_conf.cumulate_callchain)
+		percent = 100.0 * he->stat_acc->period_guest_us / hpp->total_period;
+
 	return scnprintf(hpp->buf, hpp->size, fmt, percent);
 }
 
@@ -174,8 +208,12 @@ static int hpp__width_samples(struct perf_hpp *hpp __maybe_unused)
 static int hpp__entry_samples(struct perf_hpp *hpp, struct hist_entry *he)
 {
 	const char *fmt = symbol_conf.field_sep ? "%" PRIu64 : "%11" PRIu64;
+	u64 samples = he->stat.nr_events;
 
-	return scnprintf(hpp->buf, hpp->size, fmt, he->stat.nr_events);
+	if (symbol_conf.cumulate_callchain)
+		samples = he->stat_acc->nr_events;
+
+	return scnprintf(hpp->buf, hpp->size, fmt, samples);
 }
 
 static int hpp__header_period(struct perf_hpp *hpp)
@@ -193,8 +231,12 @@ static int hpp__width_period(struct perf_hpp *hpp __maybe_unused)
 static int hpp__entry_period(struct perf_hpp *hpp, struct hist_entry *he)
 {
 	const char *fmt = symbol_conf.field_sep ? "%" PRIu64 : "%12" PRIu64;
+	u64 period = he->stat.period;
+
+	if (symbol_conf.cumulate_callchain)
+		period = he->stat_acc->period;
 
-	return scnprintf(hpp->buf, hpp->size, fmt, he->stat.period);
+	return scnprintf(hpp->buf, hpp->size, fmt, period);
 }
 
 static int hpp__header_delta(struct perf_hpp *hpp)
-- 
1.7.11.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