Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1315905

[PATCH 08/12] perf hists browser: Apply callchain percent limit

From Namhyung Kim <namhyung@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 08/12] perf hists browser: Apply callchain percent limit
Date 2016-01-24 15:00 +0100
Message-ID <qUtmX-5A8-27@gated-at.bofh.it> (permalink)
References <qUtmW-5A8-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Currently 'perf report --tui' misses to check percent limit on
callchains.  Fix it.

Reported-by: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/ui/browsers/hists.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index c7ca36dae89f..3d64a6573d0c 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -681,6 +681,14 @@ static int hist_browser__show_callchain_flat(struct hist_browser *browser,
 		char folded_sign = ' ';
 		int first = true;
 		int extra_offset = 0;
+		double percent;
+		u64 hits;
+
+		hits = callchain_cumul_hits(child);
+		percent = 100.0 * hits / total;
+
+		if (percent < callchain_param.min_percent)
+			goto next;
 
 		list_for_each_entry(chain, &child->parent_val, list) {
 			bool was_first = first;
@@ -784,12 +792,20 @@ static int hist_browser__show_callchain_folded(struct hist_browser *browser,
 		int first = true;
 		char *value_str = NULL, *value_str_alloc = NULL;
 		char *chain_str = NULL, *chain_str_alloc = NULL;
+		double percent;
+		u64 hits;
 
 		if (arg->row_offset != 0) {
 			arg->row_offset--;
 			goto next;
 		}
 
+		hits = callchain_cumul_hits(child);
+		percent = 100.0 * hits / total;
+
+		if (percent < callchain_param.min_percent)
+			goto next;
+
 		if (need_percent) {
 			char buf[64];
 
@@ -869,6 +885,14 @@ static int hist_browser__show_callchain_graph(struct hist_browser *browser,
 		char folded_sign = ' ';
 		int first = true;
 		int extra_offset = 0;
+		double percent;
+		u64 hits;
+
+		hits = callchain_cumul_hits(child);
+		percent = 100.0 * hits / total;
+
+		if (percent < callchain_param.min_percent)
+			goto next;
 
 		list_for_each_entry(chain, &child->val, list) {
 			bool was_first = first;
@@ -905,6 +929,7 @@ static int hist_browser__show_callchain_graph(struct hist_browser *browser,
 							    new_level, row, new_total,
 							    print, arg, is_output_full);
 		}
+next:
 		if (is_output_full(browser, row))
 			break;
 		node = next;
-- 
2.6.4

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 08/12] perf hists browser: Apply callchain percent limit Namhyung Kim <namhyung@kernel.org> - 2016-01-24 15:00 +0100

csiph-web