linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] perf tools: Assorted fixes for hierarchy mode
@ 2016-11-08 13:08 Namhyung Kim
  2016-11-08 13:08 ` [PATCH 1/4] perf hist browser: Fix indentation of folded sign on --hierarchy Namhyung Kim
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Namhyung Kim @ 2016-11-08 13:08 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Markus Trippelsdorf

Hello,

This patches fix problems in hierarchy output Markus reported some
time ago.  The code is available on the 'perf/hierarchy-fix-v1' branch
in my tree:

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

Any feedbacks are welcomed.

Thanks,
Namhyung


Cc: Markus Trippelsdorf <markus@trippelsdorf.de>

Namhyung Kim (4):
  perf hist browser: Fix indentation of folded sign on --hierarchy
  perf hist browser: Show folded sign properly on --hierarchy
  perf hist browser: Fix column indentation on --hierarchy
  perf hists: Fix column length on --hierarchy

 tools/perf/ui/browsers/hists.c | 35 ++++++++++++++++++++++++-----------
 tools/perf/util/hist.c         | 12 ++++++------
 2 files changed, 30 insertions(+), 17 deletions(-)

-- 
2.10.1

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

* [PATCH 1/4] perf hist browser: Fix indentation of folded sign on --hierarchy
  2016-11-08 13:08 [PATCH 0/4] perf tools: Assorted fixes for hierarchy mode Namhyung Kim
@ 2016-11-08 13:08 ` Namhyung Kim
  2016-11-12 10:53   ` [tip:perf/urgent] perf hists " tip-bot for Namhyung Kim
  2016-11-08 13:08 ` [PATCH 2/4] perf hist browser: Show folded sign properly " Namhyung Kim
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Namhyung Kim @ 2016-11-08 13:08 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Markus Trippelsdorf

It should indent 2 spaces for folded sign and a whitespace.

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

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 84f5dd2fb59c..fe5677ccbc22 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1337,8 +1337,8 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser,
 		}
 
 		if (first) {
-			ui_browser__printf(&browser->b, "%c", folded_sign);
-			width--;
+			ui_browser__printf(&browser->b, "%c ", folded_sign);
+			width -= 2;
 			first = false;
 		} else {
 			ui_browser__printf(&browser->b, "  ");
@@ -1555,7 +1555,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
 	int indent = hists->nr_hpp_node - 2;
 	bool first_node, first_col;
 
-	ret = scnprintf(buf, size, " ");
+	ret = scnprintf(buf, size, "  ");
 	if (advance_hpp_check(&dummy_hpp, ret))
 		return ret;
 
-- 
2.10.1

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

* [PATCH 2/4] perf hist browser: Show folded sign properly on --hierarchy
  2016-11-08 13:08 [PATCH 0/4] perf tools: Assorted fixes for hierarchy mode Namhyung Kim
  2016-11-08 13:08 ` [PATCH 1/4] perf hist browser: Fix indentation of folded sign on --hierarchy Namhyung Kim
@ 2016-11-08 13:08 ` Namhyung Kim
  2016-11-09 14:28   ` Arnaldo Carvalho de Melo
  2016-11-12 10:53   ` [tip:perf/urgent] perf hists " tip-bot for Namhyung Kim
  2016-11-08 13:08 ` [PATCH 3/4] perf hist browser: Fix column indentation " Namhyung Kim
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 20+ messages in thread
From: Namhyung Kim @ 2016-11-08 13:08 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Markus Trippelsdorf

When horizontall scrolling is used in hierarchy mode, the folded signed
disappears at the right most column.

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

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index fe5677ccbc22..7722ad311318 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1381,8 +1381,14 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser,
 		}
 
 		perf_hpp_list__for_each_format(entry->hpp_list, fmt) {
-			ui_browser__write_nstring(&browser->b, "", 2);
-			width -= 2;
+			if (first) {
+				ui_browser__printf(&browser->b, "%c ", folded_sign);
+				width -= 2;
+				first = false;
+			} else {
+				ui_browser__write_nstring(&browser->b, "", 2);
+				width -= 2;
+			}
 
 			/*
 			 * No need to call hist_entry__snprintf_alignment()
-- 
2.10.1

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

* [PATCH 3/4] perf hist browser: Fix column indentation on --hierarchy
  2016-11-08 13:08 [PATCH 0/4] perf tools: Assorted fixes for hierarchy mode Namhyung Kim
  2016-11-08 13:08 ` [PATCH 1/4] perf hist browser: Fix indentation of folded sign on --hierarchy Namhyung Kim
  2016-11-08 13:08 ` [PATCH 2/4] perf hist browser: Show folded sign properly " Namhyung Kim
@ 2016-11-08 13:08 ` Namhyung Kim
  2016-11-09 14:45   ` Arnaldo Carvalho de Melo
  2016-11-12 10:54   ` [tip:perf/urgent] perf hists " tip-bot for Namhyung Kim
  2016-11-08 13:08 ` [PATCH 4/4] perf hists: Fix column length " Namhyung Kim
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 20+ messages in thread
From: Namhyung Kim @ 2016-11-08 13:08 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Markus Trippelsdorf

When horizontall scrolling is used in hierarchy mode, the the right most
column has unnecessary indentation.  Actually it's needed only if some
of left (overhead) columns were shown.

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

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 7722ad311318..15b29a79a69b 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1361,8 +1361,10 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser,
 		width -= hpp.buf - s;
 	}
 
-	ui_browser__write_nstring(&browser->b, "", hierarchy_indent);
-	width -= hierarchy_indent;
+	if (!first) {
+		ui_browser__write_nstring(&browser->b, "", hierarchy_indent);
+		width -= hierarchy_indent;
+	}
 
 	if (column >= browser->b.horiz_scroll) {
 		char s[2048];
@@ -1565,6 +1567,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
 	if (advance_hpp_check(&dummy_hpp, ret))
 		return ret;
 
+	first_node = true;
 	/* the first hpp_list_node is for overhead columns */
 	fmt_node = list_first_entry(&hists->hpp_formats,
 				    struct perf_hpp_list_node, list);
@@ -1579,12 +1582,16 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
 		ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "  ");
 		if (advance_hpp_check(&dummy_hpp, ret))
 			break;
+
+		first_node = false;
 	}
 
-	ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "%*s",
-			indent * HIERARCHY_INDENT, "");
-	if (advance_hpp_check(&dummy_hpp, ret))
-		return ret;
+	if (!first_node) {
+		ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "%*s",
+				indent * HIERARCHY_INDENT, "");
+		if (advance_hpp_check(&dummy_hpp, ret))
+			return ret;
+	}
 
 	first_node = true;
 	list_for_each_entry_continue(fmt_node, &hists->hpp_formats, list) {
-- 
2.10.1

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

* [PATCH 4/4] perf hists: Fix column length on --hierarchy
  2016-11-08 13:08 [PATCH 0/4] perf tools: Assorted fixes for hierarchy mode Namhyung Kim
                   ` (2 preceding siblings ...)
  2016-11-08 13:08 ` [PATCH 3/4] perf hist browser: Fix column indentation " Namhyung Kim
@ 2016-11-08 13:08 ` Namhyung Kim
  2016-11-12 10:54   ` [tip:perf/urgent] " tip-bot for Namhyung Kim
  2016-11-08 13:21 ` [PATCH 0/4] perf tools: Assorted fixes for hierarchy mode Markus Trippelsdorf
  2016-11-08 13:43 ` Markus Trippelsdorf
  5 siblings, 1 reply; 20+ messages in thread
From: Namhyung Kim @ 2016-11-08 13:08 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Markus Trippelsdorf

Markus reported that there's a weird behavior on perf top --hierarch
regarding the column length.  Looking at the code, I found a debious
code which affects the symtoms.  When --hierarchy option is used, the
last column length might be inaccurate since it skips to update the
length on leaf entries.  I cannot remember why it did and looks like a
leftover from previous version during the development.  Anyway updating
the column length often is not harmful.  So let's move the code out.

Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/hist.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index e1be4132054d..6770a9645609 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -1601,18 +1601,18 @@ static void hists__hierarchy_output_resort(struct hists *hists,
 		if (prog)
 			ui_progress__update(prog, 1);
 
+		hists->nr_entries++;
+		if (!he->filtered) {
+			hists->nr_non_filtered_entries++;
+			hists__calc_col_len(hists, he);
+		}
+
 		if (!he->leaf) {
 			hists__hierarchy_output_resort(hists, prog,
 						       &he->hroot_in,
 						       &he->hroot_out,
 						       min_callchain_hits,
 						       use_callchain);
-			hists->nr_entries++;
-			if (!he->filtered) {
-				hists->nr_non_filtered_entries++;
-				hists__calc_col_len(hists, he);
-			}
-
 			continue;
 		}
 
-- 
2.10.1

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

* Re: [PATCH 0/4] perf tools: Assorted fixes for hierarchy mode
  2016-11-08 13:08 [PATCH 0/4] perf tools: Assorted fixes for hierarchy mode Namhyung Kim
                   ` (3 preceding siblings ...)
  2016-11-08 13:08 ` [PATCH 4/4] perf hists: Fix column length " Namhyung Kim
@ 2016-11-08 13:21 ` Markus Trippelsdorf
  2016-11-09 13:11   ` Arnaldo Carvalho de Melo
  2016-11-08 13:43 ` Markus Trippelsdorf
  5 siblings, 1 reply; 20+ messages in thread
From: Markus Trippelsdorf @ 2016-11-08 13:21 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML

On 2016.11.08 at 22:08 +0900, Namhyung Kim wrote:
> Hello,
> 
> This patches fix problems in hierarchy output Markus reported some
> time ago.  The code is available on the 'perf/hierarchy-fix-v1' branch
> in my tree:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
> 
> Any feedbacks are welcomed.

It looks perfect now. Many thanks for your fixes.

-- 
Markus

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

* Re: [PATCH 0/4] perf tools: Assorted fixes for hierarchy mode
  2016-11-08 13:08 [PATCH 0/4] perf tools: Assorted fixes for hierarchy mode Namhyung Kim
                   ` (4 preceding siblings ...)
  2016-11-08 13:21 ` [PATCH 0/4] perf tools: Assorted fixes for hierarchy mode Markus Trippelsdorf
@ 2016-11-08 13:43 ` Markus Trippelsdorf
  2016-11-08 15:05   ` Namhyung Kim
  5 siblings, 1 reply; 20+ messages in thread
From: Markus Trippelsdorf @ 2016-11-08 13:43 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML

On 2016.11.08 at 22:08 +0900, Namhyung Kim wrote:
> 
> This patches fix problems in hierarchy output Markus reported some
> time ago.  The code is available on the 'perf/hierarchy-fix-v1' branch
> in my tree:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
> 
> Any feedbacks are welcomed.

By the way, I hope that:
https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?h=perf/core&id=8a06b0be6507f97f3aa92ca814335b8b65fd3de2
doesn't fall through the cracks.

-- 
Markus

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

* Re: [PATCH 0/4] perf tools: Assorted fixes for hierarchy mode
  2016-11-08 13:43 ` Markus Trippelsdorf
@ 2016-11-08 15:05   ` Namhyung Kim
  2016-11-08 15:10     ` Markus Trippelsdorf
  0 siblings, 1 reply; 20+ messages in thread
From: Namhyung Kim @ 2016-11-08 15:05 UTC (permalink / raw)
  To: Markus Trippelsdorf
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML

Hello,

On Tue, Nov 8, 2016 at 10:43 PM, Markus Trippelsdorf
<markus@trippelsdorf.de> wrote:
> On 2016.11.08 at 22:08 +0900, Namhyung Kim wrote:
>>
>> This patches fix problems in hierarchy output Markus reported some
>> time ago.  The code is available on the 'perf/hierarchy-fix-v1' branch
>> in my tree:
>>
>>   git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
>>
>> Any feedbacks are welcomed.
>
> By the way, I hope that:
> https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?h=perf/core&id=8a06b0be6507f97f3aa92ca814335b8b65fd3de2
> doesn't fall through the cracks.

What do you mean?  It's already in the tip/perf/core so will be merged
to the mainline eventually.

Thanks,
Namhyung

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

* Re: [PATCH 0/4] perf tools: Assorted fixes for hierarchy mode
  2016-11-08 15:05   ` Namhyung Kim
@ 2016-11-08 15:10     ` Markus Trippelsdorf
  2016-11-09 13:10       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 20+ messages in thread
From: Markus Trippelsdorf @ 2016-11-08 15:10 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML

On 2016.11.09 at 00:05 +0900, Namhyung Kim wrote:
> Hello,
> 
> On Tue, Nov 8, 2016 at 10:43 PM, Markus Trippelsdorf
> <markus@trippelsdorf.de> wrote:
> > On 2016.11.08 at 22:08 +0900, Namhyung Kim wrote:
> >>
> >> This patches fix problems in hierarchy output Markus reported some
> >> time ago.  The code is available on the 'perf/hierarchy-fix-v1' branch
> >> in my tree:
> >>
> >>   git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
> >>
> >> Any feedbacks are welcomed.
> >
> > By the way, I hope that:
> > https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?h=perf/core&id=8a06b0be6507f97f3aa92ca814335b8b65fd3de2
> > doesn't fall through the cracks.
> 
> What do you mean?  It's already in the tip/perf/core so will be merged
> to the mainline eventually.

Ok. I was just wondering, because it sits there for two weeks already...

-- 
Markus

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

* Re: [PATCH 0/4] perf tools: Assorted fixes for hierarchy mode
  2016-11-08 15:10     ` Markus Trippelsdorf
@ 2016-11-09 13:10       ` Arnaldo Carvalho de Melo
  2016-11-09 13:15         ` Markus Trippelsdorf
  0 siblings, 1 reply; 20+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-11-09 13:10 UTC (permalink / raw)
  To: Markus Trippelsdorf
  Cc: Namhyung Kim, Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML

Em Tue, Nov 08, 2016 at 04:10:23PM +0100, Markus Trippelsdorf escreveu:
> On 2016.11.09 at 00:05 +0900, Namhyung Kim wrote:
> > On Tue, Nov 8, 2016 at 10:43 PM, Markus Trippelsdorf
> > <markus@trippelsdorf.de> wrote:
> > > On 2016.11.08 at 22:08 +0900, Namhyung Kim wrote:
> > >> This patches fix problems in hierarchy output Markus reported some
> > >> time ago.  The code is available on the 'perf/hierarchy-fix-v1' branch
> > >> in my tree:

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

> > >> Any feedbacks are welcomed.

> > > By the way, I hope that:
> > > https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?h=perf/core&id=8a06b0be6507f97f3aa92ca814335b8b65fd3de2
> > > doesn't fall through the cracks.

> > What do you mean?  It's already in the tip/perf/core so will be merged
> > to the mainline eventually.

> Ok. I was just wondering, because it sits there for two weeks already...

If you think something qualifies for perf/urgent, i.e. to go to a kernel
that is in -rc stage, v4.9-rc4 now, for instance, please point that out
and I'll consider it.

- Arnaldo

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

* Re: [PATCH 0/4] perf tools: Assorted fixes for hierarchy mode
  2016-11-08 13:21 ` [PATCH 0/4] perf tools: Assorted fixes for hierarchy mode Markus Trippelsdorf
@ 2016-11-09 13:11   ` Arnaldo Carvalho de Melo
  2016-11-09 13:15     ` Markus Trippelsdorf
  0 siblings, 1 reply; 20+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-11-09 13:11 UTC (permalink / raw)
  To: Markus Trippelsdorf
  Cc: Namhyung Kim, Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML

Em Tue, Nov 08, 2016 at 02:21:17PM +0100, Markus Trippelsdorf escreveu:
> On 2016.11.08 at 22:08 +0900, Namhyung Kim wrote:
> > Hello,
> > 
> > This patches fix problems in hierarchy output Markus reported some
> > time ago.  The code is available on the 'perf/hierarchy-fix-v1' branch
> > in my tree:
> > 
> >   git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
> > 
> > Any feedbacks are welcomed.
> 
> It looks perfect now. Many thanks for your fixes.

Ok, I'll take that as a Tested-by: Markus, ok?

- Arnaldo

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

* Re: [PATCH 0/4] perf tools: Assorted fixes for hierarchy mode
  2016-11-09 13:10       ` Arnaldo Carvalho de Melo
@ 2016-11-09 13:15         ` Markus Trippelsdorf
  0 siblings, 0 replies; 20+ messages in thread
From: Markus Trippelsdorf @ 2016-11-09 13:15 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Namhyung Kim, Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML

On 2016.11.09 at 10:10 -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Nov 08, 2016 at 04:10:23PM +0100, Markus Trippelsdorf escreveu:
> > On 2016.11.09 at 00:05 +0900, Namhyung Kim wrote:
> > > On Tue, Nov 8, 2016 at 10:43 PM, Markus Trippelsdorf
> > > <markus@trippelsdorf.de> wrote:
> > > > On 2016.11.08 at 22:08 +0900, Namhyung Kim wrote:
> > > >> This patches fix problems in hierarchy output Markus reported some
> > > >> time ago.  The code is available on the 'perf/hierarchy-fix-v1' branch
> > > >> in my tree:
> 
> > > >>   git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
> 
> > > >> Any feedbacks are welcomed.
> 
> > > > By the way, I hope that:
> > > > https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?h=perf/core&id=8a06b0be6507f97f3aa92ca814335b8b65fd3de2
> > > > doesn't fall through the cracks.
> 
> > > What do you mean?  It's already in the tip/perf/core so will be merged
> > > to the mainline eventually.
> 
> > Ok. I was just wondering, because it sits there for two weeks already...
> 
> If you think something qualifies for perf/urgent, i.e. to go to a kernel
> that is in -rc stage, v4.9-rc4 now, for instance, please point that out
> and I'll consider it.

Because "perf top --hierarchy" is new in 4.9, I think all fixes for that
feature qualify for perf/urgent by default.

-- 
Markus

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

* Re: [PATCH 0/4] perf tools: Assorted fixes for hierarchy mode
  2016-11-09 13:11   ` Arnaldo Carvalho de Melo
@ 2016-11-09 13:15     ` Markus Trippelsdorf
  0 siblings, 0 replies; 20+ messages in thread
From: Markus Trippelsdorf @ 2016-11-09 13:15 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Namhyung Kim, Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML

On 2016.11.09 at 10:11 -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Nov 08, 2016 at 02:21:17PM +0100, Markus Trippelsdorf escreveu:
> > On 2016.11.08 at 22:08 +0900, Namhyung Kim wrote:
> > > Hello,
> > > 
> > > This patches fix problems in hierarchy output Markus reported some
> > > time ago.  The code is available on the 'perf/hierarchy-fix-v1' branch
> > > in my tree:
> > > 
> > >   git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
> > > 
> > > Any feedbacks are welcomed.
> > 
> > It looks perfect now. Many thanks for your fixes.
> 
> Ok, I'll take that as a Tested-by: Markus, ok?

Sure, feel free. 
Thanks.

-- 
Markus

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

* Re: [PATCH 2/4] perf hist browser: Show folded sign properly on --hierarchy
  2016-11-08 13:08 ` [PATCH 2/4] perf hist browser: Show folded sign properly " Namhyung Kim
@ 2016-11-09 14:28   ` Arnaldo Carvalho de Melo
  2016-11-09 14:29     ` Arnaldo Carvalho de Melo
  2016-11-12 10:53   ` [tip:perf/urgent] perf hists " tip-bot for Namhyung Kim
  1 sibling, 1 reply; 20+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-11-09 14:28 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Markus Trippelsdorf

Em Tue, Nov 08, 2016 at 10:08:31PM +0900, Namhyung Kim escreveu:
> When horizontall scrolling is used in hierarchy mode, the folded signed
> disappears at the right most column.

Humm, this indeed shows the '+' folded signal after pressing ->, but it
moves from the first to the third column :-\

- Arnaldo
 
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/ui/browsers/hists.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
> index fe5677ccbc22..7722ad311318 100644
> --- a/tools/perf/ui/browsers/hists.c
> +++ b/tools/perf/ui/browsers/hists.c
> @@ -1381,8 +1381,14 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser,
>  		}
>  
>  		perf_hpp_list__for_each_format(entry->hpp_list, fmt) {
> -			ui_browser__write_nstring(&browser->b, "", 2);
> -			width -= 2;
> +			if (first) {
> +				ui_browser__printf(&browser->b, "%c ", folded_sign);
> +				width -= 2;
> +				first = false;
> +			} else {
> +				ui_browser__write_nstring(&browser->b, "", 2);
> +				width -= 2;
> +			}
>  
>  			/*
>  			 * No need to call hist_entry__snprintf_alignment()
> -- 
> 2.10.1

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

* Re: [PATCH 2/4] perf hist browser: Show folded sign properly on --hierarchy
  2016-11-09 14:28   ` Arnaldo Carvalho de Melo
@ 2016-11-09 14:29     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 20+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-11-09 14:29 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Markus Trippelsdorf

Em Wed, Nov 09, 2016 at 11:28:11AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Nov 08, 2016 at 10:08:31PM +0900, Namhyung Kim escreveu:
> > When horizontall scrolling is used in hierarchy mode, the folded signed
> > disappears at the right most column.
> 
> Humm, this indeed shows the '+' folded signal after pressing ->, but it
> moves from the first to the third column :-\
> 
> > +++ b/tools/perf/ui/browsers/hists.c
> > @@ -1381,8 +1381,14 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser,
> >  		}
> >  
> >  		perf_hpp_list__for_each_format(entry->hpp_list, fmt) {
> > -			ui_browser__write_nstring(&browser->b, "", 2);
> > -			width -= 2;

Also why move this invariant to both branches?

> > +			if (first) {
> > +				ui_browser__printf(&browser->b, "%c ", folded_sign);
> > +				width -= 2;
> > +				first = false;
> > +			} else {
> > +				ui_browser__write_nstring(&browser->b, "", 2);
> > +				width -= 2;
> > +			}
> >  
> >  			/*
> >  			 * No need to call hist_entry__snprintf_alignment()
> > -- 
> > 2.10.1

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

* Re: [PATCH 3/4] perf hist browser: Fix column indentation on --hierarchy
  2016-11-08 13:08 ` [PATCH 3/4] perf hist browser: Fix column indentation " Namhyung Kim
@ 2016-11-09 14:45   ` Arnaldo Carvalho de Melo
  2016-11-12 10:54   ` [tip:perf/urgent] perf hists " tip-bot for Namhyung Kim
  1 sibling, 0 replies; 20+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-11-09 14:45 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Markus Trippelsdorf

Em Tue, Nov 08, 2016 at 10:08:32PM +0900, Namhyung Kim escreveu:
> When horizontall scrolling is used in hierarchy mode, the the right most
> column has unnecessary indentation.  Actually it's needed only if some
> of left (overhead) columns were shown.

I see, here is the fix, thanks, testing it now...

- Arnaldo
 
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/ui/browsers/hists.c | 19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
> index 7722ad311318..15b29a79a69b 100644
> --- a/tools/perf/ui/browsers/hists.c
> +++ b/tools/perf/ui/browsers/hists.c
> @@ -1361,8 +1361,10 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser,
>  		width -= hpp.buf - s;
>  	}
>  
> -	ui_browser__write_nstring(&browser->b, "", hierarchy_indent);
> -	width -= hierarchy_indent;
> +	if (!first) {
> +		ui_browser__write_nstring(&browser->b, "", hierarchy_indent);
> +		width -= hierarchy_indent;
> +	}
>  
>  	if (column >= browser->b.horiz_scroll) {
>  		char s[2048];
> @@ -1565,6 +1567,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
>  	if (advance_hpp_check(&dummy_hpp, ret))
>  		return ret;
>  
> +	first_node = true;
>  	/* the first hpp_list_node is for overhead columns */
>  	fmt_node = list_first_entry(&hists->hpp_formats,
>  				    struct perf_hpp_list_node, list);
> @@ -1579,12 +1582,16 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
>  		ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "  ");
>  		if (advance_hpp_check(&dummy_hpp, ret))
>  			break;
> +
> +		first_node = false;
>  	}
>  
> -	ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "%*s",
> -			indent * HIERARCHY_INDENT, "");
> -	if (advance_hpp_check(&dummy_hpp, ret))
> -		return ret;
> +	if (!first_node) {
> +		ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "%*s",
> +				indent * HIERARCHY_INDENT, "");
> +		if (advance_hpp_check(&dummy_hpp, ret))
> +			return ret;
> +	}
>  
>  	first_node = true;
>  	list_for_each_entry_continue(fmt_node, &hists->hpp_formats, list) {
> -- 
> 2.10.1

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

* [tip:perf/urgent] perf hists browser: Fix indentation of folded sign on --hierarchy
  2016-11-08 13:08 ` [PATCH 1/4] perf hist browser: Fix indentation of folded sign on --hierarchy Namhyung Kim
@ 2016-11-12 10:53   ` tip-bot for Namhyung Kim
  0 siblings, 0 replies; 20+ messages in thread
From: tip-bot for Namhyung Kim @ 2016-11-12 10:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: namhyung, tglx, peterz, acme, mingo, markus, jolsa, linux-kernel, hpa

Commit-ID:  3d9f4683929a968dc9b9493f4e608b109ad292a2
Gitweb:     http://git.kernel.org/tip/3d9f4683929a968dc9b9493f4e608b109ad292a2
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Tue, 8 Nov 2016 22:08:30 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 9 Nov 2016 11:20:56 -0300

perf hists browser: Fix indentation of folded sign on --hierarchy

It should indent 2 spaces for folded sign and a whitespace.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20161108130833.9263-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/hists.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 5adedc1..225ef2a 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1337,8 +1337,8 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser,
 		}
 
 		if (first) {
-			ui_browser__printf(&browser->b, "%c", folded_sign);
-			width--;
+			ui_browser__printf(&browser->b, "%c ", folded_sign);
+			width -= 2;
 			first = false;
 		} else {
 			ui_browser__printf(&browser->b, "  ");
@@ -1555,7 +1555,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
 	int indent = hists->nr_hpp_node - 2;
 	bool first_node, first_col;
 
-	ret = scnprintf(buf, size, " ");
+	ret = scnprintf(buf, size, "  ");
 	if (advance_hpp_check(&dummy_hpp, ret))
 		return ret;
 

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

* [tip:perf/urgent] perf hists browser: Show folded sign properly on --hierarchy
  2016-11-08 13:08 ` [PATCH 2/4] perf hist browser: Show folded sign properly " Namhyung Kim
  2016-11-09 14:28   ` Arnaldo Carvalho de Melo
@ 2016-11-12 10:53   ` tip-bot for Namhyung Kim
  1 sibling, 0 replies; 20+ messages in thread
From: tip-bot for Namhyung Kim @ 2016-11-12 10:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: namhyung, mingo, jolsa, markus, acme, hpa, linux-kernel, peterz, tglx

Commit-ID:  131d51eb1d17aac3a604cf929fd99ff4dd34f495
Gitweb:     http://git.kernel.org/tip/131d51eb1d17aac3a604cf929fd99ff4dd34f495
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Tue, 8 Nov 2016 22:08:31 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 9 Nov 2016 11:30:47 -0300

perf hists browser: Show folded sign properly on --hierarchy

When horizontal scrolling is used in hierarchy mode, the folded signed
disappears at the right most column.

Committer note:

To test it, run 'perf top --hierarchy, see the '+' symbol at the first
column, then press the right arrow key, the '+' symbol will disappear,
this patch fixes that.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20161108130833.9263-3-namhyung@kernel.org
[ Move 'width -= 2' invariant to right after the if/else ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/hists.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 225ef2a..e767fbd 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1381,7 +1381,13 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser,
 		}
 
 		perf_hpp_list__for_each_format(entry->hpp_list, fmt) {
-			ui_browser__write_nstring(&browser->b, "", 2);
+			if (first) {
+				ui_browser__printf(&browser->b, "%c ", folded_sign);
+				first = false;
+			} else {
+				ui_browser__write_nstring(&browser->b, "", 2);
+			}
+
 			width -= 2;
 
 			/*

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

* [tip:perf/urgent] perf hists browser: Fix column indentation on --hierarchy
  2016-11-08 13:08 ` [PATCH 3/4] perf hist browser: Fix column indentation " Namhyung Kim
  2016-11-09 14:45   ` Arnaldo Carvalho de Melo
@ 2016-11-12 10:54   ` tip-bot for Namhyung Kim
  1 sibling, 0 replies; 20+ messages in thread
From: tip-bot for Namhyung Kim @ 2016-11-12 10:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: namhyung, tglx, mingo, linux-kernel, hpa, jolsa, peterz, markus, acme

Commit-ID:  b9bf911e990a189f89147ee6b66660a153ed0125
Gitweb:     http://git.kernel.org/tip/b9bf911e990a189f89147ee6b66660a153ed0125
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Tue, 8 Nov 2016 22:08:32 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 9 Nov 2016 11:45:58 -0300

perf hists browser: Fix column indentation on --hierarchy

When horizontall scrolling is used in hierarchy mode, the the right most
column has unnecessary indentation.  Actually it's needed only if some
of left (overhead) columns were shown.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20161108130833.9263-4-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/hists.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index e767fbd..a53fef0 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1361,8 +1361,10 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser,
 		width -= hpp.buf - s;
 	}
 
-	ui_browser__write_nstring(&browser->b, "", hierarchy_indent);
-	width -= hierarchy_indent;
+	if (!first) {
+		ui_browser__write_nstring(&browser->b, "", hierarchy_indent);
+		width -= hierarchy_indent;
+	}
 
 	if (column >= browser->b.horiz_scroll) {
 		char s[2048];
@@ -1565,6 +1567,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
 	if (advance_hpp_check(&dummy_hpp, ret))
 		return ret;
 
+	first_node = true;
 	/* the first hpp_list_node is for overhead columns */
 	fmt_node = list_first_entry(&hists->hpp_formats,
 				    struct perf_hpp_list_node, list);
@@ -1579,12 +1582,16 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
 		ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "  ");
 		if (advance_hpp_check(&dummy_hpp, ret))
 			break;
+
+		first_node = false;
 	}
 
-	ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "%*s",
-			indent * HIERARCHY_INDENT, "");
-	if (advance_hpp_check(&dummy_hpp, ret))
-		return ret;
+	if (!first_node) {
+		ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "%*s",
+				indent * HIERARCHY_INDENT, "");
+		if (advance_hpp_check(&dummy_hpp, ret))
+			return ret;
+	}
 
 	first_node = true;
 	list_for_each_entry_continue(fmt_node, &hists->hpp_formats, list) {

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

* [tip:perf/urgent] perf hists: Fix column length on --hierarchy
  2016-11-08 13:08 ` [PATCH 4/4] perf hists: Fix column length " Namhyung Kim
@ 2016-11-12 10:54   ` tip-bot for Namhyung Kim
  0 siblings, 0 replies; 20+ messages in thread
From: tip-bot for Namhyung Kim @ 2016-11-12 10:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, acme, namhyung, jolsa, linux-kernel, peterz, tglx, markus, mingo

Commit-ID:  c72ab446cac1d6c9551fd26c4cfef1b2fc5041fd
Gitweb:     http://git.kernel.org/tip/c72ab446cac1d6c9551fd26c4cfef1b2fc5041fd
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Tue, 8 Nov 2016 22:08:33 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 9 Nov 2016 11:55:29 -0300

perf hists: Fix column length on --hierarchy

Markus reported that there's a weird behavior on perf top --hierarchy
regarding the column length.

Looking at the code, I found a dubious code which affects the symptoms.
When --hierarchy option is used, the last column length might be
inaccurate since it skips to update the length on leaf entries.

I cannot remember why it did and looks like a leftover from previous
version during the development.

Anyway, updating the column length often is not harmful.  So let's move
the code out.

Reported-and-Tested-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Fixes: 1a3906a7e6b9 ("perf hists: Resort hist entries with hierarchy")
Link: http://lkml.kernel.org/r/20161108130833.9263-5-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/hist.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index b02992e..a69f027 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -1600,18 +1600,18 @@ static void hists__hierarchy_output_resort(struct hists *hists,
 		if (prog)
 			ui_progress__update(prog, 1);
 
+		hists->nr_entries++;
+		if (!he->filtered) {
+			hists->nr_non_filtered_entries++;
+			hists__calc_col_len(hists, he);
+		}
+
 		if (!he->leaf) {
 			hists__hierarchy_output_resort(hists, prog,
 						       &he->hroot_in,
 						       &he->hroot_out,
 						       min_callchain_hits,
 						       use_callchain);
-			hists->nr_entries++;
-			if (!he->filtered) {
-				hists->nr_non_filtered_entries++;
-				hists__calc_col_len(hists, he);
-			}
-
 			continue;
 		}
 

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

end of thread, other threads:[~2016-11-12 21:17 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-08 13:08 [PATCH 0/4] perf tools: Assorted fixes for hierarchy mode Namhyung Kim
2016-11-08 13:08 ` [PATCH 1/4] perf hist browser: Fix indentation of folded sign on --hierarchy Namhyung Kim
2016-11-12 10:53   ` [tip:perf/urgent] perf hists " tip-bot for Namhyung Kim
2016-11-08 13:08 ` [PATCH 2/4] perf hist browser: Show folded sign properly " Namhyung Kim
2016-11-09 14:28   ` Arnaldo Carvalho de Melo
2016-11-09 14:29     ` Arnaldo Carvalho de Melo
2016-11-12 10:53   ` [tip:perf/urgent] perf hists " tip-bot for Namhyung Kim
2016-11-08 13:08 ` [PATCH 3/4] perf hist browser: Fix column indentation " Namhyung Kim
2016-11-09 14:45   ` Arnaldo Carvalho de Melo
2016-11-12 10:54   ` [tip:perf/urgent] perf hists " tip-bot for Namhyung Kim
2016-11-08 13:08 ` [PATCH 4/4] perf hists: Fix column length " Namhyung Kim
2016-11-12 10:54   ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2016-11-08 13:21 ` [PATCH 0/4] perf tools: Assorted fixes for hierarchy mode Markus Trippelsdorf
2016-11-09 13:11   ` Arnaldo Carvalho de Melo
2016-11-09 13:15     ` Markus Trippelsdorf
2016-11-08 13:43 ` Markus Trippelsdorf
2016-11-08 15:05   ` Namhyung Kim
2016-11-08 15:10     ` Markus Trippelsdorf
2016-11-09 13:10       ` Arnaldo Carvalho de Melo
2016-11-09 13:15         ` Markus Trippelsdorf

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).