linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHSET 00/12] perf tools: Apply percent-limit to callchains
@ 2016-01-24 13:53 Namhyung Kim
  2016-01-24 13:53 ` [PATCH 01/12] perf report: Apply --percent-limit to callchains also Namhyung Kim
                   ` (13 more replies)
  0 siblings, 14 replies; 28+ messages in thread
From: Namhyung Kim @ 2016-01-24 13:53 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Andi Kleen,
	David Ahern, Frederic Weisbecker, Wang Nan

Hello,

This patchset tries to implement percent limit to callchains which was
requested by Andi Kleen.  For some reason, limiting callchains by
(overhead) percentage didn't work well.  This patch fixes it and make
--percent-limit also works for callchains as well as hist entries.

This is available on 'perf/callchain-limit-v1' branch in my tree:

  git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git

Any comments are welcome,

Thanks,
Namhyung


Namhyung Kim (12):
  perf report: Apply --percent-limit to callchains also
  perf report: Apply callchain percent limit on --stdio
  perf report: Get rid of hist_entry__callchain_fprintf()
  perf report: Fix percent calculation on --stdio
  perf report: Hide output pipe for percent-limited callchains on stdio
  perf hists browser: Fix dump to show correct callchain style
  perf hists browser: Fix callchain_node__count_rows()
  perf hists browser: Apply callchain percent limit
  perf hists browser: Fix callchain counting when press ENTER key
  perf hists browser: Fix counting callchains when expand/collapse all
  perf hists browser: Update percent base for fractal callchain mode
  perf report: Fix callchain percent limit on --gtk

 tools/perf/builtin-report.c    |   9 +-
 tools/perf/ui/browsers/hists.c | 221 ++++++++++++++++++++++++++++++-----------
 tools/perf/ui/gtk/hists.c      |  15 +++
 tools/perf/ui/stdio/hist.c     |  74 ++++++++------
 4 files changed, 229 insertions(+), 90 deletions(-)

-- 
2.6.4

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 01/12] perf report: Apply --percent-limit to callchains also
  2016-01-24 13:53 [PATCHSET 00/12] perf tools: Apply percent-limit to callchains Namhyung Kim
@ 2016-01-24 13:53 ` Namhyung Kim
  2016-01-24 13:53 ` [PATCH 02/12] perf report: Apply callchain percent limit on --stdio Namhyung Kim
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Namhyung Kim @ 2016-01-24 13:53 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Andi Kleen,
	David Ahern, Frederic Weisbecker, Wang Nan

Currently --percent-limit option only works for hist entries.  However
it'd be better to have same effect to callchains as well

Requested-by: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/builtin-report.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 7b933a9cf84f..7fabcf28a392 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -75,7 +75,10 @@ static int report__config(const char *var, const char *value, void *cb)
 		return 0;
 	}
 	if (!strcmp(var, "report.percent-limit")) {
-		rep->min_percent = strtof(value, NULL);
+		double pcnt = strtof(value, NULL);
+
+		rep->min_percent = pcnt;
+		callchain_param.min_percent = pcnt;
 		return 0;
 	}
 	if (!strcmp(var, "report.children")) {
@@ -641,8 +644,10 @@ parse_percent_limit(const struct option *opt, const char *str,
 		    int unset __maybe_unused)
 {
 	struct report *rep = opt->value;
+	double pcnt = strtof(str, NULL);
 
-	rep->min_percent = strtof(str, NULL);
+	rep->min_percent = pcnt;
+	callchain_param.min_percent = pcnt;
 	return 0;
 }
 
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 02/12] perf report: Apply callchain percent limit on --stdio
  2016-01-24 13:53 [PATCHSET 00/12] perf tools: Apply percent-limit to callchains Namhyung Kim
  2016-01-24 13:53 ` [PATCH 01/12] perf report: Apply --percent-limit to callchains also Namhyung Kim
@ 2016-01-24 13:53 ` Namhyung Kim
  2016-01-24 13:53 ` [PATCH 03/12] perf report: Get rid of hist_entry__callchain_fprintf() Namhyung Kim
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Namhyung Kim @ 2016-01-24 13:53 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Andi Kleen,
	David Ahern, Frederic Weisbecker, Wang Nan

Currently 'perf report --stdio' missed to check percent limit of
callchains.  Fix it.

Reported-by: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/ui/stdio/hist.c | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 387110d50b00..905286ec754c 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -96,12 +96,19 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct rb_root *root,
 	while (node) {
 		u64 new_total;
 		u64 cumul;
+		double percent = 0.0;
 
 		child = rb_entry(node, struct callchain_node, rb_node);
 		cumul = callchain_cumul_hits(child);
 		remaining -= cumul;
 		cumul_count += callchain_cumul_counts(child);
 
+		next = rb_next(node);
+
+		percent = 100.0 * cumul / total_samples;
+		if (percent < callchain_param.min_percent)
+			goto next;
+
 		/*
 		 * The depth mask manages the output of pipes that show
 		 * the depth. We don't want to keep the pipes of the current
@@ -109,7 +116,6 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct rb_root *root,
 		 * Except if we have remaining filtered hits. They will
 		 * supersede the last child
 		 */
-		next = rb_next(node);
 		if (!next && (callchain_param.mode != CHAIN_GRAPH_REL || !remaining))
 			new_depth_mask &= ~(1 << (depth - 1));
 
@@ -136,9 +142,11 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct rb_root *root,
 						  depth + 1,
 						  new_depth_mask | (1 << depth),
 						  left_margin);
-		node = next;
+
 		if (++entries_printed == callchain_param.print_limit)
 			break;
+next:
+		node = next;
 	}
 
 	if (callchain_param.mode == CHAIN_GRAPH_REL &&
@@ -250,10 +258,18 @@ static size_t callchain__fprintf_flat(FILE *fp, struct rb_root *tree,
 	u32 entries_printed = 0;
 	struct callchain_node *chain;
 	struct rb_node *rb_node = rb_first(tree);
+	double percent;
+	u64 hits;
 
 	while (rb_node) {
 		chain = rb_entry(rb_node, struct callchain_node, rb_node);
 
+		hits = callchain_cumul_hits(chain);
+		percent = 100.0 * hits / total_samples;
+
+		if (percent < callchain_param.min_percent)
+			goto next;
+
 		ret += fprintf(fp, "           ");
 		ret += callchain_node__fprintf_value(chain, fp, total_samples);
 		ret += fprintf(fp, "\n");
@@ -261,7 +277,7 @@ static size_t callchain__fprintf_flat(FILE *fp, struct rb_root *tree,
 		ret += fprintf(fp, "\n");
 		if (++entries_printed == callchain_param.print_limit)
 			break;
-
+next:
 		rb_node = rb_next(rb_node);
 	}
 
@@ -301,18 +317,26 @@ static size_t callchain__fprintf_folded(FILE *fp, struct rb_root *tree,
 	u32 entries_printed = 0;
 	struct callchain_node *chain;
 	struct rb_node *rb_node = rb_first(tree);
+	double percent;
+	u64 hits;
 
 	while (rb_node) {
 
 		chain = rb_entry(rb_node, struct callchain_node, rb_node);
 
+		hits = callchain_cumul_hits(chain);
+		percent = 100.0 * hits / total_samples;
+
+		if (percent < callchain_param.min_percent)
+			goto next;
+
 		ret += callchain_node__fprintf_value(chain, fp, total_samples);
 		ret += fprintf(fp, " ");
 		ret += __callchain__fprintf_folded(fp, chain);
 		ret += fprintf(fp, "\n");
 		if (++entries_printed == callchain_param.print_limit)
 			break;
-
+next:
 		rb_node = rb_next(rb_node);
 	}
 
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 03/12] perf report: Get rid of hist_entry__callchain_fprintf()
  2016-01-24 13:53 [PATCHSET 00/12] perf tools: Apply percent-limit to callchains Namhyung Kim
  2016-01-24 13:53 ` [PATCH 01/12] perf report: Apply --percent-limit to callchains also Namhyung Kim
  2016-01-24 13:53 ` [PATCH 02/12] perf report: Apply callchain percent limit on --stdio Namhyung Kim
@ 2016-01-24 13:53 ` Namhyung Kim
  2016-01-24 13:53 ` [PATCH 04/12] perf report: Fix percent calculation on --stdio Namhyung Kim
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Namhyung Kim @ 2016-01-24 13:53 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Andi Kleen,
	David Ahern, Frederic Weisbecker, Wang Nan

It's just a wrapper function to align the start position ofcallchains to
'comm' of each thread if it's a first sort key.  But it doesn't not work
with tracepoint events and also with upcoming hierarchy view.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/ui/stdio/hist.c | 27 ++-------------------------
 1 file changed, 2 insertions(+), 25 deletions(-)

diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 905286ec754c..51f26f03de9e 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -373,30 +373,6 @@ static size_t hist_entry_callchain__fprintf(struct hist_entry *he,
 	return 0;
 }
 
-static size_t hist_entry__callchain_fprintf(struct hist_entry *he,
-					    struct hists *hists,
-					    FILE *fp)
-{
-	int left_margin = 0;
-	u64 total_period = hists->stats.total_period;
-
-	if (field_order == NULL && (sort_order == NULL ||
-				    !prefixcmp(sort_order, "comm"))) {
-		struct perf_hpp_fmt *fmt;
-
-		perf_hpp__for_each_format(fmt) {
-			if (!perf_hpp__is_sort_entry(fmt))
-				continue;
-
-			/* must be 'comm' sort entry */
-			left_margin = fmt->width(fmt, NULL, hists_to_evsel(hists));
-			left_margin -= thread__comm_len(he->thread);
-			break;
-		}
-	}
-	return hist_entry_callchain__fprintf(he, total_period, left_margin, fp);
-}
-
 static int hist_entry__snprintf(struct hist_entry *he, struct perf_hpp *hpp)
 {
 	const char *sep = symbol_conf.field_sep;
@@ -442,6 +418,7 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size,
 		.buf		= bf,
 		.size		= size,
 	};
+	u64 total_period = hists->stats.total_period;
 
 	if (size == 0 || size > bfsz)
 		size = hpp.size = bfsz;
@@ -451,7 +428,7 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size,
 	ret = fprintf(fp, "%s\n", bf);
 
 	if (symbol_conf.use_callchain)
-		ret += hist_entry__callchain_fprintf(he, hists, fp);
+		ret += hist_entry_callchain__fprintf(he, total_period, 0, fp);
 
 	return ret;
 }
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 04/12] perf report: Fix percent calculation on --stdio
  2016-01-24 13:53 [PATCHSET 00/12] perf tools: Apply percent-limit to callchains Namhyung Kim
                   ` (2 preceding siblings ...)
  2016-01-24 13:53 ` [PATCH 03/12] perf report: Get rid of hist_entry__callchain_fprintf() Namhyung Kim
@ 2016-01-24 13:53 ` Namhyung Kim
  2016-01-24 13:53 ` [PATCH 05/12] perf report: Hide output pipe for percent-limited callchains on stdio Namhyung Kim
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Namhyung Kim @ 2016-01-24 13:53 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Andi Kleen,
	David Ahern, Frederic Weisbecker, Wang Nan

The hists' total period should be calculated by hists__total_period()
function in order to take account into filterings.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/ui/stdio/hist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 51f26f03de9e..7bf05e82766f 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -418,7 +418,7 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size,
 		.buf		= bf,
 		.size		= size,
 	};
-	u64 total_period = hists->stats.total_period;
+	u64 total_period = hists__total_period(hists);
 
 	if (size == 0 || size > bfsz)
 		size = hpp.size = bfsz;
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 05/12] perf report: Hide output pipe for percent-limited callchains on stdio
  2016-01-24 13:53 [PATCHSET 00/12] perf tools: Apply percent-limit to callchains Namhyung Kim
                   ` (3 preceding siblings ...)
  2016-01-24 13:53 ` [PATCH 04/12] perf report: Fix percent calculation on --stdio Namhyung Kim
@ 2016-01-24 13:53 ` Namhyung Kim
  2016-01-24 13:53 ` [PATCH 06/12] perf hists browser: Fix dump to show correct callchain style Namhyung Kim
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Namhyung Kim @ 2016-01-24 13:53 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Andi Kleen,
	David Ahern, Frederic Weisbecker, Wang Nan

The output of callchains on stdio shows pipes to display callchain depth
and continuation.  But if --percent-limit option is given, it should
take it into account so that it can omit unnecessary pipes on the last
callchain node.

For example, when 0.03 percent limit is given:

Before)

  $ perf report --stdio --percent-limit 0.03
  ...
       0.06%  sleep    [kernel.vmlinux]  [k] kmem_cache_alloc_trace
              |
              ---kmem_cache_alloc_trace
                 perf_event_mmap
                 |
                 |--0.04%--mmap_region
                 |          do_mmap_pgoff
                 |          vm_mmap_pgoff

                ^^^
		here

It's because there's a node which has 0.02% of overhead but it's now
shown due to the percent limit.  After applying this patch,

After)

  $ perf report --stdio --percent-limit 0.03
  ...
       0.06%  sleep    [kernel.vmlinux]  [k] kmem_cache_alloc_trace
              |
              ---kmem_cache_alloc_trace
                 perf_event_mmap
                 |
                  --0.04%--mmap_region
                            do_mmap_pgoff
                            vm_mmap_pgoff

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/ui/stdio/hist.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 7bf05e82766f..eae25efa684e 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -120,6 +120,21 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct rb_root *root,
 			new_depth_mask &= ~(1 << (depth - 1));
 
 		/*
+		 * If the next node is under percent limit, remaining
+		 * callchains won't be shown.  So no need to keep the pipes.
+		 */
+		if (next) {
+			struct callchain_node *next_child;
+
+			next_child = rb_entry(next, struct callchain_node, rb_node);
+			cumul = callchain_cumul_counts(next_child);
+			percent = 100.0 * cumul / total_samples;
+
+			if (percent < callchain_param.min_percent)
+				new_depth_mask &= ~(1 << (depth - 1));
+		}
+
+		/*
 		 * But we keep the older depth mask for the line separator
 		 * to keep the level link until we reach the last child
 		 */
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 06/12] perf hists browser: Fix dump to show correct callchain style
  2016-01-24 13:53 [PATCHSET 00/12] perf tools: Apply percent-limit to callchains Namhyung Kim
                   ` (4 preceding siblings ...)
  2016-01-24 13:53 ` [PATCH 05/12] perf report: Hide output pipe for percent-limited callchains on stdio Namhyung Kim
@ 2016-01-24 13:53 ` Namhyung Kim
  2016-01-24 13:53 ` [PATCH 07/12] perf hists browser: Fix callchain_node__count_rows() Namhyung Kim
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Namhyung Kim @ 2016-01-24 13:53 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Andi Kleen,
	David Ahern, Frederic Weisbecker, Wang Nan

The commit 8c430a348699 ("perf hists browser: Support folded
callchains") missed to update hist_browser__dump() so it always shows
graph-style callchains regardless of current setting.

To fix that, factor out callchain printing code and renamethe existing
function which prints graph-style callchain.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/ui/browsers/hists.c | 73 ++++++++++++++++++++++++------------------
 1 file changed, 41 insertions(+), 32 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 0affffeed89c..349c5de73287 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -844,7 +844,7 @@ next:
 	return row - first_row;
 }
 
-static int hist_browser__show_callchain(struct hist_browser *browser,
+static int hist_browser__show_callchain_graph(struct hist_browser *browser,
 					struct rb_root *root, int level,
 					unsigned short row, u64 total,
 					print_callchain_entry_fn print,
@@ -898,7 +898,7 @@ static int hist_browser__show_callchain(struct hist_browser *browser,
 			else
 				new_total = total;
 
-			row += hist_browser__show_callchain(browser, &child->rb_root,
+			row += hist_browser__show_callchain_graph(browser, &child->rb_root,
 							    new_level, row, new_total,
 							    print, arg, is_output_full);
 		}
@@ -910,6 +910,43 @@ out:
 	return row - first_row;
 }
 
+static int hist_browser__show_callchain(struct hist_browser *browser,
+					struct hist_entry *entry, int level,
+					unsigned short row,
+					print_callchain_entry_fn print,
+					struct callchain_print_arg *arg,
+					check_output_full_fn is_output_full)
+{
+	u64 total = hists__total_period(entry->hists);
+	int printed;
+
+	if (callchain_param.mode == CHAIN_GRAPH_REL) {
+		if (symbol_conf.cumulate_callchain)
+			total = entry->stat_acc->period;
+		else
+			total = entry->stat.period;
+	}
+
+	if (callchain_param.mode == CHAIN_FLAT) {
+		printed = hist_browser__show_callchain_flat(browser,
+						&entry->sorted_chain, row, total,
+						print, arg, is_output_full);
+	} else if (callchain_param.mode == CHAIN_FOLDED) {
+		printed = hist_browser__show_callchain_folded(browser,
+						&entry->sorted_chain, row, total,
+						print, arg, is_output_full);
+	} else {
+		printed = hist_browser__show_callchain_graph(browser,
+						&entry->sorted_chain, level, row, total,
+						print, arg, is_output_full);
+	}
+
+	if (arg->is_current_entry)
+		browser->he_selection = entry;
+
+	return printed;
+}
+
 struct hpp_arg {
 	struct ui_browser *b;
 	char folded_sign;
@@ -1084,38 +1121,14 @@ static int hist_browser__show_entry(struct hist_browser *browser,
 		--row_offset;
 
 	if (folded_sign == '-' && row != browser->b.rows) {
-		u64 total = hists__total_period(entry->hists);
 		struct callchain_print_arg arg = {
 			.row_offset = row_offset,
 			.is_current_entry = current_entry,
 		};
 
-		if (callchain_param.mode == CHAIN_GRAPH_REL) {
-			if (symbol_conf.cumulate_callchain)
-				total = entry->stat_acc->period;
-			else
-				total = entry->stat.period;
-		}
-
-		if (callchain_param.mode == CHAIN_FLAT) {
-			printed += hist_browser__show_callchain_flat(browser,
-					&entry->sorted_chain, row, total,
+		printed += hist_browser__show_callchain(browser, entry, 1, row,
 					hist_browser__show_callchain_entry, &arg,
 					hist_browser__check_output_full);
-		} else if (callchain_param.mode == CHAIN_FOLDED) {
-			printed += hist_browser__show_callchain_folded(browser,
-					&entry->sorted_chain, row, total,
-					hist_browser__show_callchain_entry, &arg,
-					hist_browser__check_output_full);
-		} else {
-			printed += hist_browser__show_callchain(browser,
-					&entry->sorted_chain, 1, row, total,
-					hist_browser__show_callchain_entry, &arg,
-					hist_browser__check_output_full);
-		}
-
-		if (arg.is_current_entry)
-			browser->he_selection = entry;
 	}
 
 	return printed;
@@ -1380,15 +1393,11 @@ do_offset:
 static int hist_browser__fprintf_callchain(struct hist_browser *browser,
 					   struct hist_entry *he, FILE *fp)
 {
-	u64 total = hists__total_period(he->hists);
 	struct callchain_print_arg arg  = {
 		.fp = fp,
 	};
 
-	if (symbol_conf.cumulate_callchain)
-		total = he->stat_acc->period;
-
-	hist_browser__show_callchain(browser, &he->sorted_chain, 1, 0, total,
+	hist_browser__show_callchain(browser, he, 1, 0,
 				     hist_browser__fprintf_callchain_entry, &arg,
 				     hist_browser__check_dump_full);
 	return arg.printed;
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 07/12] perf hists browser: Fix callchain_node__count_rows()
  2016-01-24 13:53 [PATCHSET 00/12] perf tools: Apply percent-limit to callchains Namhyung Kim
                   ` (5 preceding siblings ...)
  2016-01-24 13:53 ` [PATCH 06/12] perf hists browser: Fix dump to show correct callchain style Namhyung Kim
@ 2016-01-24 13:53 ` Namhyung Kim
  2016-01-26 11:46   ` Jiri Olsa
  2016-01-24 13:53 ` [PATCH 08/12] perf hists browser: Apply callchain percent limit Namhyung Kim
                   ` (6 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Namhyung Kim @ 2016-01-24 13:53 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Andi Kleen,
	David Ahern, Frederic Weisbecker, Wang Nan

Like other functions, it should stop counting if there's any folded
callchain.  Because of this it occasionally lose the cursor at the end.

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

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 349c5de73287..c7ca36dae89f 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -215,7 +215,7 @@ static int callchain_node__count_folded_rows(struct callchain_node *node __maybe
 static int callchain_node__count_rows(struct callchain_node *node)
 {
 	struct callchain_list *chain;
-	bool unfolded = false;
+	char folded_sign = ' ';
 	int n = 0;
 
 	if (callchain_param.mode == CHAIN_FLAT)
@@ -225,10 +225,13 @@ static int callchain_node__count_rows(struct callchain_node *node)
 
 	list_for_each_entry(chain, &node->val, list) {
 		++n;
-		unfolded = chain->unfolded;
+
+		folded_sign = callchain_list__folded(chain);
+		if (folded_sign == '+')
+			break;
 	}
 
-	if (unfolded)
+	if (folded_sign == '-')
 		n += callchain_node__count_rows_rb_tree(node);
 
 	return n;
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 08/12] perf hists browser: Apply callchain percent limit
  2016-01-24 13:53 [PATCHSET 00/12] perf tools: Apply percent-limit to callchains Namhyung Kim
                   ` (6 preceding siblings ...)
  2016-01-24 13:53 ` [PATCH 07/12] perf hists browser: Fix callchain_node__count_rows() Namhyung Kim
@ 2016-01-24 13:53 ` Namhyung Kim
  2016-01-24 13:53 ` [PATCH 09/12] perf hists browser: Fix callchain counting when press ENTER key Namhyung Kim
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Namhyung Kim @ 2016-01-24 13:53 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Andi Kleen,
	David Ahern, Frederic Weisbecker, Wang Nan

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

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 09/12] perf hists browser: Fix callchain counting when press ENTER key
  2016-01-24 13:53 [PATCHSET 00/12] perf tools: Apply percent-limit to callchains Namhyung Kim
                   ` (7 preceding siblings ...)
  2016-01-24 13:53 ` [PATCH 08/12] perf hists browser: Apply callchain percent limit Namhyung Kim
@ 2016-01-24 13:53 ` Namhyung Kim
  2016-01-24 13:53 ` [PATCH 10/12] perf hists browser: Fix counting callchains when expand/collapse all Namhyung Kim
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Namhyung Kim @ 2016-01-24 13:53 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Andi Kleen,
	David Ahern, Frederic Weisbecker, Wang Nan

When counting callchains of the selected entry it should consider
percent limit also.  Otherwise it'll cause hists browser misbehaviing
due to the incorrect total pline count.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/ui/browsers/hists.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 3d64a6573d0c..a85f85e2b1ee 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -153,7 +153,7 @@ static void callchain_list__set_folding(struct callchain_list *cl, bool unfold)
 	cl->unfolded = unfold ? cl->has_children : false;
 }
 
-static int callchain_node__count_rows_rb_tree(struct callchain_node *node)
+static int callchain_node__count_rows_rb_tree(struct callchain_node *node, u64 total)
 {
 	int n = 0;
 	struct rb_node *nd;
@@ -162,6 +162,11 @@ static int callchain_node__count_rows_rb_tree(struct callchain_node *node)
 		struct callchain_node *child = rb_entry(nd, struct callchain_node, rb_node);
 		struct callchain_list *chain;
 		char folded_sign = ' '; /* No children */
+		double percent;
+
+		percent = 100.0 * callchain_cumul_hits(child) / total;
+		if (percent < callchain_param.min_percent)
+			continue;
 
 		list_for_each_entry(chain, &child->val, list) {
 			++n;
@@ -172,7 +177,7 @@ static int callchain_node__count_rows_rb_tree(struct callchain_node *node)
 		}
 
 		if (folded_sign == '-') /* Have children and they're unfolded */
-			n += callchain_node__count_rows_rb_tree(child);
+			n += callchain_node__count_rows_rb_tree(child, total);
 	}
 
 	return n;
@@ -212,11 +217,16 @@ static int callchain_node__count_folded_rows(struct callchain_node *node __maybe
 	return 1;
 }
 
-static int callchain_node__count_rows(struct callchain_node *node)
+static int callchain_node__count_rows(struct callchain_node *node, u64 total)
 {
 	struct callchain_list *chain;
 	char folded_sign = ' ';
 	int n = 0;
+	double percent;
+
+	percent = 100.0 * callchain_cumul_hits(node) / total;
+	if (percent < callchain_param.min_percent)
+		return 0;
 
 	if (callchain_param.mode == CHAIN_FLAT)
 		return callchain_node__count_flat_rows(node);
@@ -232,19 +242,22 @@ static int callchain_node__count_rows(struct callchain_node *node)
 	}
 
 	if (folded_sign == '-')
-		n += callchain_node__count_rows_rb_tree(node);
+		n += callchain_node__count_rows_rb_tree(node, total);
 
 	return n;
 }
 
-static int callchain__count_rows(struct rb_root *chain)
+static int callchain__count_rows(struct hist_entry *he)
 {
+	struct rb_root *chain;
 	struct rb_node *nd;
 	int n = 0;
+	u64 total = hists__total_period(he->hists);
 
+	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);
-		n += callchain_node__count_rows(node);
+		n += callchain_node__count_rows(node, total);
 	}
 
 	return n;
@@ -357,7 +370,7 @@ static bool hist_browser__toggle_fold(struct hist_browser *browser)
 		browser->nr_callchain_rows -= he->nr_rows;
 
 		if (he->unfolded)
-			he->nr_rows = callchain__count_rows(&he->sorted_chain);
+			he->nr_rows = callchain__count_rows(he);
 		else
 			he->nr_rows = 0;
 
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 10/12] perf hists browser: Fix counting callchains when expand/collapse all
  2016-01-24 13:53 [PATCHSET 00/12] perf tools: Apply percent-limit to callchains Namhyung Kim
                   ` (8 preceding siblings ...)
  2016-01-24 13:53 ` [PATCH 09/12] perf hists browser: Fix callchain counting when press ENTER key Namhyung Kim
@ 2016-01-24 13:53 ` Namhyung Kim
  2016-01-24 13:53 ` [PATCH 11/12] perf hists browser: Update percent base for fractal callchain mode Namhyung Kim
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Namhyung Kim @ 2016-01-24 13:53 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Andi Kleen,
	David Ahern, Frederic Weisbecker, Wang Nan

Likely to toggle folding state, when expanding/collapsing all entries it
should take into account percent limit of callchains.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/ui/browsers/hists.c | 48 ++++++++++++++++++++++++++++++------------
 1 file changed, 34 insertions(+), 14 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index a85f85e2b1ee..3bcd813f65d7 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -384,67 +384,85 @@ static bool hist_browser__toggle_fold(struct hist_browser *browser)
 	return false;
 }
 
-static int callchain_node__set_folding_rb_tree(struct callchain_node *node, bool unfold)
+static int callchain_node__set_folding_rb_tree(struct callchain_node *node,
+					       bool unfold, u64 total)
 {
 	int n = 0;
 	struct rb_node *nd;
 
 	for (nd = rb_first(&node->rb_root); nd; nd = rb_next(nd)) {
-		struct callchain_node *child = rb_entry(nd, struct callchain_node, rb_node);
+		struct callchain_node *child;
 		struct callchain_list *chain;
 		bool has_children = false;
+		double percent;
+		bool can_count;
+
+		child = rb_entry(nd, struct callchain_node, rb_node);
+		percent = 100.0 * callchain_cumul_hits(child) / total;
+		can_count = (percent >= callchain_param.min_percent);
 
 		list_for_each_entry(chain, &child->val, list) {
-			++n;
+			if (can_count)
+				++n;
 			callchain_list__set_folding(chain, unfold);
 			has_children = chain->has_children;
 		}
 
 		if (has_children)
-			n += callchain_node__set_folding_rb_tree(child, unfold);
+			n += callchain_node__set_folding_rb_tree(child, unfold,
+								 total);
 	}
 
 	return n;
 }
 
-static int callchain_node__set_folding(struct callchain_node *node, bool unfold)
+static int callchain_node__set_folding(struct callchain_node *node, bool unfold,
+				       u64 total)
 {
 	struct callchain_list *chain;
 	bool has_children = false;
 	int n = 0;
+	double percent = 100.0 * callchain_cumul_hits(node) / total;
+	bool can_count = (percent >= callchain_param.min_percent);
 
 	list_for_each_entry(chain, &node->val, list) {
-		++n;
+		if (can_count)
+			++n;
 		callchain_list__set_folding(chain, unfold);
 		has_children = chain->has_children;
 	}
 
 	if (has_children)
-		n += callchain_node__set_folding_rb_tree(node, unfold);
+		n += callchain_node__set_folding_rb_tree(node, unfold,
+							 total);
 
 	return n;
 }
 
-static int callchain__set_folding(struct rb_root *chain, bool unfold)
+static int callchain__set_folding(struct rb_root *chain, bool unfold, u64 total)
 {
 	struct rb_node *nd;
 	int n = 0;
 
 	for (nd = rb_first(chain); nd; nd = rb_next(nd)) {
-		struct callchain_node *node = rb_entry(nd, struct callchain_node, rb_node);
-		n += callchain_node__set_folding(node, unfold);
+		struct callchain_node *node;
+
+		node = rb_entry(nd, struct callchain_node, rb_node);
+		n += callchain_node__set_folding(node, unfold, total);
 	}
 
 	return n;
 }
 
-static void hist_entry__set_folding(struct hist_entry *he, bool unfold)
+static void hist_entry__set_folding(struct hist_entry *he, bool unfold,
+				    u64 total)
 {
 	hist_entry__init_have_children(he);
 	he->unfolded = unfold ? he->has_children : false;
 
 	if (he->has_children) {
-		int n = callchain__set_folding(&he->sorted_chain, unfold);
+		int n = callchain__set_folding(&he->sorted_chain, unfold,
+					       total);
 		he->nr_rows = unfold ? n : 0;
 	} else
 		he->nr_rows = 0;
@@ -455,12 +473,14 @@ __hist_browser__set_folding(struct hist_browser *browser, bool unfold)
 {
 	struct rb_node *nd;
 	struct hists *hists = browser->hists;
+	u64 total = hists__total_period(hists);
+	struct hist_entry *he;
 
 	for (nd = rb_first(&hists->entries);
 	     (nd = hists__filter_entries(nd, browser->min_pcnt)) != NULL;
 	     nd = rb_next(nd)) {
-		struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node);
-		hist_entry__set_folding(he, unfold);
+		he = rb_entry(nd, struct hist_entry, rb_node);
+		hist_entry__set_folding(he, unfold, total);
 		browser->nr_callchain_rows += he->nr_rows;
 	}
 }
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 11/12] perf hists browser: Update percent base for fractal callchain mode
  2016-01-24 13:53 [PATCHSET 00/12] perf tools: Apply percent-limit to callchains Namhyung Kim
                   ` (9 preceding siblings ...)
  2016-01-24 13:53 ` [PATCH 10/12] perf hists browser: Fix counting callchains when expand/collapse all Namhyung Kim
@ 2016-01-24 13:53 ` Namhyung Kim
  2016-01-24 13:53 ` [PATCH 12/12] perf report: Fix callchain percent limit on --gtk Namhyung Kim
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Namhyung Kim @ 2016-01-24 13:53 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Andi Kleen,
	David Ahern, Frederic Weisbecker, Wang Nan

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@kernel.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

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 12/12] perf report: Fix callchain percent limit on --gtk
  2016-01-24 13:53 [PATCHSET 00/12] perf tools: Apply percent-limit to callchains Namhyung Kim
                   ` (10 preceding siblings ...)
  2016-01-24 13:53 ` [PATCH 11/12] perf hists browser: Update percent base for fractal callchain mode Namhyung Kim
@ 2016-01-24 13:53 ` Namhyung Kim
  2016-01-25  2:16 ` [PATCHSET 00/12] perf tools: Apply percent-limit to callchains Andi Kleen
  2016-01-26 12:14 ` Jiri Olsa
  13 siblings, 0 replies; 28+ messages in thread
From: Namhyung Kim @ 2016-01-24 13:53 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Andi Kleen,
	David Ahern, Frederic Weisbecker, Wang Nan

When a percent limit is given, it should take callchains into account.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/ui/gtk/hists.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index 0f8dcfdfb10f..8652c3c967b9 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -100,9 +100,14 @@ static void perf_gtk__add_callchain_flat(struct rb_root *root, GtkTreeStore *sto
 		struct callchain_list *chain;
 		GtkTreeIter iter, new_parent;
 		bool need_new_parent;
+		double percent;
 
 		node = rb_entry(nd, struct callchain_node, rb_node);
 
+		percent = 100.0 * callchain_cumul_hits(node) / total;
+		if (percent < callchain_param.min_percent)
+			continue;
+
 		new_parent = *parent;
 		need_new_parent = !has_single_node;
 
@@ -164,9 +169,14 @@ static void perf_gtk__add_callchain_folded(struct rb_root *root, GtkTreeStore *s
 		char buf[64];
 		char *str, *str_alloc = NULL;
 		bool first = true;
+		double percent;
 
 		node = rb_entry(nd, struct callchain_node, rb_node);
 
+		percent = 100.0 * callchain_cumul_hits(node) / total;
+		if (percent < callchain_param.min_percent)
+			continue;
+
 		callchain_node__make_parent_list(node);
 
 		list_for_each_entry(chain, &node->parent_val, list) {
@@ -224,9 +234,14 @@ static void perf_gtk__add_callchain_graph(struct rb_root *root, GtkTreeStore *st
 		GtkTreeIter iter, new_parent;
 		bool need_new_parent;
 		u64 child_total;
+		double percent;
 
 		node = rb_entry(nd, struct callchain_node, rb_node);
 
+		percent = 100.0 * callchain_cumul_hits(node) / total;
+		if (percent < callchain_param.min_percent)
+			continue;
+
 		new_parent = *parent;
 		need_new_parent = !has_single_node && (node->val_nr > 1);
 
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PATCHSET 00/12] perf tools: Apply percent-limit to callchains
  2016-01-24 13:53 [PATCHSET 00/12] perf tools: Apply percent-limit to callchains Namhyung Kim
                   ` (11 preceding siblings ...)
  2016-01-24 13:53 ` [PATCH 12/12] perf report: Fix callchain percent limit on --gtk Namhyung Kim
@ 2016-01-25  2:16 ` Andi Kleen
  2016-01-26 12:14 ` Jiri Olsa
  13 siblings, 0 replies; 28+ messages in thread
From: Andi Kleen @ 2016-01-25  2:16 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, Jiri Olsa,
	LKML, Andi Kleen, David Ahern, Frederic Weisbecker, Wang Nan

On Sun, Jan 24, 2016 at 10:53:23PM +0900, Namhyung Kim wrote:
> Hello,
> 
> This patchset tries to implement percent limit to callchains which was
> requested by Andi Kleen.  For some reason, limiting callchains by
> (overhead) percentage didn't work well.  This patch fixes it and make
> --percent-limit also works for callchains as well as hist entries.
> 
> This is available on 'perf/callchain-limit-v1' branch in my tree:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
> 
> Any comments are welcome,

Thanks! Looks good to me.

-Andi

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 07/12] perf hists browser: Fix callchain_node__count_rows()
  2016-01-24 13:53 ` [PATCH 07/12] perf hists browser: Fix callchain_node__count_rows() Namhyung Kim
@ 2016-01-26 11:46   ` Jiri Olsa
  2016-01-26 12:32     ` Namhyung Kim
  0 siblings, 1 reply; 28+ messages in thread
From: Jiri Olsa @ 2016-01-26 11:46 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, Jiri Olsa,
	LKML, Andi Kleen, David Ahern, Frederic Weisbecker, Wang Nan

On Sun, Jan 24, 2016 at 10:53:30PM +0900, Namhyung Kim wrote:
> Like other functions, it should stop counting if there's any folded
> callchain.  Because of this it occasionally lose the cursor at the end.

are you reffering to the case when the browser wouldn't jump
to the last entry, but the cursor disappears instead, and then
shows up after holding 'UP' arrow?  

because I've seen that occasionaly ;-)

jirka

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCHSET 00/12] perf tools: Apply percent-limit to callchains
  2016-01-24 13:53 [PATCHSET 00/12] perf tools: Apply percent-limit to callchains Namhyung Kim
                   ` (12 preceding siblings ...)
  2016-01-25  2:16 ` [PATCHSET 00/12] perf tools: Apply percent-limit to callchains Andi Kleen
@ 2016-01-26 12:14 ` Jiri Olsa
  2016-01-26 12:51   ` Namhyung Kim
  13 siblings, 1 reply; 28+ messages in thread
From: Jiri Olsa @ 2016-01-26 12:14 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, Jiri Olsa,
	LKML, Andi Kleen, David Ahern, Frederic Weisbecker, Wang Nan

On Sun, Jan 24, 2016 at 10:53:23PM +0900, Namhyung Kim wrote:
> Hello,
> 
> This patchset tries to implement percent limit to callchains which was
> requested by Andi Kleen.  For some reason, limiting callchains by
> (overhead) percentage didn't work well.  This patch fixes it and make
> --percent-limit also works for callchains as well as hist entries.
> 
> This is available on 'perf/callchain-limit-v1' branch in my tree:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
> 
> Any comments are welcome,
> 
> Thanks,
> Namhyung
> 
> 
> Namhyung Kim (12):
>   perf report: Apply --percent-limit to callchains also
>   perf report: Apply callchain percent limit on --stdio
>   perf report: Get rid of hist_entry__callchain_fprintf()
>   perf report: Fix percent calculation on --stdio
>   perf report: Hide output pipe for percent-limited callchains on stdio
>   perf hists browser: Fix dump to show correct callchain style
>   perf hists browser: Fix callchain_node__count_rows()
>   perf hists browser: Apply callchain percent limit
>   perf hists browser: Fix callchain counting when press ENTER key
>   perf hists browser: Fix counting callchains when expand/collapse all
>   perf hists browser: Update percent base for fractal callchain mode
>   perf report: Fix callchain percent limit on --gtk

is 0.5 the default or one has to use the --percent-limit 0.5
for the limit to be effective?

without the option I'm getting empty callchains that are below 0.5
but only in TUI mode (attached).. --stdio shows them all unfolded

thanks,
jirka



---
+   46.69%    46.69%  ls       [kernel.vmlinux]  [k] intel_bts_enable_local                                                                                                                                                                                                           ▒
+    0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_pmu_enable.part.87                                                                                                                                                                                                          ▒
+    0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_context_sched_in                                                                                                                                                                                                      ▒
+    0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_exec                                                                                                                                                                                                                  ▒
+    0.08%     0.00%  perf     [kernel.vmlinux]  [k] setup_new_exec                                                                                                                                                                                                                   ▒
+    0.08%     0.00%  perf     [kernel.vmlinux]  [k] load_elf_binary                                                                                                                                                                                                                  ▒
+    0.08%     0.00%  perf     [kernel.vmlinux]  [k] search_binary_handler                                                                                                                                                                                                            ▒
+    0.08%     0.00%  perf     [kernel.vmlinux]  [k] do_execveat_common.isra.33                                                                                                                                                                                                       ▒
+    0.08%     0.00%  perf     [kernel.vmlinux]  [k] sys_execve                                                                                                                                                                                                                       ▒
+    0.08%     0.00%  perf     [kernel.vmlinux]  [k] return_from_execve                                                                                                                                                                                                               ▒
-    0.08%     0.00%  perf     [unknown]         [k] 0x00007f2175b35e07                                                                                                                                                                                                               ▒
-    0.04%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_nmi_handler                                                                                                                                                                                                           ▒
-    0.04%     0.00%  perf     [kernel.vmlinux]  [k] nmi_handle                                                                                                                                                                                                                       ▒
-    0.04%     0.00%  perf     [kernel.vmlinux]  [k] default_do_nmi                                                                                                                                                                                                                   ▒
-    0.04%     0.00%  perf     [kernel.vmlinux]  [k] do_nmi                                                                                                                                                                                                                           ▒
-    0.04%     0.00%  perf     [kernel.vmlinux]  [k] end_repeat_nmi                                                                                                                                                                                                                   ▒
-    0.04%     0.04%  perf     [kernel.vmlinux]  [k] x86_pmu_enable                                                                                                                                                                                                                   ▒
-    0.04%     0.04%  perf     [kernel.vmlinux]  [k] native_apic_mem_write                                                                                                                                                                                                            ▒

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 07/12] perf hists browser: Fix callchain_node__count_rows()
  2016-01-26 11:46   ` Jiri Olsa
@ 2016-01-26 12:32     ` Namhyung Kim
  0 siblings, 0 replies; 28+ messages in thread
From: Namhyung Kim @ 2016-01-26 12:32 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, Jiri Olsa,
	LKML, Andi Kleen, David Ahern, Frederic Weisbecker, Wang Nan

Hi Jiri,

On Tue, Jan 26, 2016 at 12:46:38PM +0100, Jiri Olsa wrote:
> On Sun, Jan 24, 2016 at 10:53:30PM +0900, Namhyung Kim wrote:
> > Like other functions, it should stop counting if there's any folded
> > callchain.  Because of this it occasionally lose the cursor at the end.
> 
> are you reffering to the case when the browser wouldn't jump
> to the last entry, but the cursor disappears instead, and then
> shows up after holding 'UP' arrow?  

Right.  Since it counts some of folded callchain nodes, the cursor
went beyond the end so nothing was shown for them.

> 
> because I've seen that occasionaly ;-)

Me too.

Thanks,
Namhyung

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCHSET 00/12] perf tools: Apply percent-limit to callchains
  2016-01-26 12:14 ` Jiri Olsa
@ 2016-01-26 12:51   ` Namhyung Kim
  2016-01-26 13:27     ` Jiri Olsa
  0 siblings, 1 reply; 28+ messages in thread
From: Namhyung Kim @ 2016-01-26 12:51 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, Jiri Olsa,
	LKML, Andi Kleen, David Ahern, Frederic Weisbecker, Wang Nan

On Tue, Jan 26, 2016 at 01:14:47PM +0100, Jiri Olsa wrote:
> On Sun, Jan 24, 2016 at 10:53:23PM +0900, Namhyung Kim wrote:
> > Hello,
> > 
> > This patchset tries to implement percent limit to callchains which was
> > requested by Andi Kleen.  For some reason, limiting callchains by
> > (overhead) percentage didn't work well.  This patch fixes it and make
> > --percent-limit also works for callchains as well as hist entries.
> > 
> > This is available on 'perf/callchain-limit-v1' branch in my tree:
> > 
> >   git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
> > 
> > Any comments are welcome,
> > 
> > Thanks,
> > Namhyung
> > 
> > 
> > Namhyung Kim (12):
> >   perf report: Apply --percent-limit to callchains also
> >   perf report: Apply callchain percent limit on --stdio
> >   perf report: Get rid of hist_entry__callchain_fprintf()
> >   perf report: Fix percent calculation on --stdio
> >   perf report: Hide output pipe for percent-limited callchains on stdio
> >   perf hists browser: Fix dump to show correct callchain style
> >   perf hists browser: Fix callchain_node__count_rows()
> >   perf hists browser: Apply callchain percent limit
> >   perf hists browser: Fix callchain counting when press ENTER key
> >   perf hists browser: Fix counting callchains when expand/collapse all
> >   perf hists browser: Update percent base for fractal callchain mode
> >   perf report: Fix callchain percent limit on --gtk
> 
> is 0.5 the default or one has to use the --percent-limit 0.5
> for the limit to be effective?

Yes, it's effective now.  I also think we need to change the default
limit of 0.5.  It was set for 'fractal' mode initially AFAIK so its
percentage is relative to each node.  In this case 0.5% of limit makes
sense because it'll be a very small (absolute) value.

But With 'graph' mode (now default), there're many entries under 0.5
overhead and they silently won't show callchains anymore.  Actually I
was confused by it when working with this patchset.

What about 0.005% for the new default?


> 
> without the option I'm getting empty callchains that are below 0.5
> but only in TUI mode (attached).. --stdio shows them all unfolded

It should not show them all.  But I found that I missed a check for
a stdio case.  Could you please test below?


>From 9026b85537cf31af43124c957867f42b34262f2e Mon Sep 17 00:00:00 2001
From: Namhyung Kim <namhyung@kernel.org>
Date: Tue, 26 Jan 2016 21:40:39 +0900
Subject: [PATCH] perf report: Check percent limit of single callchain on stdio

While previous commit ("perf report: Apply callchain percent limit
on --stdio") checked percent limit of callchain, it missed to check a
single-path callchains.  It resulted in showing callchains under the
limit if an entry has only single path of call graph.

Reported-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/ui/stdio/hist.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index eae25efa684e..35964579627b 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -199,6 +199,7 @@ static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root,
 	int i = 0;
 	int ret = 0;
 	char bf[1024];
+	double percent;
 
 	/*
 	 * If have one single callchain root, don't bother printing
@@ -208,6 +209,11 @@ static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root,
 	node = rb_first(root);
 	if (node && !rb_next(node)) {
 		cnode = rb_entry(node, struct callchain_node, rb_node);
+
+		percent = 100.0 * callchain_cumul_hits(cnode) / total_samples;
+		if (percent < callchain_param.min_percent)
+			return 0;
+
 		list_for_each_entry(chain, &cnode->val, list) {
 			/*
 			 * If we sort by symbol, the first entry is the same than
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PATCHSET 00/12] perf tools: Apply percent-limit to callchains
  2016-01-26 12:51   ` Namhyung Kim
@ 2016-01-26 13:27     ` Jiri Olsa
  2016-01-26 14:10       ` Namhyung Kim
  0 siblings, 1 reply; 28+ messages in thread
From: Jiri Olsa @ 2016-01-26 13:27 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, Jiri Olsa,
	LKML, Andi Kleen, David Ahern, Frederic Weisbecker, Wang Nan

On Tue, Jan 26, 2016 at 09:51:59PM +0900, Namhyung Kim wrote:
> On Tue, Jan 26, 2016 at 01:14:47PM +0100, Jiri Olsa wrote:
> > On Sun, Jan 24, 2016 at 10:53:23PM +0900, Namhyung Kim wrote:
> > > Hello,
> > > 
> > > This patchset tries to implement percent limit to callchains which was
> > > requested by Andi Kleen.  For some reason, limiting callchains by
> > > (overhead) percentage didn't work well.  This patch fixes it and make
> > > --percent-limit also works for callchains as well as hist entries.
> > > 
> > > This is available on 'perf/callchain-limit-v1' branch in my tree:
> > > 
> > >   git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
> > > 
> > > Any comments are welcome,
> > > 
> > > Thanks,
> > > Namhyung
> > > 
> > > 
> > > Namhyung Kim (12):
> > >   perf report: Apply --percent-limit to callchains also
> > >   perf report: Apply callchain percent limit on --stdio
> > >   perf report: Get rid of hist_entry__callchain_fprintf()
> > >   perf report: Fix percent calculation on --stdio
> > >   perf report: Hide output pipe for percent-limited callchains on stdio
> > >   perf hists browser: Fix dump to show correct callchain style
> > >   perf hists browser: Fix callchain_node__count_rows()
> > >   perf hists browser: Apply callchain percent limit
> > >   perf hists browser: Fix callchain counting when press ENTER key
> > >   perf hists browser: Fix counting callchains when expand/collapse all
> > >   perf hists browser: Update percent base for fractal callchain mode
> > >   perf report: Fix callchain percent limit on --gtk
> > 
> > is 0.5 the default or one has to use the --percent-limit 0.5
> > for the limit to be effective?
> 
> Yes, it's effective now.  I also think we need to change the default
> limit of 0.5.  It was set for 'fractal' mode initially AFAIK so its
> percentage is relative to each node.  In this case 0.5% of limit makes
> sense because it'll be a very small (absolute) value.
> 
> But With 'graph' mode (now default), there're many entries under 0.5
> overhead and they silently won't show callchains anymore.  Actually I
> was confused by it when working with this patchset.
> 
> What about 0.005% for the new default?
> 
> 
> > 
> > without the option I'm getting empty callchains that are below 0.5
> > but only in TUI mode (attached).. --stdio shows them all unfolded
> 
> It should not show them all.  But I found that I missed a check for
> a stdio case.  Could you please test below?

did not help, it's still there.. same output as before

jirka

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCHSET 00/12] perf tools: Apply percent-limit to callchains
  2016-01-26 13:27     ` Jiri Olsa
@ 2016-01-26 14:10       ` Namhyung Kim
  2016-01-26 14:41         ` Jiri Olsa
  0 siblings, 1 reply; 28+ messages in thread
From: Namhyung Kim @ 2016-01-26 14:10 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, Jiri Olsa,
	LKML, Andi Kleen, David Ahern, Frederic Weisbecker, Wang Nan

On Tue, Jan 26, 2016 at 02:27:26PM +0100, Jiri Olsa wrote:
> On Tue, Jan 26, 2016 at 09:51:59PM +0900, Namhyung Kim wrote:
> > On Tue, Jan 26, 2016 at 01:14:47PM +0100, Jiri Olsa wrote:
> > > On Sun, Jan 24, 2016 at 10:53:23PM +0900, Namhyung Kim wrote:
> > > > Hello,
> > > > 
> > > > This patchset tries to implement percent limit to callchains which was
> > > > requested by Andi Kleen.  For some reason, limiting callchains by
> > > > (overhead) percentage didn't work well.  This patch fixes it and make
> > > > --percent-limit also works for callchains as well as hist entries.
> > > > 
> > > > This is available on 'perf/callchain-limit-v1' branch in my tree:
> > > > 
> > > >   git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
> > > > 
> > > > Any comments are welcome,
> > > > 
> > > > Thanks,
> > > > Namhyung
> > > > 
> > > > 
> > > > Namhyung Kim (12):
> > > >   perf report: Apply --percent-limit to callchains also
> > > >   perf report: Apply callchain percent limit on --stdio
> > > >   perf report: Get rid of hist_entry__callchain_fprintf()
> > > >   perf report: Fix percent calculation on --stdio
> > > >   perf report: Hide output pipe for percent-limited callchains on stdio
> > > >   perf hists browser: Fix dump to show correct callchain style
> > > >   perf hists browser: Fix callchain_node__count_rows()
> > > >   perf hists browser: Apply callchain percent limit
> > > >   perf hists browser: Fix callchain counting when press ENTER key
> > > >   perf hists browser: Fix counting callchains when expand/collapse all
> > > >   perf hists browser: Update percent base for fractal callchain mode
> > > >   perf report: Fix callchain percent limit on --gtk
> > > 
> > > is 0.5 the default or one has to use the --percent-limit 0.5
> > > for the limit to be effective?
> > 
> > Yes, it's effective now.  I also think we need to change the default
> > limit of 0.5.  It was set for 'fractal' mode initially AFAIK so its
> > percentage is relative to each node.  In this case 0.5% of limit makes
> > sense because it'll be a very small (absolute) value.
> > 
> > But With 'graph' mode (now default), there're many entries under 0.5
> > overhead and they silently won't show callchains anymore.  Actually I
> > was confused by it when working with this patchset.
> > 
> > What about 0.005% for the new default?
> > 
> > 
> > > 
> > > without the option I'm getting empty callchains that are below 0.5
> > > but only in TUI mode (attached).. --stdio shows them all unfolded
> > 
> > It should not show them all.  But I found that I missed a check for
> > a stdio case.  Could you please test below?
> 
> did not help, it's still there.. same output as before

Hmm.. strange, could you show me the (part of) stdio output?

Thanks,
Namhyung

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCHSET 00/12] perf tools: Apply percent-limit to callchains
  2016-01-26 14:10       ` Namhyung Kim
@ 2016-01-26 14:41         ` Jiri Olsa
  2016-01-26 14:49           ` Namhyung Kim
  0 siblings, 1 reply; 28+ messages in thread
From: Jiri Olsa @ 2016-01-26 14:41 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, Jiri Olsa,
	LKML, Andi Kleen, David Ahern, Frederic Weisbecker, Wang Nan

On Tue, Jan 26, 2016 at 11:10:25PM +0900, Namhyung Kim wrote:
> On Tue, Jan 26, 2016 at 02:27:26PM +0100, Jiri Olsa wrote:
> > On Tue, Jan 26, 2016 at 09:51:59PM +0900, Namhyung Kim wrote:
> > > On Tue, Jan 26, 2016 at 01:14:47PM +0100, Jiri Olsa wrote:
> > > > On Sun, Jan 24, 2016 at 10:53:23PM +0900, Namhyung Kim wrote:
> > > > > Hello,
> > > > > 
> > > > > This patchset tries to implement percent limit to callchains which was
> > > > > requested by Andi Kleen.  For some reason, limiting callchains by
> > > > > (overhead) percentage didn't work well.  This patch fixes it and make
> > > > > --percent-limit also works for callchains as well as hist entries.
> > > > > 
> > > > > This is available on 'perf/callchain-limit-v1' branch in my tree:
> > > > > 
> > > > >   git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
> > > > > 
> > > > > Any comments are welcome,
> > > > > 
> > > > > Thanks,
> > > > > Namhyung
> > > > > 
> > > > > 
> > > > > Namhyung Kim (12):
> > > > >   perf report: Apply --percent-limit to callchains also
> > > > >   perf report: Apply callchain percent limit on --stdio
> > > > >   perf report: Get rid of hist_entry__callchain_fprintf()
> > > > >   perf report: Fix percent calculation on --stdio
> > > > >   perf report: Hide output pipe for percent-limited callchains on stdio
> > > > >   perf hists browser: Fix dump to show correct callchain style
> > > > >   perf hists browser: Fix callchain_node__count_rows()
> > > > >   perf hists browser: Apply callchain percent limit
> > > > >   perf hists browser: Fix callchain counting when press ENTER key
> > > > >   perf hists browser: Fix counting callchains when expand/collapse all
> > > > >   perf hists browser: Update percent base for fractal callchain mode
> > > > >   perf report: Fix callchain percent limit on --gtk
> > > > 
> > > > is 0.5 the default or one has to use the --percent-limit 0.5
> > > > for the limit to be effective?
> > > 
> > > Yes, it's effective now.  I also think we need to change the default
> > > limit of 0.5.  It was set for 'fractal' mode initially AFAIK so its
> > > percentage is relative to each node.  In this case 0.5% of limit makes
> > > sense because it'll be a very small (absolute) value.
> > > 
> > > But With 'graph' mode (now default), there're many entries under 0.5
> > > overhead and they silently won't show callchains anymore.  Actually I
> > > was confused by it when working with this patchset.
> > > 
> > > What about 0.005% for the new default?
> > > 
> > > 
> > > > 
> > > > without the option I'm getting empty callchains that are below 0.5
> > > > but only in TUI mode (attached).. --stdio shows them all unfolded
> > > 
> > > It should not show them all.  But I found that I missed a check for
> > > a stdio case.  Could you please test below?
> > 
> > did not help, it's still there.. same output as before
> 
> Hmm.. strange, could you show me the (part of) stdio output?
> 

yea, that one changed as well.. no callchains now, attached


jirka


---
[jolsa@krava perf]$ ./perf report --stdio

...

    46.69%    46.69%  ls       [kernel.vmlinux]  [k] intel_bts_enable_local      
            |
            ---0x1000
               __statfs
               entry_SYSCALL_64_fastpath
               sys_statfs
               SYSC_statfs
               user_statfs
               user_path_at_empty
               filename_lookup
               path_lookupat
               link_path_walk
               inode_permission
               __inode_permission
               kernfs_iop_permission
               kernfs_refresh_inode
               security_inode_notifysecctx
               selinux_inode_notifysecctx
               selinux_inode_setsecurity
               security_context_to_sid
               security_context_to_sid_core
               string_to_context_struct
               hashtab_search
               apic_timer_interrupt
               smp_apic_timer_interrupt
               local_apic_timer_interrupt
               hrtimer_interrupt
               __hrtimer_run_queues
               tick_sched_timer
               tick_sched_handle.isra.17
               update_process_times
               scheduler_tick
               perf_event_task_tick
               perf_pmu_enable.part.87
               x86_pmu_enable
               intel_pmu_enable_all
               intel_bts_enable_local

     0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_pmu_enable.part.87     
     0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_context_sched_in 
     0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_exec             
     0.08%     0.00%  perf     [kernel.vmlinux]  [k] setup_new_exec              
     0.08%     0.00%  perf     [kernel.vmlinux]  [k] load_elf_binary             
     0.08%     0.00%  perf     [kernel.vmlinux]  [k] search_binary_handler       
     0.08%     0.00%  perf     [kernel.vmlinux]  [k] do_execveat_common.isra.33  
     0.08%     0.00%  perf     [kernel.vmlinux]  [k] sys_execve                  
     0.08%     0.00%  perf     [kernel.vmlinux]  [k] return_from_execve          
     0.08%     0.00%  perf     [unknown]         [k] 0x00007f2175b35e07          
     0.04%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_nmi_handler      
     0.04%     0.00%  perf     [kernel.vmlinux]  [k] nmi_handle                  
     0.04%     0.00%  perf     [kernel.vmlinux]  [k] default_do_nmi              
     0.04%     0.00%  perf     [kernel.vmlinux]  [k] do_nmi                      
     0.04%     0.00%  perf     [kernel.vmlinux]  [k] end_repeat_nmi              
     0.04%     0.04%  perf     [kernel.vmlinux]  [k] x86_pmu_enable              
     0.04%     0.04%  perf     [kernel.vmlinux]  [k] native_apic_mem_write       

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCHSET 00/12] perf tools: Apply percent-limit to callchains
  2016-01-26 14:41         ` Jiri Olsa
@ 2016-01-26 14:49           ` Namhyung Kim
  2016-01-26 15:18             ` Jiri Olsa
  0 siblings, 1 reply; 28+ messages in thread
From: Namhyung Kim @ 2016-01-26 14:49 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, Jiri Olsa,
	LKML, Andi Kleen, David Ahern, Frederic Weisbecker, Wang Nan

On Tue, Jan 26, 2016 at 03:41:35PM +0100, Jiri Olsa wrote:
> On Tue, Jan 26, 2016 at 11:10:25PM +0900, Namhyung Kim wrote:
> > On Tue, Jan 26, 2016 at 02:27:26PM +0100, Jiri Olsa wrote:
> > > On Tue, Jan 26, 2016 at 09:51:59PM +0900, Namhyung Kim wrote:
> > > > On Tue, Jan 26, 2016 at 01:14:47PM +0100, Jiri Olsa wrote:
> > > > > On Sun, Jan 24, 2016 at 10:53:23PM +0900, Namhyung Kim wrote:
> > > > > > Hello,
> > > > > > 
> > > > > > This patchset tries to implement percent limit to callchains which was
> > > > > > requested by Andi Kleen.  For some reason, limiting callchains by
> > > > > > (overhead) percentage didn't work well.  This patch fixes it and make
> > > > > > --percent-limit also works for callchains as well as hist entries.
> > > > > > 
> > > > > > This is available on 'perf/callchain-limit-v1' branch in my tree:
> > > > > > 
> > > > > >   git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
> > > > > > 
> > > > > > Any comments are welcome,
> > > > > > 
> > > > > > Thanks,
> > > > > > Namhyung
> > > > > > 
> > > > > > 
> > > > > > Namhyung Kim (12):
> > > > > >   perf report: Apply --percent-limit to callchains also
> > > > > >   perf report: Apply callchain percent limit on --stdio
> > > > > >   perf report: Get rid of hist_entry__callchain_fprintf()
> > > > > >   perf report: Fix percent calculation on --stdio
> > > > > >   perf report: Hide output pipe for percent-limited callchains on stdio
> > > > > >   perf hists browser: Fix dump to show correct callchain style
> > > > > >   perf hists browser: Fix callchain_node__count_rows()
> > > > > >   perf hists browser: Apply callchain percent limit
> > > > > >   perf hists browser: Fix callchain counting when press ENTER key
> > > > > >   perf hists browser: Fix counting callchains when expand/collapse all
> > > > > >   perf hists browser: Update percent base for fractal callchain mode
> > > > > >   perf report: Fix callchain percent limit on --gtk
> > > > > 
> > > > > is 0.5 the default or one has to use the --percent-limit 0.5
> > > > > for the limit to be effective?
> > > > 
> > > > Yes, it's effective now.  I also think we need to change the default
> > > > limit of 0.5.  It was set for 'fractal' mode initially AFAIK so its
> > > > percentage is relative to each node.  In this case 0.5% of limit makes
> > > > sense because it'll be a very small (absolute) value.
> > > > 
> > > > But With 'graph' mode (now default), there're many entries under 0.5
> > > > overhead and they silently won't show callchains anymore.  Actually I
> > > > was confused by it when working with this patchset.
> > > > 
> > > > What about 0.005% for the new default?
> > > > 
> > > > 
> > > > > 
> > > > > without the option I'm getting empty callchains that are below 0.5
> > > > > but only in TUI mode (attached).. --stdio shows them all unfolded
> > > > 
> > > > It should not show them all.  But I found that I missed a check for
> > > > a stdio case.  Could you please test below?
> > > 
> > > did not help, it's still there.. same output as before
> > 
> > Hmm.. strange, could you show me the (part of) stdio output?
> > 
> 
> yea, that one changed as well.. no callchains now, attached
> 
> 
> jirka
> 
> 
> ---
> [jolsa@krava perf]$ ./perf report --stdio
> 
> ...
> 
>     46.69%    46.69%  ls       [kernel.vmlinux]  [k] intel_bts_enable_local      
>             |
>             ---0x1000
>                __statfs
>                entry_SYSCALL_64_fastpath
>                sys_statfs
>                SYSC_statfs
>                user_statfs
>                user_path_at_empty
>                filename_lookup
>                path_lookupat
>                link_path_walk
>                inode_permission
>                __inode_permission
>                kernfs_iop_permission
>                kernfs_refresh_inode
>                security_inode_notifysecctx
>                selinux_inode_notifysecctx
>                selinux_inode_setsecurity
>                security_context_to_sid
>                security_context_to_sid_core
>                string_to_context_struct
>                hashtab_search
>                apic_timer_interrupt
>                smp_apic_timer_interrupt
>                local_apic_timer_interrupt
>                hrtimer_interrupt
>                __hrtimer_run_queues
>                tick_sched_timer
>                tick_sched_handle.isra.17
>                update_process_times
>                scheduler_tick
>                perf_event_task_tick
>                perf_pmu_enable.part.87
>                x86_pmu_enable
>                intel_pmu_enable_all
>                intel_bts_enable_local
> 
>      0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_pmu_enable.part.87     
>      0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_context_sched_in 
>      0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_exec             
>      0.08%     0.00%  perf     [kernel.vmlinux]  [k] setup_new_exec              
>      0.08%     0.00%  perf     [kernel.vmlinux]  [k] load_elf_binary             
>      0.08%     0.00%  perf     [kernel.vmlinux]  [k] search_binary_handler       
>      0.08%     0.00%  perf     [kernel.vmlinux]  [k] do_execveat_common.isra.33  
>      0.08%     0.00%  perf     [kernel.vmlinux]  [k] sys_execve                  
>      0.08%     0.00%  perf     [kernel.vmlinux]  [k] return_from_execve          
>      0.08%     0.00%  perf     [unknown]         [k] 0x00007f2175b35e07          
>      0.04%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_nmi_handler      
>      0.04%     0.00%  perf     [kernel.vmlinux]  [k] nmi_handle                  
>      0.04%     0.00%  perf     [kernel.vmlinux]  [k] default_do_nmi              
>      0.04%     0.00%  perf     [kernel.vmlinux]  [k] do_nmi                      
>      0.04%     0.00%  perf     [kernel.vmlinux]  [k] end_repeat_nmi              
>      0.04%     0.04%  perf     [kernel.vmlinux]  [k] x86_pmu_enable              
>      0.04%     0.04%  perf     [kernel.vmlinux]  [k] native_apic_mem_write       
> 

What's the problem?  Now by default callchains under 0.5% (absolute)
will not be shown.  I think this is intended output, and we need to
consider changing the default percent limit.

Thanks,
Namhyung

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCHSET 00/12] perf tools: Apply percent-limit to callchains
  2016-01-26 14:49           ` Namhyung Kim
@ 2016-01-26 15:18             ` Jiri Olsa
  2016-01-26 15:30               ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 28+ messages in thread
From: Jiri Olsa @ 2016-01-26 15:18 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, Jiri Olsa,
	LKML, Andi Kleen, David Ahern, Frederic Weisbecker, Wang Nan

On Tue, Jan 26, 2016 at 11:49:07PM +0900, Namhyung Kim wrote:

SNIP

> >                __hrtimer_run_queues
> >                tick_sched_timer
> >                tick_sched_handle.isra.17
> >                update_process_times
> >                scheduler_tick
> >                perf_event_task_tick
> >                perf_pmu_enable.part.87
> >                x86_pmu_enable
> >                intel_pmu_enable_all
> >                intel_bts_enable_local
> > 
> >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_pmu_enable.part.87     
> >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_context_sched_in 
> >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_exec             
> >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] setup_new_exec              
> >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] load_elf_binary             
> >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] search_binary_handler       
> >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] do_execveat_common.isra.33  
> >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] sys_execve                  
> >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] return_from_execve          
> >      0.08%     0.00%  perf     [unknown]         [k] 0x00007f2175b35e07          
> >      0.04%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_nmi_handler      
> >      0.04%     0.00%  perf     [kernel.vmlinux]  [k] nmi_handle                  
> >      0.04%     0.00%  perf     [kernel.vmlinux]  [k] default_do_nmi              
> >      0.04%     0.00%  perf     [kernel.vmlinux]  [k] do_nmi                      
> >      0.04%     0.00%  perf     [kernel.vmlinux]  [k] end_repeat_nmi              
> >      0.04%     0.04%  perf     [kernel.vmlinux]  [k] x86_pmu_enable              
> >      0.04%     0.04%  perf     [kernel.vmlinux]  [k] native_apic_mem_write       
> > 
> 
> What's the problem?  Now by default callchains under 0.5% (absolute)
> will not be shown.  I think this is intended output, and we need to
> consider changing the default percent limit.

hm, just the TUI shows +- for entries with no callchain

jirka

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCHSET 00/12] perf tools: Apply percent-limit to callchains
  2016-01-26 15:18             ` Jiri Olsa
@ 2016-01-26 15:30               ` Arnaldo Carvalho de Melo
  2016-01-26 15:41                 ` Jiri Olsa
  0 siblings, 1 reply; 28+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-01-26 15:30 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Namhyung Kim, Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML,
	Andi Kleen, David Ahern, Frederic Weisbecker, Wang Nan

Em Tue, Jan 26, 2016 at 04:18:00PM +0100, Jiri Olsa escreveu:
> On Tue, Jan 26, 2016 at 11:49:07PM +0900, Namhyung Kim wrote:
> 
> SNIP
> 
> > >                __hrtimer_run_queues
> > >                tick_sched_timer
> > >                tick_sched_handle.isra.17
> > >                update_process_times
> > >                scheduler_tick
> > >                perf_event_task_tick
> > >                perf_pmu_enable.part.87
> > >                x86_pmu_enable
> > >                intel_pmu_enable_all
> > >                intel_bts_enable_local
> > > 
> > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_pmu_enable.part.87     
> > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_context_sched_in 
> > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_exec             
> > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] setup_new_exec              
> > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] load_elf_binary             
> > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] search_binary_handler       
> > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] do_execveat_common.isra.33  
> > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] sys_execve                  
> > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] return_from_execve          
> > >      0.08%     0.00%  perf     [unknown]         [k] 0x00007f2175b35e07          
> > >      0.04%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_nmi_handler      
> > >      0.04%     0.00%  perf     [kernel.vmlinux]  [k] nmi_handle                  
> > >      0.04%     0.00%  perf     [kernel.vmlinux]  [k] default_do_nmi              
> > >      0.04%     0.00%  perf     [kernel.vmlinux]  [k] do_nmi                      
> > >      0.04%     0.00%  perf     [kernel.vmlinux]  [k] end_repeat_nmi              
> > >      0.04%     0.04%  perf     [kernel.vmlinux]  [k] x86_pmu_enable              
> > >      0.04%     0.04%  perf     [kernel.vmlinux]  [k] native_apic_mem_write       
> > > 
> > 
> > What's the problem?  Now by default callchains under 0.5% (absolute)
> > will not be shown.  I think this is intended output, and we need to
> > consider changing the default percent limit.
> 
> hm, just the TUI shows +- for entries with no callchain

Humm, this is an old bug, never got around to try to fix it, or is this
something you were not experiencing before this patchkit from Namhyung?

- Arnaldo

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCHSET 00/12] perf tools: Apply percent-limit to callchains
  2016-01-26 15:30               ` Arnaldo Carvalho de Melo
@ 2016-01-26 15:41                 ` Jiri Olsa
  2016-01-26 15:54                   ` Namhyung Kim
  0 siblings, 1 reply; 28+ messages in thread
From: Jiri Olsa @ 2016-01-26 15:41 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Namhyung Kim, Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML,
	Andi Kleen, David Ahern, Frederic Weisbecker, Wang Nan

On Tue, Jan 26, 2016 at 12:30:36PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Jan 26, 2016 at 04:18:00PM +0100, Jiri Olsa escreveu:
> > On Tue, Jan 26, 2016 at 11:49:07PM +0900, Namhyung Kim wrote:
> > 
> > SNIP
> > 
> > > >                __hrtimer_run_queues
> > > >                tick_sched_timer
> > > >                tick_sched_handle.isra.17
> > > >                update_process_times
> > > >                scheduler_tick
> > > >                perf_event_task_tick
> > > >                perf_pmu_enable.part.87
> > > >                x86_pmu_enable
> > > >                intel_pmu_enable_all
> > > >                intel_bts_enable_local
> > > > 
> > > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_pmu_enable.part.87     
> > > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_context_sched_in 
> > > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_exec             
> > > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] setup_new_exec              
> > > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] load_elf_binary             
> > > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] search_binary_handler       
> > > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] do_execveat_common.isra.33  
> > > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] sys_execve                  
> > > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] return_from_execve          
> > > >      0.08%     0.00%  perf     [unknown]         [k] 0x00007f2175b35e07          
> > > >      0.04%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_nmi_handler      
> > > >      0.04%     0.00%  perf     [kernel.vmlinux]  [k] nmi_handle                  
> > > >      0.04%     0.00%  perf     [kernel.vmlinux]  [k] default_do_nmi              
> > > >      0.04%     0.00%  perf     [kernel.vmlinux]  [k] do_nmi                      
> > > >      0.04%     0.00%  perf     [kernel.vmlinux]  [k] end_repeat_nmi              
> > > >      0.04%     0.04%  perf     [kernel.vmlinux]  [k] x86_pmu_enable              
> > > >      0.04%     0.04%  perf     [kernel.vmlinux]  [k] native_apic_mem_write       
> > > > 
> > > 
> > > What's the problem?  Now by default callchains under 0.5% (absolute)
> > > will not be shown.  I think this is intended output, and we need to
> > > consider changing the default percent limit.
> > 
> > hm, just the TUI shows +- for entries with no callchain
> 
> Humm, this is an old bug, never got around to try to fix it, or is this
> something you were not experiencing before this patchkit from Namhyung?
> 

well, there were callchains present before this patchset ;-)

jirka

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCHSET 00/12] perf tools: Apply percent-limit to callchains
  2016-01-26 15:41                 ` Jiri Olsa
@ 2016-01-26 15:54                   ` Namhyung Kim
  2016-01-26 16:15                     ` Jiri Olsa
  0 siblings, 1 reply; 28+ messages in thread
From: Namhyung Kim @ 2016-01-26 15:54 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, Jiri Olsa,
	LKML, Andi Kleen, David Ahern, Frederic Weisbecker, Wang Nan

On Tue, Jan 26, 2016 at 04:41:16PM +0100, Jiri Olsa wrote:
> On Tue, Jan 26, 2016 at 12:30:36PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Tue, Jan 26, 2016 at 04:18:00PM +0100, Jiri Olsa escreveu:
> > > On Tue, Jan 26, 2016 at 11:49:07PM +0900, Namhyung Kim wrote:
> > > 
> > > SNIP
> > > 
> > > > >                __hrtimer_run_queues
> > > > >                tick_sched_timer
> > > > >                tick_sched_handle.isra.17
> > > > >                update_process_times
> > > > >                scheduler_tick
> > > > >                perf_event_task_tick
> > > > >                perf_pmu_enable.part.87
> > > > >                x86_pmu_enable
> > > > >                intel_pmu_enable_all
> > > > >                intel_bts_enable_local
> > > > > 
> > > > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_pmu_enable.part.87     
> > > > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_context_sched_in 
> > > > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_exec             
> > > > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] setup_new_exec              
> > > > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] load_elf_binary             
> > > > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] search_binary_handler       
> > > > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] do_execveat_common.isra.33  
> > > > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] sys_execve                  
> > > > >      0.08%     0.00%  perf     [kernel.vmlinux]  [k] return_from_execve          
> > > > >      0.08%     0.00%  perf     [unknown]         [k] 0x00007f2175b35e07          
> > > > >      0.04%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_nmi_handler      
> > > > >      0.04%     0.00%  perf     [kernel.vmlinux]  [k] nmi_handle                  
> > > > >      0.04%     0.00%  perf     [kernel.vmlinux]  [k] default_do_nmi              
> > > > >      0.04%     0.00%  perf     [kernel.vmlinux]  [k] do_nmi                      
> > > > >      0.04%     0.00%  perf     [kernel.vmlinux]  [k] end_repeat_nmi              
> > > > >      0.04%     0.04%  perf     [kernel.vmlinux]  [k] x86_pmu_enable              
> > > > >      0.04%     0.04%  perf     [kernel.vmlinux]  [k] native_apic_mem_write       
> > > > > 
> > > > 
> > > > What's the problem?  Now by default callchains under 0.5% (absolute)
> > > > will not be shown.  I think this is intended output, and we need to
> > > > consider changing the default percent limit.
> > > 
> > > hm, just the TUI shows +- for entries with no callchain
> > 
> > Humm, this is an old bug, never got around to try to fix it, or is this
> > something you were not experiencing before this patchkit from Namhyung?
> > 
> 
> well, there were callchains present before this patchset ;-)

That is because we apply percent limit to callchains now, and the
default is 0.5%.  Before this patchset percent limit seems not applied
so you saw the callchains under the limit.

Thanks,
Namhyung

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCHSET 00/12] perf tools: Apply percent-limit to callchains
  2016-01-26 15:54                   ` Namhyung Kim
@ 2016-01-26 16:15                     ` Jiri Olsa
  2016-01-27 13:21                       ` Namhyung Kim
  0 siblings, 1 reply; 28+ messages in thread
From: Jiri Olsa @ 2016-01-26 16:15 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, Jiri Olsa,
	LKML, Andi Kleen, David Ahern, Frederic Weisbecker, Wang Nan

On Wed, Jan 27, 2016 at 12:54:17AM +0900, Namhyung Kim wrote:

SNIP

> > > > > >      0.04%     0.04%  perf     [kernel.vmlinux]  [k] x86_pmu_enable              
> > > > > >      0.04%     0.04%  perf     [kernel.vmlinux]  [k] native_apic_mem_write       
> > > > > > 
> > > > > 
> > > > > What's the problem?  Now by default callchains under 0.5% (absolute)
> > > > > will not be shown.  I think this is intended output, and we need to
> > > > > consider changing the default percent limit.
> > > > 
> > > > hm, just the TUI shows +- for entries with no callchain
> > > 
> > > Humm, this is an old bug, never got around to try to fix it, or is this
> > > something you were not experiencing before this patchkit from Namhyung?
> > > 
> > 
> > well, there were callchains present before this patchset ;-)
> 
> That is because we apply percent limit to callchains now, and the
> default is 0.5%.  Before this patchset percent limit seems not applied
> so you saw the callchains under the limit.

I'm just saying that in TUI I see entries without callcains (which are filtered out)
but those entries are still marked with +- ... I dont know if that's some old issue

thanks,
jirka


---
+    0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_pmu_enable.part.87                                                              ▒
+    0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_context_sched_in                                                          ▒
+    0.08%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_exec                                                                      ▒
+    0.08%     0.00%  perf     [kernel.vmlinux]  [k] setup_new_exec                                                                       ▒
+    0.08%     0.00%  perf     [kernel.vmlinux]  [k] load_elf_binary                                                                      ▒
+    0.08%     0.00%  perf     [kernel.vmlinux]  [k] search_binary_handler                                                                ▒
+    0.08%     0.00%  perf     [kernel.vmlinux]  [k] do_execveat_common.isra.33                                                           ▒
+    0.08%     0.00%  perf     [kernel.vmlinux]  [k] sys_execve                                                                           ▒
-    0.08%     0.00%  perf     [kernel.vmlinux]  [k] return_from_execve                                                                   ▒
-    0.08%     0.00%  perf     [unknown]         [k] 0x00007f2175b35e07                                                                   ▒
-    0.04%     0.00%  perf     [kernel.vmlinux]  [k] perf_event_nmi_handler                                                               ▒
-    0.04%     0.00%  perf     [kernel.vmlinux]  [k] nmi_handle                                                                           ▒
-    0.04%     0.00%  perf     [kernel.vmlinux]  [k] default_do_nmi                                                                       ▒
-    0.04%     0.00%  perf     [kernel.vmlinux]  [k] do_nmi                                                                               ▒
-    0.04%     0.00%  perf     [kernel.vmlinux]  [k] end_repeat_nmi                                                                       ▒
-    0.04%     0.04%  perf     [kernel.vmlinux]  [k] x86_pmu_enable                                                                       ▒
-    0.04%     0.04%  perf     [kernel.vmlinux]  [k] native_apic_mem_write                                                                ▒

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCHSET 00/12] perf tools: Apply percent-limit to callchains
  2016-01-26 16:15                     ` Jiri Olsa
@ 2016-01-27 13:21                       ` Namhyung Kim
  0 siblings, 0 replies; 28+ messages in thread
From: Namhyung Kim @ 2016-01-27 13:21 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, Jiri Olsa,
	LKML, Andi Kleen, David Ahern, Frederic Weisbecker, Wang Nan

Hi Jiri,

On Tue, Jan 26, 2016 at 05:15:18PM +0100, Jiri Olsa wrote:
> On Wed, Jan 27, 2016 at 12:54:17AM +0900, Namhyung Kim wrote:
> 
> SNIP
> 
> > > > > > >      0.04%     0.04%  perf     [kernel.vmlinux]  [k] x86_pmu_enable              
> > > > > > >      0.04%     0.04%  perf     [kernel.vmlinux]  [k] native_apic_mem_write       
> > > > > > > 
> > > > > > 
> > > > > > What's the problem?  Now by default callchains under 0.5% (absolute)
> > > > > > will not be shown.  I think this is intended output, and we need to
> > > > > > consider changing the default percent limit.
> > > > > 
> > > > > hm, just the TUI shows +- for entries with no callchain
> > > > 
> > > > Humm, this is an old bug, never got around to try to fix it, or is this
> > > > something you were not experiencing before this patchkit from Namhyung?
> > > > 
> > > 
> > > well, there were callchains present before this patchset ;-)
> > 
> > That is because we apply percent limit to callchains now, and the
> > default is 0.5%.  Before this patchset percent limit seems not applied
> > so you saw the callchains under the limit.
> 
> I'm just saying that in TUI I see entries without callcains (which are filtered out)
> but those entries are still marked with +- ... I dont know if that's some old issue

Ah, ok.  So you don't like the spurious folded signs..

Anyway, on second thoughts, it should be checked when sorting
callchains instead of print time.  This way we can reduce the
duplicated code here and there, and it won't show spurious signs
anymore IMHO.

Looking at the source it already have the logic indeed!  But it didn't
work for some reason.  It seems that it's because we don't have hists'
total period at the time of hists__output_resort() called.  So the
min_callchain_hits always set to 0 and no limit was applied.

I'll send a fix for the problem along with others soon.

Thanks,
Namhyung

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2016-01-27 13:23 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-24 13:53 [PATCHSET 00/12] perf tools: Apply percent-limit to callchains Namhyung Kim
2016-01-24 13:53 ` [PATCH 01/12] perf report: Apply --percent-limit to callchains also Namhyung Kim
2016-01-24 13:53 ` [PATCH 02/12] perf report: Apply callchain percent limit on --stdio Namhyung Kim
2016-01-24 13:53 ` [PATCH 03/12] perf report: Get rid of hist_entry__callchain_fprintf() Namhyung Kim
2016-01-24 13:53 ` [PATCH 04/12] perf report: Fix percent calculation on --stdio Namhyung Kim
2016-01-24 13:53 ` [PATCH 05/12] perf report: Hide output pipe for percent-limited callchains on stdio Namhyung Kim
2016-01-24 13:53 ` [PATCH 06/12] perf hists browser: Fix dump to show correct callchain style Namhyung Kim
2016-01-24 13:53 ` [PATCH 07/12] perf hists browser: Fix callchain_node__count_rows() Namhyung Kim
2016-01-26 11:46   ` Jiri Olsa
2016-01-26 12:32     ` Namhyung Kim
2016-01-24 13:53 ` [PATCH 08/12] perf hists browser: Apply callchain percent limit Namhyung Kim
2016-01-24 13:53 ` [PATCH 09/12] perf hists browser: Fix callchain counting when press ENTER key Namhyung Kim
2016-01-24 13:53 ` [PATCH 10/12] perf hists browser: Fix counting callchains when expand/collapse all Namhyung Kim
2016-01-24 13:53 ` [PATCH 11/12] perf hists browser: Update percent base for fractal callchain mode Namhyung Kim
2016-01-24 13:53 ` [PATCH 12/12] perf report: Fix callchain percent limit on --gtk Namhyung Kim
2016-01-25  2:16 ` [PATCHSET 00/12] perf tools: Apply percent-limit to callchains Andi Kleen
2016-01-26 12:14 ` Jiri Olsa
2016-01-26 12:51   ` Namhyung Kim
2016-01-26 13:27     ` Jiri Olsa
2016-01-26 14:10       ` Namhyung Kim
2016-01-26 14:41         ` Jiri Olsa
2016-01-26 14:49           ` Namhyung Kim
2016-01-26 15:18             ` Jiri Olsa
2016-01-26 15:30               ` Arnaldo Carvalho de Melo
2016-01-26 15:41                 ` Jiri Olsa
2016-01-26 15:54                   ` Namhyung Kim
2016-01-26 16:15                     ` Jiri Olsa
2016-01-27 13:21                       ` Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).