All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] perf hists: Add more helper functions for the hierarchy mode
@ 2016-02-26 12:13 Namhyung Kim
  2016-02-26 12:13 ` [PATCH 2/5] perf report: Show message for percent limit on stdio Namhyung Kim
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Namhyung Kim @ 2016-02-26 12:13 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern,
	Andi Kleen, Stephane Eranian, Wang Nan

The hists__overhead_width() is to calculate width occupied by the
overhead (and others) columns before the sort columns.

The hist_entry__has_hiearchy_children() is to check whether an entry has
lower entries (children) in the hierarchy to be shown in the output.
This means the children should not be filtered out and above the percent
limit.

These two functions will be used to show information when all children
of an entry is omitted by the percent limit (or filter).

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/ui/hist.c   | 22 ++++++++++++++++++++++
 tools/perf/util/hist.c | 25 +++++++++++++++++++++++++
 tools/perf/util/hist.h |  3 +++
 3 files changed, 50 insertions(+)

diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index edbf854e8e1c..7c0585c146e1 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -643,6 +643,28 @@ unsigned int hists__sort_list_width(struct hists *hists)
 	return ret;
 }
 
+unsigned int hists__overhead_width(struct hists *hists)
+{
+	struct perf_hpp_fmt *fmt;
+	int ret = 0;
+	bool first = true;
+	struct perf_hpp dummy_hpp;
+
+	hists__for_each_format(hists, fmt) {
+		if (perf_hpp__is_sort_entry(fmt) || perf_hpp__is_dynamic_entry(fmt))
+			break;
+
+		if (first)
+			first = false;
+		else
+			ret += 2;
+
+		ret += fmt->width(fmt, &dummy_hpp, hists_to_evsel(hists));
+	}
+
+	return ret;
+}
+
 void perf_hpp__reset_width(struct perf_hpp_fmt *fmt, struct hists *hists)
 {
 	if (perf_hpp__is_sort_entry(fmt))
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 1c530428e087..e71691977a95 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -1582,6 +1582,31 @@ struct rb_node *rb_hierarchy_prev(struct rb_node *node)
 	return &he->rb_node;
 }
 
+bool hist_entry__has_hierarchy_children(struct hist_entry *he, float limit)
+{
+	struct rb_node *node;
+	struct hist_entry *child;
+	float percent;
+
+	if (he->leaf)
+		return false;
+
+	node = rb_first(&he->hroot_out);
+	child = rb_entry(node, struct hist_entry, rb_node);
+
+	while (node && child->filtered) {
+		node = rb_next(node);
+		child = rb_entry(node, struct hist_entry, rb_node);
+	}
+
+	if (node)
+		percent = hist_entry__get_percent_limit(child);
+	else
+		percent = 0;
+
+	return node && percent >= limit;
+}
+
 static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h,
 				       enum hist_filter filter)
 {
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 722aa447f705..da3e7b6e4615 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -410,6 +410,7 @@ static inline int script_browse(const char *script_opt __maybe_unused)
 #endif
 
 unsigned int hists__sort_list_width(struct hists *hists);
+unsigned int hists__overhead_width(struct hists *hists);
 
 void hist__account_cycles(struct branch_stack *bs, struct addr_location *al,
 			  struct perf_sample *sample, bool nonany_branch_mode);
@@ -439,4 +440,6 @@ static inline struct rb_node *rb_hierarchy_next(struct rb_node *node)
 
 #define HIERARCHY_INDENT  3
 
+bool hist_entry__has_hierarchy_children(struct hist_entry *he, float limit);
+
 #endif	/* __PERF_HIST_H */
-- 
2.7.1

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

* [PATCH 2/5] perf report: Show message for percent limit on stdio
  2016-02-26 12:13 [PATCH 1/5] perf hists: Add more helper functions for the hierarchy mode Namhyung Kim
@ 2016-02-26 12:13 ` Namhyung Kim
  2016-02-26 14:15   ` Arnaldo Carvalho de Melo
                     ` (2 more replies)
  2016-02-26 12:13 ` [PATCH 3/5] perf hists browser: Cleanup hist_browser__update_percent_limit() Namhyung Kim
                   ` (3 subsequent siblings)
  4 siblings, 3 replies; 13+ messages in thread
From: Namhyung Kim @ 2016-02-26 12:13 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern,
	Andi Kleen, Stephane Eranian, Wang Nan

When the hierarchy mode is used, some entries might be omiited due to a
percent limit or filter.  In this case the output hierarchy is different
than other entries.  Add an informative message to users about this.

For example, when 4% of percent limit is applied:

Before:
  #       Overhead  Command / Shared Object / Symbol
  # ..............  ..........................................
  #
      49.09%        swapper
         48.67%        [kernel.vmlinux]
            34.42%        [k] intel_idle
      11.51%        firefox
          8.87%        libpthread-2.22.so
             6.60%        [.] __GI___libc_recvmsg
      10.49%        gnome-shell
          4.74%        libc-2.22.so
      10.08%        Xorg
          6.11%        libc-2.22.so
             5.27%        [.] __memcpy_sse2_unaligned
       6.15%        perf

Note that, gnome-shell/libc has no symbols and perf has no dso/symbols.
With that patch the output will look like below:

After:

  #       Overhead  Command / Shared Object / Symbol
  # ..............  ..........................................
  #
      49.09%        swapper
         48.67%        [kernel.vmlinux]
            34.42%        [k] intel_idle
      11.51%        firefox
          8.87%        libpthread-2.22.so
             6.60%        [.] __GI___libc_recvmsg
      10.49%        gnome-shell
          4.74%        libc-2.22.so
                          no entry >= 4.00%
      10.08%        Xorg
          6.11%        libc-2.22.so
             5.27%        [.] __memcpy_sse2_unaligned
       6.15%        perf
                       no entry >= 4.00%

Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/ui/stdio/hist.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 435eaaaf2f1d..b3bdfcb245f9 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -628,6 +628,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
 	bool first = true;
 	size_t linesz;
 	char *line = NULL;
+	unsigned indent;
 
 	init_rem_hits();
 
@@ -704,6 +705,8 @@ print_entries:
 		goto out;
 	}
 
+	indent = hists__overhead_width(hists) + 4;
+
 	for (nd = rb_first(&hists->entries); nd; nd = __rb_hierarchy_next(nd, HMD_FORCE_CHILD)) {
 		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
 		float percent;
@@ -720,6 +723,20 @@ print_entries:
 		if (max_rows && ++nr_rows >= max_rows)
 			break;
 
+		/*
+		 * If all children are filtered out or percent-limited,
+		 * display "no entry >= x.xx%" message.
+		 */
+		if (!h->leaf && !hist_entry__has_hierarchy_children(h, min_pcnt)) {
+			int nr_sort = hists->hpp_list->nr_sort_keys;
+
+			print_hierarchy_indent(sep, nr_sort + h->depth + 1, spaces, fp);
+			fprintf(fp, "%*sno entry >= %.2f%%\n", indent, "", min_pcnt);
+
+			if (max_rows && ++nr_rows >= max_rows)
+				break;
+		}
+
 		if (h->ms.map == NULL && verbose > 1) {
 			__map_groups__fprintf_maps(h->thread->mg,
 						   MAP__FUNCTION, fp);
-- 
2.7.1

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

* [PATCH 3/5] perf hists browser: Cleanup hist_browser__update_percent_limit()
  2016-02-26 12:13 [PATCH 1/5] perf hists: Add more helper functions for the hierarchy mode Namhyung Kim
  2016-02-26 12:13 ` [PATCH 2/5] perf report: Show message for percent limit on stdio Namhyung Kim
@ 2016-02-26 12:13 ` Namhyung Kim
  2016-02-27  9:42   ` [tip:perf/core] " tip-bot for Namhyung Kim
  2016-02-26 12:13 ` [PATCH 4/5] perf hists browser: Show message for percent limit Namhyung Kim
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Namhyung Kim @ 2016-02-26 12:13 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern,
	Andi Kleen, Stephane Eranian, Wang Nan

The previous patch introduced __rb_hierarchy_next() function with
various move direction like HMD_FORCE_CHILD but missed to change using
it some place.

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

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 6bcd7670ce5f..904eaa719eb3 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2477,12 +2477,7 @@ static void hist_browser__update_percent_limit(struct hist_browser *hb,
 				     min_callchain_hits, &callchain_param);
 
 next:
-		/*
-		 * Tentatively set unfolded so that the rb_hierarchy_next()
-		 * can toggle children of folded entries too.
-		 */
-		he->unfolded = he->has_children;
-		nd = rb_hierarchy_next(nd);
+		nd = __rb_hierarchy_next(nd, HMD_FORCE_CHILD);
 
 		/* force to re-evaluate folding state of callchains */
 		he->init_have_children = false;
-- 
2.7.1

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

* [PATCH 4/5] perf hists browser: Show message for percent limit
  2016-02-26 12:13 [PATCH 1/5] perf hists: Add more helper functions for the hierarchy mode Namhyung Kim
  2016-02-26 12:13 ` [PATCH 2/5] perf report: Show message for percent limit on stdio Namhyung Kim
  2016-02-26 12:13 ` [PATCH 3/5] perf hists browser: Cleanup hist_browser__update_percent_limit() Namhyung Kim
@ 2016-02-26 12:13 ` Namhyung Kim
  2016-02-27  9:42   ` [tip:perf/core] " tip-bot for Namhyung Kim
  2016-02-26 12:13 ` [PATCH 5/5] perf report: Show message for percent limit on gtk Namhyung Kim
  2016-02-27  9:41 ` [tip:perf/core] perf hists: Add more helper functions for the hierarchy mode tip-bot for Namhyung Kim
  4 siblings, 1 reply; 13+ messages in thread
From: Namhyung Kim @ 2016-02-26 12:13 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern,
	Andi Kleen, Stephane Eranian, Wang Nan

Like the stdio, it should show messages about omitted hierarchy
entries.  Please refer the previous commit for more details.

As it needs to check an entry is omitted or not multiple times, add the
has_no_entry field in the hist entry.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/ui/browsers/hists.c | 99 ++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/hist.c         |  2 +
 tools/perf/util/sort.h         |  1 +
 3 files changed, 102 insertions(+)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 904eaa719eb3..71c6d510390f 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -260,6 +260,9 @@ static int hierarchy_count_rows(struct hist_browser *hb, struct hist_entry *he,
 	if (he->leaf)
 		return callchain__count_rows(&he->sorted_chain);
 
+	if (he->has_no_entry)
+		return 1;
+
 	node = rb_first(&he->hroot_out);
 	while (node) {
 		float percent;
@@ -409,10 +412,18 @@ static bool hist_browser__toggle_fold(struct hist_browser *browser)
 			/* account grand children */
 			if (symbol_conf.report_hierarchy)
 				browser->b.nr_entries += child_rows - he->nr_rows;
+
+			if (!he->leaf && he->nr_rows == 0) {
+				he->has_no_entry = true;
+				he->nr_rows = 1;
+			}
 		} else {
 			if (symbol_conf.report_hierarchy)
 				browser->b.nr_entries -= child_rows - he->nr_rows;
 
+			if (he->has_no_entry)
+				he->has_no_entry = false;
+
 			he->nr_rows = 0;
 		}
 
@@ -545,6 +556,12 @@ __hist_browser__set_folding(struct hist_browser *browser, bool unfold)
 			browser->nr_hierarchy_entries++;
 		if (he->leaf)
 			browser->nr_callchain_rows += he->nr_rows;
+		else if (unfold && !hist_entry__has_hierarchy_children(he, browser->min_pcnt)) {
+			browser->nr_hierarchy_entries++;
+			he->has_no_entry = true;
+			he->nr_rows = 1;
+		} else
+			he->has_no_entry = false;
 	}
 }
 
@@ -1412,6 +1429,75 @@ show_callchain:
 	return printed;
 }
 
+static int hist_browser__show_no_entry(struct hist_browser *browser,
+				       unsigned short row,
+				       int level, int nr_sort_keys)
+{
+	int width = browser->b.width;
+	bool current_entry = ui_browser__is_current_entry(&browser->b, row);
+	bool first = true;
+	int column = 0;
+	int ret;
+	struct perf_hpp_fmt *fmt;
+
+	if (current_entry) {
+		browser->he_selection = NULL;
+		browser->selection = NULL;
+	}
+
+	hist_browser__gotorc(browser, row, 0);
+
+	if (current_entry && browser->b.navkeypressed)
+		ui_browser__set_color(&browser->b, HE_COLORSET_SELECTED);
+	else
+		ui_browser__set_color(&browser->b, HE_COLORSET_NORMAL);
+
+	ui_browser__write_nstring(&browser->b, "", level * HIERARCHY_INDENT);
+	width -= level * HIERARCHY_INDENT;
+
+	hists__for_each_format(browser->hists, fmt) {
+		if (perf_hpp__should_skip(fmt, browser->hists) ||
+		    column++ < browser->b.horiz_scroll)
+			continue;
+
+		if (perf_hpp__is_sort_entry(fmt) ||
+		    perf_hpp__is_dynamic_entry(fmt))
+			break;
+
+		ret = fmt->width(fmt, NULL, hists_to_evsel(browser->hists));
+
+		if (first) {
+			/* for folded sign */
+			first = false;
+			ret++;
+		} else {
+			/* space between columns */
+			ret += 2;
+		}
+
+		ui_browser__write_nstring(&browser->b, "", ret);
+		width -= ret;
+	}
+
+	ui_browser__write_nstring(&browser->b, "", nr_sort_keys * HIERARCHY_INDENT);
+	width -= nr_sort_keys * HIERARCHY_INDENT;
+
+	if (column >= browser->b.horiz_scroll) {
+		char buf[32];
+
+		ret = snprintf(buf, sizeof(buf), "no entry >= %.2f%%", browser->min_pcnt);
+		ui_browser__printf(&browser->b, "  %s", buf);
+		width -= ret + 2;
+	}
+
+	/* The scroll bar isn't being used */
+	if (!browser->b.navkeypressed)
+		width += 1;
+
+	ui_browser__write_nstring(&browser->b, "", width);
+	return 1;
+}
+
 static int advance_hpp_check(struct perf_hpp *hpp, int inc)
 {
 	advance_hpp(hpp, inc);
@@ -1575,6 +1661,14 @@ static unsigned int hist_browser__refresh(struct ui_browser *browser)
 			row += hist_browser__show_hierarchy_entry(hb, h, row,
 								  h->depth,
 								  nr_sort);
+			if (row == browser->rows)
+				break;
+
+			if (h->has_no_entry) {
+				hist_browser__show_no_entry(hb, row, h->depth,
+							    nr_sort);
+				row++;
+			}
 		} else {
 			row += hist_browser__show_entry(hb, h, row);
 		}
@@ -2461,6 +2555,11 @@ static void hist_browser__update_percent_limit(struct hist_browser *hb,
 	while ((nd = hists__filter_entries(nd, hb->min_pcnt)) != NULL) {
 		he = rb_entry(nd, struct hist_entry, rb_node);
 
+		if (he->has_no_entry) {
+			he->has_no_entry = false;
+			he->nr_rows = 0;
+		}
+
 		if (!he->leaf || !symbol_conf.use_callchain)
 			goto next;
 
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index e71691977a95..75dc41d2dca9 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -1625,6 +1625,7 @@ static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h
 
 			/* force fold unfiltered entry for simplicity */
 			parent->unfolded = false;
+			parent->has_no_entry = false;
 			parent->row_offset = 0;
 			parent->nr_rows = 0;
 next:
@@ -1637,6 +1638,7 @@ next:
 
 	/* force fold unfiltered entry for simplicity */
 	h->unfolded = false;
+	h->has_no_entry = false;
 	h->row_offset = 0;
 	h->nr_rows = 0;
 
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index a8d53ffe0916..25a5529a94e4 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -117,6 +117,7 @@ struct hist_entry {
 			bool	init_have_children;
 			bool	unfolded;
 			bool	has_children;
+			bool	has_no_entry;
 		};
 	};
 	char			*srcline;
-- 
2.7.1

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

* [PATCH 5/5] perf report: Show message for percent limit on gtk
  2016-02-26 12:13 [PATCH 1/5] perf hists: Add more helper functions for the hierarchy mode Namhyung Kim
                   ` (2 preceding siblings ...)
  2016-02-26 12:13 ` [PATCH 4/5] perf hists browser: Show message for percent limit Namhyung Kim
@ 2016-02-26 12:13 ` Namhyung Kim
  2016-02-27  9:42   ` [tip:perf/core] " tip-bot for Namhyung Kim
  2016-02-27  9:41 ` [tip:perf/core] perf hists: Add more helper functions for the hierarchy mode tip-bot for Namhyung Kim
  4 siblings, 1 reply; 13+ messages in thread
From: Namhyung Kim @ 2016-02-26 12:13 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern,
	Andi Kleen, Stephane Eranian, Wang Nan

Like the stdio, it should show messages about omitted hierarchy
entries.  Please refer the previous commit for more details.

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

diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index 7f343339eae7..a5758fdfbe1f 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -449,6 +449,17 @@ static void perf_gtk__add_hierarchy_entries(struct hists *hists,
 			perf_gtk__add_hierarchy_entries(hists, &he->hroot_out,
 							store, &iter, hpp,
 							min_pcnt);
+
+			if (!hist_entry__has_hierarchy_children(he, min_pcnt)) {
+				char buf[32];
+				GtkTreeIter child;
+
+				snprintf(buf, sizeof(buf), "no entry >= %.2f%%",
+					 min_pcnt);
+
+				gtk_tree_store_append(store, &child, &iter);
+				gtk_tree_store_set(store, &child, col_idx, buf, -1);
+			}
 		}
 
 		if (symbol_conf.use_callchain && he->leaf) {
-- 
2.7.1

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

* Re: [PATCH 2/5] perf report: Show message for percent limit on stdio
  2016-02-26 12:13 ` [PATCH 2/5] perf report: Show message for percent limit on stdio Namhyung Kim
@ 2016-02-26 14:15   ` Arnaldo Carvalho de Melo
  2016-02-27  9:41   ` [tip:perf/core] " tip-bot for Namhyung Kim
  2016-03-30 14:12   ` [PATCH 2/5] " Arnaldo Carvalho de Melo
  2 siblings, 0 replies; 13+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-02-26 14:15 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern,
	Andi Kleen, Stephane Eranian, Wang Nan

Em Fri, Feb 26, 2016 at 09:13:17PM +0900, Namhyung Kim escreveu:
> When the hierarchy mode is used, some entries might be omiited due to a
> percent limit or filter.  In this case the output hierarchy is different
> than other entries.  Add an informative message to users about this.
> 
> For example, when 4% of percent limit is applied:
> 
> Before:
>   #       Overhead  Command / Shared Object / Symbol
>   # ..............  ..........................................
>   #
>       49.09%        swapper
>          48.67%        [kernel.vmlinux]
>             34.42%        [k] intel_idle
>       11.51%        firefox
>           8.87%        libpthread-2.22.so
>              6.60%        [.] __GI___libc_recvmsg
>       10.49%        gnome-shell
>           4.74%        libc-2.22.so
>       10.08%        Xorg
>           6.11%        libc-2.22.so
>              5.27%        [.] __memcpy_sse2_unaligned
>        6.15%        perf

That is great, and while testing it another idea came to me, what about
telling how many entries are below the threshold (--percent-limit)?

Something like:

    47.60%        firefox        
       44.98%        libxul.so                   
          11.01%        [.] 0x0000000001187918
          10.84%        [.] 0x0000000001187a5c
           3.10%        [.] 0x00000000011875c9
           1.62%        [.] 0x000000000118792b
           1.47%        [.] 0x00000000011875d8
           1.39%        [.] 0x0000000001187a6f
           1.31%        [.] 0x0000000001187a4a
           1.27%        [.] 0x0000000001187906
        1.45%        perf-9205.map               
                        no entry >= 1.00%
    33.40%        swapper        
       33.35%        [kernel.vmlinux]            
          30.50%        [k] intel_idle
			25 entries < 1%
    14.86%        qemu-system-x86
        7.58%        [kvm]                       
           2.40%        [k] kvm_arch_vcpu_runnable
           1.03%        [k] kvm_vcpu_check_block
			1 entry < 1%

Another: pressing enter over these 'no entry >= M%' and 'N entries < M%'
         would show those entries, for that specific point.

One more: Make '1.00%' appear as '1%' no need for .00, it adds no
information and takes precious screen space.

Thanks! Applying this patch and looking at the others in this patchkit,

- Arnaldo
 
> Note that, gnome-shell/libc has no symbols and perf has no dso/symbols.
> With that patch the output will look like below:
> 
> After:
> 
>   #       Overhead  Command / Shared Object / Symbol
>   # ..............  ..........................................
>   #
>       49.09%        swapper
>          48.67%        [kernel.vmlinux]
>             34.42%        [k] intel_idle
>       11.51%        firefox
>           8.87%        libpthread-2.22.so
>              6.60%        [.] __GI___libc_recvmsg
>       10.49%        gnome-shell
>           4.74%        libc-2.22.so
>                           no entry >= 4.00%
>       10.08%        Xorg
>           6.11%        libc-2.22.so
>              5.27%        [.] __memcpy_sse2_unaligned
>        6.15%        perf
>                        no entry >= 4.00%
> 
> Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/ui/stdio/hist.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
> index 435eaaaf2f1d..b3bdfcb245f9 100644
> --- a/tools/perf/ui/stdio/hist.c
> +++ b/tools/perf/ui/stdio/hist.c
> @@ -628,6 +628,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
>  	bool first = true;
>  	size_t linesz;
>  	char *line = NULL;
> +	unsigned indent;
>  
>  	init_rem_hits();
>  
> @@ -704,6 +705,8 @@ print_entries:
>  		goto out;
>  	}
>  
> +	indent = hists__overhead_width(hists) + 4;
> +
>  	for (nd = rb_first(&hists->entries); nd; nd = __rb_hierarchy_next(nd, HMD_FORCE_CHILD)) {
>  		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
>  		float percent;
> @@ -720,6 +723,20 @@ print_entries:
>  		if (max_rows && ++nr_rows >= max_rows)
>  			break;
>  
> +		/*
> +		 * If all children are filtered out or percent-limited,
> +		 * display "no entry >= x.xx%" message.
> +		 */
> +		if (!h->leaf && !hist_entry__has_hierarchy_children(h, min_pcnt)) {
> +			int nr_sort = hists->hpp_list->nr_sort_keys;
> +
> +			print_hierarchy_indent(sep, nr_sort + h->depth + 1, spaces, fp);
> +			fprintf(fp, "%*sno entry >= %.2f%%\n", indent, "", min_pcnt);
> +
> +			if (max_rows && ++nr_rows >= max_rows)
> +				break;
> +		}
> +
>  		if (h->ms.map == NULL && verbose > 1) {
>  			__map_groups__fprintf_maps(h->thread->mg,
>  						   MAP__FUNCTION, fp);
> -- 
> 2.7.1

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

* [tip:perf/core] perf hists: Add more helper functions for the hierarchy mode
  2016-02-26 12:13 [PATCH 1/5] perf hists: Add more helper functions for the hierarchy mode Namhyung Kim
                   ` (3 preceding siblings ...)
  2016-02-26 12:13 ` [PATCH 5/5] perf report: Show message for percent limit on gtk Namhyung Kim
@ 2016-02-27  9:41 ` tip-bot for Namhyung Kim
  4 siblings, 0 replies; 13+ messages in thread
From: tip-bot for Namhyung Kim @ 2016-02-27  9:41 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: andi, acme, mingo, eranian, namhyung, tglx, wangnan0, dsahern,
	jolsa, peterz, hpa, linux-kernel

Commit-ID:  a7b5895b91fb97f2b0dcc2e3ce47413c18d19ca5
Gitweb:     http://git.kernel.org/tip/a7b5895b91fb97f2b0dcc2e3ce47413c18d19ca5
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Fri, 26 Feb 2016 21:13:16 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 26 Feb 2016 11:20:35 -0300

perf hists: Add more helper functions for the hierarchy mode

The hists__overhead_width() is to calculate width occupied by the
overhead (and others) columns before the sort columns.

The hist_entry__has_hiearchy_children() is to check whether an entry has
lower entries (children) in the hierarchy to be shown in the output.
This means the children should not be filtered out and above the percent
limit.

These two functions will be used to show information when all children
of an entry is omitted by the percent limit (or filter).

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1456488800-28124-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/hist.c   | 22 ++++++++++++++++++++++
 tools/perf/util/hist.c | 25 +++++++++++++++++++++++++
 tools/perf/util/hist.h |  3 +++
 3 files changed, 50 insertions(+)

diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index edbf854..7c0585c 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -643,6 +643,28 @@ unsigned int hists__sort_list_width(struct hists *hists)
 	return ret;
 }
 
+unsigned int hists__overhead_width(struct hists *hists)
+{
+	struct perf_hpp_fmt *fmt;
+	int ret = 0;
+	bool first = true;
+	struct perf_hpp dummy_hpp;
+
+	hists__for_each_format(hists, fmt) {
+		if (perf_hpp__is_sort_entry(fmt) || perf_hpp__is_dynamic_entry(fmt))
+			break;
+
+		if (first)
+			first = false;
+		else
+			ret += 2;
+
+		ret += fmt->width(fmt, &dummy_hpp, hists_to_evsel(hists));
+	}
+
+	return ret;
+}
+
 void perf_hpp__reset_width(struct perf_hpp_fmt *fmt, struct hists *hists)
 {
 	if (perf_hpp__is_sort_entry(fmt))
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 1c53042..e716919 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -1582,6 +1582,31 @@ struct rb_node *rb_hierarchy_prev(struct rb_node *node)
 	return &he->rb_node;
 }
 
+bool hist_entry__has_hierarchy_children(struct hist_entry *he, float limit)
+{
+	struct rb_node *node;
+	struct hist_entry *child;
+	float percent;
+
+	if (he->leaf)
+		return false;
+
+	node = rb_first(&he->hroot_out);
+	child = rb_entry(node, struct hist_entry, rb_node);
+
+	while (node && child->filtered) {
+		node = rb_next(node);
+		child = rb_entry(node, struct hist_entry, rb_node);
+	}
+
+	if (node)
+		percent = hist_entry__get_percent_limit(child);
+	else
+		percent = 0;
+
+	return node && percent >= limit;
+}
+
 static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h,
 				       enum hist_filter filter)
 {
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 722aa44..da3e7b6 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -410,6 +410,7 @@ static inline int script_browse(const char *script_opt __maybe_unused)
 #endif
 
 unsigned int hists__sort_list_width(struct hists *hists);
+unsigned int hists__overhead_width(struct hists *hists);
 
 void hist__account_cycles(struct branch_stack *bs, struct addr_location *al,
 			  struct perf_sample *sample, bool nonany_branch_mode);
@@ -439,4 +440,6 @@ static inline struct rb_node *rb_hierarchy_next(struct rb_node *node)
 
 #define HIERARCHY_INDENT  3
 
+bool hist_entry__has_hierarchy_children(struct hist_entry *he, float limit);
+
 #endif	/* __PERF_HIST_H */

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

* [tip:perf/core] perf report: Show message for percent limit on stdio
  2016-02-26 12:13 ` [PATCH 2/5] perf report: Show message for percent limit on stdio Namhyung Kim
  2016-02-26 14:15   ` Arnaldo Carvalho de Melo
@ 2016-02-27  9:41   ` tip-bot for Namhyung Kim
  2016-03-30 14:12   ` [PATCH 2/5] " Arnaldo Carvalho de Melo
  2 siblings, 0 replies; 13+ messages in thread
From: tip-bot for Namhyung Kim @ 2016-02-27  9:41 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: peterz, acme, mingo, tglx, linux-kernel, wangnan0, namhyung, hpa,
	dsahern, acme, andi, eranian, jolsa

Commit-ID:  bd4abd39db92225dde8335c37d6f4efb319f9cf2
Gitweb:     http://git.kernel.org/tip/bd4abd39db92225dde8335c37d6f4efb319f9cf2
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Fri, 26 Feb 2016 21:13:17 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 26 Feb 2016 11:20:36 -0300

perf report: Show message for percent limit on stdio

When the hierarchy mode is used, some entries might be omiited due to a
percent limit or filter.  In this case the output hierarchy is different
than other entries.  Add an informative message to users about this.

For example, when 4% of percent limit is applied:

Before:
  #       Overhead  Command / Shared Object / Symbol
  # ..............  ..........................................
  #
      49.09%        swapper
         48.67%        [kernel.vmlinux]
            34.42%        [k] intel_idle
      11.51%        firefox
          8.87%        libpthread-2.22.so
             6.60%        [.] __GI___libc_recvmsg
      10.49%        gnome-shell
          4.74%        libc-2.22.so
      10.08%        Xorg
          6.11%        libc-2.22.so
             5.27%        [.] __memcpy_sse2_unaligned
       6.15%        perf

Note that, gnome-shell/libc has no symbols and perf has no dso/symbols.
With that patch the output will look like below:

After:

  #       Overhead  Command / Shared Object / Symbol
  # ..............  ..........................................
  #
      49.09%        swapper
         48.67%        [kernel.vmlinux]
            34.42%        [k] intel_idle
      11.51%        firefox
          8.87%        libpthread-2.22.so
             6.60%        [.] __GI___libc_recvmsg
      10.49%        gnome-shell
          4.74%        libc-2.22.so
                          no entry >= 4.00%
      10.08%        Xorg
          6.11%        libc-2.22.so
             5.27%        [.] __memcpy_sse2_unaligned
       6.15%        perf
                       no entry >= 4.00%

Suggested-and-Tested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1456488800-28124-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/stdio/hist.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 435eaaa..b3bdfcb 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -628,6 +628,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
 	bool first = true;
 	size_t linesz;
 	char *line = NULL;
+	unsigned indent;
 
 	init_rem_hits();
 
@@ -704,6 +705,8 @@ print_entries:
 		goto out;
 	}
 
+	indent = hists__overhead_width(hists) + 4;
+
 	for (nd = rb_first(&hists->entries); nd; nd = __rb_hierarchy_next(nd, HMD_FORCE_CHILD)) {
 		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
 		float percent;
@@ -720,6 +723,20 @@ print_entries:
 		if (max_rows && ++nr_rows >= max_rows)
 			break;
 
+		/*
+		 * If all children are filtered out or percent-limited,
+		 * display "no entry >= x.xx%" message.
+		 */
+		if (!h->leaf && !hist_entry__has_hierarchy_children(h, min_pcnt)) {
+			int nr_sort = hists->hpp_list->nr_sort_keys;
+
+			print_hierarchy_indent(sep, nr_sort + h->depth + 1, spaces, fp);
+			fprintf(fp, "%*sno entry >= %.2f%%\n", indent, "", min_pcnt);
+
+			if (max_rows && ++nr_rows >= max_rows)
+				break;
+		}
+
 		if (h->ms.map == NULL && verbose > 1) {
 			__map_groups__fprintf_maps(h->thread->mg,
 						   MAP__FUNCTION, fp);

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

* [tip:perf/core] perf hists browser: Cleanup hist_browser__update_percent_limit()
  2016-02-26 12:13 ` [PATCH 3/5] perf hists browser: Cleanup hist_browser__update_percent_limit() Namhyung Kim
@ 2016-02-27  9:42   ` tip-bot for Namhyung Kim
  0 siblings, 0 replies; 13+ messages in thread
From: tip-bot for Namhyung Kim @ 2016-02-27  9:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: wangnan0, tglx, peterz, dsahern, acme, hpa, eranian,
	linux-kernel, jolsa, andi, namhyung, mingo

Commit-ID:  201fde73b111e7c31fdc0e9fa6bc4b73dfef699d
Gitweb:     http://git.kernel.org/tip/201fde73b111e7c31fdc0e9fa6bc4b73dfef699d
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Fri, 26 Feb 2016 21:13:18 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 26 Feb 2016 11:20:36 -0300

perf hists browser: Cleanup hist_browser__update_percent_limit()

The previous patch introduced __rb_hierarchy_next() function with
various move direction like HMD_FORCE_CHILD but missed to change using
it some place.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1456488800-28124-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/hists.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 6bcd767..904eaa7 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2477,12 +2477,7 @@ static void hist_browser__update_percent_limit(struct hist_browser *hb,
 				     min_callchain_hits, &callchain_param);
 
 next:
-		/*
-		 * Tentatively set unfolded so that the rb_hierarchy_next()
-		 * can toggle children of folded entries too.
-		 */
-		he->unfolded = he->has_children;
-		nd = rb_hierarchy_next(nd);
+		nd = __rb_hierarchy_next(nd, HMD_FORCE_CHILD);
 
 		/* force to re-evaluate folding state of callchains */
 		he->init_have_children = false;

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

* [tip:perf/core] perf hists browser: Show message for percent limit
  2016-02-26 12:13 ` [PATCH 4/5] perf hists browser: Show message for percent limit Namhyung Kim
@ 2016-02-27  9:42   ` tip-bot for Namhyung Kim
  0 siblings, 0 replies; 13+ messages in thread
From: tip-bot for Namhyung Kim @ 2016-02-27  9:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tglx, wangnan0, peterz, namhyung, andi, linux-kernel, jolsa,
	acme, hpa, dsahern, mingo, eranian

Commit-ID:  79dded8776c2dc4d6e1229de69f4027e84d63673
Gitweb:     http://git.kernel.org/tip/79dded8776c2dc4d6e1229de69f4027e84d63673
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Fri, 26 Feb 2016 21:13:19 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 26 Feb 2016 11:20:36 -0300

perf hists browser: Show message for percent limit

Like the stdio, it should show messages about omitted hierarchy entries.
Please refer the previous commit for more details.

As it needs to check an entry is omitted or not multiple times, add the
has_no_entry field in the hist entry.

Suggested-and-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1456488800-28124-4-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/hists.c | 99 ++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/hist.c         |  2 +
 tools/perf/util/sort.h         |  1 +
 3 files changed, 102 insertions(+)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 904eaa7..71c6d51 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -260,6 +260,9 @@ static int hierarchy_count_rows(struct hist_browser *hb, struct hist_entry *he,
 	if (he->leaf)
 		return callchain__count_rows(&he->sorted_chain);
 
+	if (he->has_no_entry)
+		return 1;
+
 	node = rb_first(&he->hroot_out);
 	while (node) {
 		float percent;
@@ -409,10 +412,18 @@ static bool hist_browser__toggle_fold(struct hist_browser *browser)
 			/* account grand children */
 			if (symbol_conf.report_hierarchy)
 				browser->b.nr_entries += child_rows - he->nr_rows;
+
+			if (!he->leaf && he->nr_rows == 0) {
+				he->has_no_entry = true;
+				he->nr_rows = 1;
+			}
 		} else {
 			if (symbol_conf.report_hierarchy)
 				browser->b.nr_entries -= child_rows - he->nr_rows;
 
+			if (he->has_no_entry)
+				he->has_no_entry = false;
+
 			he->nr_rows = 0;
 		}
 
@@ -545,6 +556,12 @@ __hist_browser__set_folding(struct hist_browser *browser, bool unfold)
 			browser->nr_hierarchy_entries++;
 		if (he->leaf)
 			browser->nr_callchain_rows += he->nr_rows;
+		else if (unfold && !hist_entry__has_hierarchy_children(he, browser->min_pcnt)) {
+			browser->nr_hierarchy_entries++;
+			he->has_no_entry = true;
+			he->nr_rows = 1;
+		} else
+			he->has_no_entry = false;
 	}
 }
 
@@ -1412,6 +1429,75 @@ show_callchain:
 	return printed;
 }
 
+static int hist_browser__show_no_entry(struct hist_browser *browser,
+				       unsigned short row,
+				       int level, int nr_sort_keys)
+{
+	int width = browser->b.width;
+	bool current_entry = ui_browser__is_current_entry(&browser->b, row);
+	bool first = true;
+	int column = 0;
+	int ret;
+	struct perf_hpp_fmt *fmt;
+
+	if (current_entry) {
+		browser->he_selection = NULL;
+		browser->selection = NULL;
+	}
+
+	hist_browser__gotorc(browser, row, 0);
+
+	if (current_entry && browser->b.navkeypressed)
+		ui_browser__set_color(&browser->b, HE_COLORSET_SELECTED);
+	else
+		ui_browser__set_color(&browser->b, HE_COLORSET_NORMAL);
+
+	ui_browser__write_nstring(&browser->b, "", level * HIERARCHY_INDENT);
+	width -= level * HIERARCHY_INDENT;
+
+	hists__for_each_format(browser->hists, fmt) {
+		if (perf_hpp__should_skip(fmt, browser->hists) ||
+		    column++ < browser->b.horiz_scroll)
+			continue;
+
+		if (perf_hpp__is_sort_entry(fmt) ||
+		    perf_hpp__is_dynamic_entry(fmt))
+			break;
+
+		ret = fmt->width(fmt, NULL, hists_to_evsel(browser->hists));
+
+		if (first) {
+			/* for folded sign */
+			first = false;
+			ret++;
+		} else {
+			/* space between columns */
+			ret += 2;
+		}
+
+		ui_browser__write_nstring(&browser->b, "", ret);
+		width -= ret;
+	}
+
+	ui_browser__write_nstring(&browser->b, "", nr_sort_keys * HIERARCHY_INDENT);
+	width -= nr_sort_keys * HIERARCHY_INDENT;
+
+	if (column >= browser->b.horiz_scroll) {
+		char buf[32];
+
+		ret = snprintf(buf, sizeof(buf), "no entry >= %.2f%%", browser->min_pcnt);
+		ui_browser__printf(&browser->b, "  %s", buf);
+		width -= ret + 2;
+	}
+
+	/* The scroll bar isn't being used */
+	if (!browser->b.navkeypressed)
+		width += 1;
+
+	ui_browser__write_nstring(&browser->b, "", width);
+	return 1;
+}
+
 static int advance_hpp_check(struct perf_hpp *hpp, int inc)
 {
 	advance_hpp(hpp, inc);
@@ -1575,6 +1661,14 @@ static unsigned int hist_browser__refresh(struct ui_browser *browser)
 			row += hist_browser__show_hierarchy_entry(hb, h, row,
 								  h->depth,
 								  nr_sort);
+			if (row == browser->rows)
+				break;
+
+			if (h->has_no_entry) {
+				hist_browser__show_no_entry(hb, row, h->depth,
+							    nr_sort);
+				row++;
+			}
 		} else {
 			row += hist_browser__show_entry(hb, h, row);
 		}
@@ -2461,6 +2555,11 @@ static void hist_browser__update_percent_limit(struct hist_browser *hb,
 	while ((nd = hists__filter_entries(nd, hb->min_pcnt)) != NULL) {
 		he = rb_entry(nd, struct hist_entry, rb_node);
 
+		if (he->has_no_entry) {
+			he->has_no_entry = false;
+			he->nr_rows = 0;
+		}
+
 		if (!he->leaf || !symbol_conf.use_callchain)
 			goto next;
 
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index e716919..75dc41d 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -1625,6 +1625,7 @@ static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h
 
 			/* force fold unfiltered entry for simplicity */
 			parent->unfolded = false;
+			parent->has_no_entry = false;
 			parent->row_offset = 0;
 			parent->nr_rows = 0;
 next:
@@ -1637,6 +1638,7 @@ next:
 
 	/* force fold unfiltered entry for simplicity */
 	h->unfolded = false;
+	h->has_no_entry = false;
 	h->row_offset = 0;
 	h->nr_rows = 0;
 
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index a8d53ff..25a5529 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -117,6 +117,7 @@ struct hist_entry {
 			bool	init_have_children;
 			bool	unfolded;
 			bool	has_children;
+			bool	has_no_entry;
 		};
 	};
 	char			*srcline;

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

* [tip:perf/core] perf report: Show message for percent limit on gtk
  2016-02-26 12:13 ` [PATCH 5/5] perf report: Show message for percent limit on gtk Namhyung Kim
@ 2016-02-27  9:42   ` tip-bot for Namhyung Kim
  0 siblings, 0 replies; 13+ messages in thread
From: tip-bot for Namhyung Kim @ 2016-02-27  9:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, tglx, peterz, andi, linux-kernel, acme, jolsa, dsahern,
	eranian, mingo, wangnan0, namhyung

Commit-ID:  2ddda792373065577eb9207370cb7a28395caffa
Gitweb:     http://git.kernel.org/tip/2ddda792373065577eb9207370cb7a28395caffa
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Fri, 26 Feb 2016 21:13:20 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 26 Feb 2016 11:20:36 -0300

perf report: Show message for percent limit on gtk

Like the stdio, it should show messages about omitted hierarchy
entries.  Please refer the previous commit for more details.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1456488800-28124-5-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/gtk/hists.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index 7f343339..a5758fd 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -449,6 +449,17 @@ static void perf_gtk__add_hierarchy_entries(struct hists *hists,
 			perf_gtk__add_hierarchy_entries(hists, &he->hroot_out,
 							store, &iter, hpp,
 							min_pcnt);
+
+			if (!hist_entry__has_hierarchy_children(he, min_pcnt)) {
+				char buf[32];
+				GtkTreeIter child;
+
+				snprintf(buf, sizeof(buf), "no entry >= %.2f%%",
+					 min_pcnt);
+
+				gtk_tree_store_append(store, &child, &iter);
+				gtk_tree_store_set(store, &child, col_idx, buf, -1);
+			}
 		}
 
 		if (symbol_conf.use_callchain && he->leaf) {

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

* Re: [PATCH 2/5] perf report: Show message for percent limit on stdio
  2016-02-26 12:13 ` [PATCH 2/5] perf report: Show message for percent limit on stdio Namhyung Kim
  2016-02-26 14:15   ` Arnaldo Carvalho de Melo
  2016-02-27  9:41   ` [tip:perf/core] " tip-bot for Namhyung Kim
@ 2016-03-30 14:12   ` Arnaldo Carvalho de Melo
  2016-03-30 16:12     ` Namhyung Kim
  2 siblings, 1 reply; 13+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-03-30 14:12 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern,
	Andi Kleen, Stephane Eranian, Wang Nan

Em Fri, Feb 26, 2016 at 09:13:17PM +0900, Namhyung Kim escreveu:
> When the hierarchy mode is used, some entries might be omiited due to a
> percent limit or filter.  In this case the output hierarchy is different
> than other entries.  Add an informative message to users about this.
> 
> For example, when 4% of percent limit is applied:

Hi Namhyung, while replying to a message about parent sorting being
broken I noticed that the code to show a message about --percent-limit
seems to be only present on --hierachy mode, could you please consider
adding it to the non-hierarchy case?

Thanks,

- Arnaldo
 
> 
> After:
> 
>   #       Overhead  Command / Shared Object / Symbol
>   # ..............  ..........................................
>   #
>       49.09%        swapper
>          48.67%        [kernel.vmlinux]
>             34.42%        [k] intel_idle
>       11.51%        firefox
>           8.87%        libpthread-2.22.so
>              6.60%        [.] __GI___libc_recvmsg
>       10.49%        gnome-shell
>           4.74%        libc-2.22.so
>                           no entry >= 4.00%
>       10.08%        Xorg
>           6.11%        libc-2.22.so
>              5.27%        [.] __memcpy_sse2_unaligned
>        6.15%        perf
>                        no entry >= 4.00%
> 
> Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/ui/stdio/hist.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
> index 435eaaaf2f1d..b3bdfcb245f9 100644
> --- a/tools/perf/ui/stdio/hist.c
> +++ b/tools/perf/ui/stdio/hist.c
> @@ -628,6 +628,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
>  	bool first = true;
>  	size_t linesz;
>  	char *line = NULL;
> +	unsigned indent;
>  
>  	init_rem_hits();
>  
> @@ -704,6 +705,8 @@ print_entries:
>  		goto out;
>  	}
>  
> +	indent = hists__overhead_width(hists) + 4;
> +
>  	for (nd = rb_first(&hists->entries); nd; nd = __rb_hierarchy_next(nd, HMD_FORCE_CHILD)) {
>  		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
>  		float percent;
> @@ -720,6 +723,20 @@ print_entries:
>  		if (max_rows && ++nr_rows >= max_rows)
>  			break;
>  
> +		/*
> +		 * If all children are filtered out or percent-limited,
> +		 * display "no entry >= x.xx%" message.
> +		 */
> +		if (!h->leaf && !hist_entry__has_hierarchy_children(h, min_pcnt)) {
> +			int nr_sort = hists->hpp_list->nr_sort_keys;
> +
> +			print_hierarchy_indent(sep, nr_sort + h->depth + 1, spaces, fp);
> +			fprintf(fp, "%*sno entry >= %.2f%%\n", indent, "", min_pcnt);
> +
> +			if (max_rows && ++nr_rows >= max_rows)
> +				break;
> +		}
> +
>  		if (h->ms.map == NULL && verbose > 1) {
>  			__map_groups__fprintf_maps(h->thread->mg,
>  						   MAP__FUNCTION, fp);
> -- 
> 2.7.1

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

* Re: [PATCH 2/5] perf report: Show message for percent limit on stdio
  2016-03-30 14:12   ` [PATCH 2/5] " Arnaldo Carvalho de Melo
@ 2016-03-30 16:12     ` Namhyung Kim
  0 siblings, 0 replies; 13+ messages in thread
From: Namhyung Kim @ 2016-03-30 16:12 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern,
	Andi Kleen, Stephane Eranian, Wang Nan

Hi Arnaldo,

On Wed, Mar 30, 2016 at 11:12:42AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Feb 26, 2016 at 09:13:17PM +0900, Namhyung Kim escreveu:
> > When the hierarchy mode is used, some entries might be omiited due to a
> > percent limit or filter.  In this case the output hierarchy is different
> > than other entries.  Add an informative message to users about this.
> > 
> > For example, when 4% of percent limit is applied:
> 
> Hi Namhyung, while replying to a message about parent sorting being
> broken I noticed that the code to show a message about --percent-limit
> seems to be only present on --hierachy mode, could you please consider
> adding it to the non-hierarchy case?

Currently the 'no entry' message is for hist entries, not for call
chains.  With --percent-limit option the callchains below the limit
are always silently discarded.  This is same for the hierarchy mode
too.

Thanks,
Namhyung


> 
> Thanks,
> 
> - Arnaldo
>  
> > 
> > After:
> > 
> >   #       Overhead  Command / Shared Object / Symbol
> >   # ..............  ..........................................
> >   #
> >       49.09%        swapper
> >          48.67%        [kernel.vmlinux]
> >             34.42%        [k] intel_idle
> >       11.51%        firefox
> >           8.87%        libpthread-2.22.so
> >              6.60%        [.] __GI___libc_recvmsg
> >       10.49%        gnome-shell
> >           4.74%        libc-2.22.so
> >                           no entry >= 4.00%
> >       10.08%        Xorg
> >           6.11%        libc-2.22.so
> >              5.27%        [.] __memcpy_sse2_unaligned
> >        6.15%        perf
> >                        no entry >= 4.00%
> > 
> > Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> > ---
> >  tools/perf/ui/stdio/hist.c | 17 +++++++++++++++++
> >  1 file changed, 17 insertions(+)
> > 
> > diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
> > index 435eaaaf2f1d..b3bdfcb245f9 100644
> > --- a/tools/perf/ui/stdio/hist.c
> > +++ b/tools/perf/ui/stdio/hist.c
> > @@ -628,6 +628,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
> >  	bool first = true;
> >  	size_t linesz;
> >  	char *line = NULL;
> > +	unsigned indent;
> >  
> >  	init_rem_hits();
> >  
> > @@ -704,6 +705,8 @@ print_entries:
> >  		goto out;
> >  	}
> >  
> > +	indent = hists__overhead_width(hists) + 4;
> > +
> >  	for (nd = rb_first(&hists->entries); nd; nd = __rb_hierarchy_next(nd, HMD_FORCE_CHILD)) {
> >  		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
> >  		float percent;
> > @@ -720,6 +723,20 @@ print_entries:
> >  		if (max_rows && ++nr_rows >= max_rows)
> >  			break;
> >  
> > +		/*
> > +		 * If all children are filtered out or percent-limited,
> > +		 * display "no entry >= x.xx%" message.
> > +		 */
> > +		if (!h->leaf && !hist_entry__has_hierarchy_children(h, min_pcnt)) {
> > +			int nr_sort = hists->hpp_list->nr_sort_keys;
> > +
> > +			print_hierarchy_indent(sep, nr_sort + h->depth + 1, spaces, fp);
> > +			fprintf(fp, "%*sno entry >= %.2f%%\n", indent, "", min_pcnt);
> > +
> > +			if (max_rows && ++nr_rows >= max_rows)
> > +				break;
> > +		}
> > +
> >  		if (h->ms.map == NULL && verbose > 1) {
> >  			__map_groups__fprintf_maps(h->thread->mg,
> >  						   MAP__FUNCTION, fp);
> > -- 
> > 2.7.1

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

end of thread, other threads:[~2016-03-30 16:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-26 12:13 [PATCH 1/5] perf hists: Add more helper functions for the hierarchy mode Namhyung Kim
2016-02-26 12:13 ` [PATCH 2/5] perf report: Show message for percent limit on stdio Namhyung Kim
2016-02-26 14:15   ` Arnaldo Carvalho de Melo
2016-02-27  9:41   ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-03-30 14:12   ` [PATCH 2/5] " Arnaldo Carvalho de Melo
2016-03-30 16:12     ` Namhyung Kim
2016-02-26 12:13 ` [PATCH 3/5] perf hists browser: Cleanup hist_browser__update_percent_limit() Namhyung Kim
2016-02-27  9:42   ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-26 12:13 ` [PATCH 4/5] perf hists browser: Show message for percent limit Namhyung Kim
2016-02-27  9:42   ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-26 12:13 ` [PATCH 5/5] perf report: Show message for percent limit on gtk Namhyung Kim
2016-02-27  9:42   ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-27  9:41 ` [tip:perf/core] perf hists: Add more helper functions for the hierarchy mode tip-bot for Namhyung Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.