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: <1453643615-1616-12-git-send-email-namhyung@kernel.org>
Date:	Sun, 24 Jan 2016 22:53:34 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:	Ingo Molnar <mingo@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Jiri Olsa <jolsa@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Andi Kleen <andi@...stfloor.org>,
	David Ahern <dsahern@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Wang Nan <wangnan0@...wei.com>
Subject: [PATCH 11/12] perf hists browser: Update percent base for fractal callchain mode

In the fractal callchain mode (CHAIN_GRAPH_REL), the total period is the
period of that node.  Pass the correct value to calculate the percent
when counting the number of callchain rows.

Signed-off-by: Namhyung Kim <namhyung@...nel.org>
---
 tools/perf/ui/browsers/hists.c | 45 ++++++++++++++++++++++++++++++++++++------
 1 file changed, 39 insertions(+), 6 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 3bcd813f65d7..50e62d898e38 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -176,8 +176,15 @@ static int callchain_node__count_rows_rb_tree(struct callchain_node *node, u64 t
 				break;
 		}
 
-		if (folded_sign == '-') /* Have children and they're unfolded */
-			n += callchain_node__count_rows_rb_tree(child, total);
+		if (folded_sign == '-') {
+			/* Have children and they're unfolded */
+			u64 new_total = total;
+
+			if (callchain_param.mode == CHAIN_GRAPH_REL)
+				new_total = child->children_hit;
+
+			n += callchain_node__count_rows_rb_tree(child, new_total);
+		}
 	}
 
 	return n;
@@ -254,6 +261,13 @@ static int callchain__count_rows(struct hist_entry *he)
 	int n = 0;
 	u64 total = hists__total_period(he->hists);
 
+	if (callchain_param.mode == CHAIN_GRAPH_REL) {
+		if (symbol_conf.cumulate_callchain)
+			total = he->stat_acc->period;
+		else
+			total = he->stat.period;
+	}
+
 	chain = &he->sorted_chain;
 	for (nd = rb_first(chain); nd; nd = rb_next(nd)) {
 		struct callchain_node *node = rb_entry(nd, struct callchain_node, rb_node);
@@ -408,9 +422,15 @@ static int callchain_node__set_folding_rb_tree(struct callchain_node *node,
 			has_children = chain->has_children;
 		}
 
-		if (has_children)
+		if (has_children) {
+			u64 new_total = total;
+
+			if (callchain_param.mode == CHAIN_GRAPH_REL)
+				new_total = node->children_hit;
+
 			n += callchain_node__set_folding_rb_tree(child, unfold,
-								 total);
+								 new_total);
+		}
 	}
 
 	return n;
@@ -432,9 +452,15 @@ static int callchain_node__set_folding(struct callchain_node *node, bool unfold,
 		has_children = chain->has_children;
 	}
 
-	if (has_children)
+	if (has_children) {
+		u64 new_total = total;
+
+		if (callchain_param.mode == CHAIN_GRAPH_REL)
+			new_total = node->children_hit;
+
 		n += callchain_node__set_folding_rb_tree(node, unfold,
-							 total);
+							 new_total);
+	}
 
 	return n;
 }
@@ -457,6 +483,13 @@ static int callchain__set_folding(struct rb_root *chain, bool unfold, u64 total)
 static void hist_entry__set_folding(struct hist_entry *he, bool unfold,
 				    u64 total)
 {
+	if (callchain_param.mode == CHAIN_GRAPH_REL) {
+		if (symbol_conf.cumulate_callchain)
+			total = he->stat_acc->period;
+		else
+			total = he->stat.period;
+	}
+
 	hist_entry__init_have_children(he);
 	he->unfolded = unfold ? he->has_children : false;
 
-- 
2.6.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ