linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 0/3] perf tools: Make perf_hpp__init respect output dimensions
@ 2015-10-06 12:25 Jiri Olsa
  2015-10-06 12:25 ` [PATCH 1/3] perf tools: Get rid of superfluos call to reset_dimensions Jiri Olsa
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Jiri Olsa @ 2015-10-06 12:25 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra

hi,
The perf_hpp__init currently does not respect sorting dimensions
and the setup_sorting function could endup queueing same format
twice. That screwed up the perf_hpp__list and got stuck in loop
within perf_hpp__setup_output_field function.

  $ perf report -F +overhead

  0x00000000004c1355 in perf_hpp__is_sort_entry (format=format@entry=0x880440 <perf_hpp.format>) at util/sort.c:1506
  1506    {

     #0  0x00000000004c1355 in perf_hpp__is_sort_entry (format=format@entry=0x880440 <perf_hpp.format>) at util/sort.c:1506
     #1  0x00000000004c139d in perf_hpp__same_sort_entry (a=a@entry=0x880440 <perf_hpp.format>, b=b@entry=0x2bb2fe0) at util/sort.c:1380
     #2  0x00000000004f8d3c in perf_hpp__setup_output_field () at ui/hist.c:554
     #3  0x00000000004c1d1e in setup_sorting () at util/sort.c:1984
     #4  0x000000000042efbf in cmd_report (argc=0, argv=0x7ffea5a0e790, prefix=<optimized out>) at builtin-report.c:874
     #5  0x0000000000476f13 in run_builtin (p=p@entry=0x875628 <commands+168>, argc=argc@entry=3, argv=argv@entry=0x7ffea5a0e790) at perf.c:385
     #6  0x000000000047710b in handle_internal_command (argc=3, argv=0x7ffea5a0e790) at perf.c:445
     #7  0x0000000000477176 in run_argv (argcp=argcp@entry=0x7ffea5a0e5fc, argv=argv@entry=0x7ffea5a0e5f0) at perf.c:489
     #8  0x00000000004773e7 in main (argc=3, argv=0x7ffea5a0e790) at perf.c:606

Using hpp_dimension__add_output function to register
the output column. It will also mark the dimension
as taken and omit above stuck.

It might need some other changes.. not sure, Namhyung? ;-)

Available in:
  git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
  perf/cols

thanks,
jirka


---
Jiri Olsa (3):
      perf tools: Get rid of superfluos call to reset_dimensions
      perf tools: Introduce hpp_dimension__add_output function
      perf tools: Use hpp_dimension__add_output to register hpp columns

 tools/perf/ui/hist.c   | 16 ++++++++--------
 tools/perf/util/sort.c |  8 ++++++--
 tools/perf/util/sort.h |  2 ++
 3 files changed, 16 insertions(+), 10 deletions(-)

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

* [PATCH 1/3] perf tools: Get rid of superfluos call to reset_dimensions
  2015-10-06 12:25 [RFC 0/3] perf tools: Make perf_hpp__init respect output dimensions Jiri Olsa
@ 2015-10-06 12:25 ` Jiri Olsa
  2015-10-08  9:45   ` [tip:perf/core] " tip-bot for Jiri Olsa
  2015-10-06 12:25 ` [PATCH 2/3] perf tools: Introduce hpp_dimension__add_output function Jiri Olsa
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Jiri Olsa @ 2015-10-06 12:25 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra

There's no need to call reset_dimensions within __setup_output_field
function. It's already called in its caller setup_sorting right
before perf_hpp__init, which will be changed in following patch
to respect taken dimension.

Link: http://lkml.kernel.org/n/tip-08mxvkxtuxbboog1exjok9gd@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/sort.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index ee94b728fca4..8521e3c89b8d 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1917,8 +1917,6 @@ static int __setup_output_field(void)
 	if (field_order == NULL)
 		return 0;
 
-	reset_dimensions();
-
 	strp = str = strdup(field_order);
 	if (str == NULL) {
 		error("Not enough memory to setup output fields");
-- 
2.4.3


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

* [PATCH 2/3] perf tools: Introduce hpp_dimension__add_output function
  2015-10-06 12:25 [RFC 0/3] perf tools: Make perf_hpp__init respect output dimensions Jiri Olsa
  2015-10-06 12:25 ` [PATCH 1/3] perf tools: Get rid of superfluos call to reset_dimensions Jiri Olsa
@ 2015-10-06 12:25 ` Jiri Olsa
  2015-10-08  9:46   ` [tip:perf/core] " tip-bot for Jiri Olsa
  2015-10-06 12:25 ` [PATCH 3/3] perf tools: Use hpp_dimension__add_output to register hpp columns Jiri Olsa
  2015-10-06 14:04 ` [RFC 0/3] perf tools: Make perf_hpp__init respect output dimensions Namhyung Kim
  3 siblings, 1 reply; 10+ messages in thread
From: Jiri Olsa @ 2015-10-06 12:25 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra

This function will allow to register output column from ui
code and respect taken sort/output dimensions.

Link: http://lkml.kernel.org/n/tip-mzlrgdrqs2tciq65bp8ys8jz@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/sort.c | 6 ++++++
 tools/perf/util/sort.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 8521e3c89b8d..2d8ccd4d9e1b 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1577,6 +1577,12 @@ static int __hpp_dimension__add_output(struct hpp_dimension *hd)
 	return 0;
 }
 
+int hpp_dimension__add_output(unsigned col)
+{
+	BUG_ON(col >= PERF_HPP__MAX_INDEX);
+	return __hpp_dimension__add_output(&hpp_sort_dimensions[col]);
+}
+
 int sort_dimension__add(const char *tok)
 {
 	unsigned int i;
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 33b3d30e18d3..31228851e397 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -234,4 +234,6 @@ void perf_hpp__set_elide(int idx, bool elide);
 int report_parse_ignore_callees_opt(const struct option *opt, const char *arg, int unset);
 
 bool is_strict_order(const char *order);
+
+int hpp_dimension__add_output(unsigned col);
 #endif	/* __PERF_SORT_H */
-- 
2.4.3


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

* [PATCH 3/3] perf tools: Use hpp_dimension__add_output to register hpp columns
  2015-10-06 12:25 [RFC 0/3] perf tools: Make perf_hpp__init respect output dimensions Jiri Olsa
  2015-10-06 12:25 ` [PATCH 1/3] perf tools: Get rid of superfluos call to reset_dimensions Jiri Olsa
  2015-10-06 12:25 ` [PATCH 2/3] perf tools: Introduce hpp_dimension__add_output function Jiri Olsa
@ 2015-10-06 12:25 ` Jiri Olsa
  2015-10-06 13:37   ` Arnaldo Carvalho de Melo
  2015-10-08  9:46   ` [tip:perf/core] " tip-bot for Jiri Olsa
  2015-10-06 14:04 ` [RFC 0/3] perf tools: Make perf_hpp__init respect output dimensions Namhyung Kim
  3 siblings, 2 replies; 10+ messages in thread
From: Jiri Olsa @ 2015-10-06 12:25 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra

The perf_hpp__init currently does not respect sorting dimensions
and the setup_sorting function could endup queueing same format
twice. That screwed up the perf_hpp__list and got stuck in loop
within perf_hpp__setup_output_field function.

  $ perf report -F +overhead

  0x00000000004c1355 in perf_hpp__is_sort_entry (format=format@entry=0x880440 <perf_hpp.format>) at util/sort.c:1506
  1506    {

     #0  0x00000000004c1355 in perf_hpp__is_sort_entry (format=format@entry=0x880440 <perf_hpp.format>) at util/sort.c:1506
     #1  0x00000000004c139d in perf_hpp__same_sort_entry (a=a@entry=0x880440 <perf_hpp.format>, b=b@entry=0x2bb2fe0) at util/sort.c:1380
     #2  0x00000000004f8d3c in perf_hpp__setup_output_field () at ui/hist.c:554
     #3  0x00000000004c1d1e in setup_sorting () at util/sort.c:1984
     #4  0x000000000042efbf in cmd_report (argc=0, argv=0x7ffea5a0e790, prefix=<optimized out>) at builtin-report.c:874
     #5  0x0000000000476f13 in run_builtin (p=p@entry=0x875628 <commands+168>, argc=argc@entry=3, argv=argv@entry=0x7ffea5a0e790) at perf.c:385
     #6  0x000000000047710b in handle_internal_command (argc=3, argv=0x7ffea5a0e790) at perf.c:445
     #7  0x0000000000477176 in run_argv (argcp=argcp@entry=0x7ffea5a0e5fc, argv=argv@entry=0x7ffea5a0e5f0) at perf.c:489
     #8  0x00000000004773e7 in main (argc=3, argv=0x7ffea5a0e790) at perf.c:606

Using hpp_dimension__add_output function to register
the output column. It will also mark the dimension
as taken and omit above stuck.

Link: http://lkml.kernel.org/n/tip-ob2dr3ec7gca200ifzpoqhhm@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/ui/hist.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 25d608394d74..5029ba2b55af 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -463,27 +463,27 @@ void perf_hpp__init(void)
 		return;
 
 	if (symbol_conf.cumulate_callchain) {
-		perf_hpp__column_enable(PERF_HPP__OVERHEAD_ACC);
+		hpp_dimension__add_output(PERF_HPP__OVERHEAD_ACC);
 		perf_hpp__format[PERF_HPP__OVERHEAD].name = "Self";
 	}
 
-	perf_hpp__column_enable(PERF_HPP__OVERHEAD);
+	hpp_dimension__add_output(PERF_HPP__OVERHEAD);
 
 	if (symbol_conf.show_cpu_utilization) {
-		perf_hpp__column_enable(PERF_HPP__OVERHEAD_SYS);
-		perf_hpp__column_enable(PERF_HPP__OVERHEAD_US);
+		hpp_dimension__add_output(PERF_HPP__OVERHEAD_SYS);
+		hpp_dimension__add_output(PERF_HPP__OVERHEAD_US);
 
 		if (perf_guest) {
-			perf_hpp__column_enable(PERF_HPP__OVERHEAD_GUEST_SYS);
-			perf_hpp__column_enable(PERF_HPP__OVERHEAD_GUEST_US);
+			hpp_dimension__add_output(PERF_HPP__OVERHEAD_GUEST_SYS);
+			hpp_dimension__add_output(PERF_HPP__OVERHEAD_GUEST_US);
 		}
 	}
 
 	if (symbol_conf.show_nr_samples)
-		perf_hpp__column_enable(PERF_HPP__SAMPLES);
+		hpp_dimension__add_output(PERF_HPP__SAMPLES);
 
 	if (symbol_conf.show_total_period)
-		perf_hpp__column_enable(PERF_HPP__PERIOD);
+		hpp_dimension__add_output(PERF_HPP__PERIOD);
 
 	/* prepend overhead field for backward compatiblity.  */
 	list = &perf_hpp__format[PERF_HPP__OVERHEAD].sort_list;
-- 
2.4.3


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

* Re: [PATCH 3/3] perf tools: Use hpp_dimension__add_output to register hpp columns
  2015-10-06 12:25 ` [PATCH 3/3] perf tools: Use hpp_dimension__add_output to register hpp columns Jiri Olsa
@ 2015-10-06 13:37   ` Arnaldo Carvalho de Melo
  2015-10-08  9:46   ` [tip:perf/core] " tip-bot for Jiri Olsa
  1 sibling, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-06 13:37 UTC (permalink / raw)
  To: Jiri Olsa; +Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra

Em Tue, Oct 06, 2015 at 02:25:12PM +0200, Jiri Olsa escreveu:
> The perf_hpp__init currently does not respect sorting dimensions
> and the setup_sorting function could endup queueing same format
> twice. That screwed up the perf_hpp__list and got stuck in loop
> within perf_hpp__setup_output_field function.
> 
>   $ perf report -F +overhead
> 
>   0x00000000004c1355 in perf_hpp__is_sort_entry (format=format@entry=0x880440 <perf_hpp.format>) at util/sort.c:1506
>   1506    {
> 
>      #0  0x00000000004c1355 in perf_hpp__is_sort_entry (format=format@entry=0x880440 <perf_hpp.format>) at util/sort.c:1506
>      #1  0x00000000004c139d in perf_hpp__same_sort_entry (a=a@entry=0x880440 <perf_hpp.format>, b=b@entry=0x2bb2fe0) at util/sort.c:1380
>      #2  0x00000000004f8d3c in perf_hpp__setup_output_field () at ui/hist.c:554
>      #3  0x00000000004c1d1e in setup_sorting () at util/sort.c:1984
>      #4  0x000000000042efbf in cmd_report (argc=0, argv=0x7ffea5a0e790, prefix=<optimized out>) at builtin-report.c:874
>      #5  0x0000000000476f13 in run_builtin (p=p@entry=0x875628 <commands+168>, argc=argc@entry=3, argv=argv@entry=0x7ffea5a0e790) at perf.c:385
>      #6  0x000000000047710b in handle_internal_command (argc=3, argv=0x7ffea5a0e790) at perf.c:445
>      #7  0x0000000000477176 in run_argv (argcp=argcp@entry=0x7ffea5a0e5fc, argv=argv@entry=0x7ffea5a0e5f0) at perf.c:489
>      #8  0x00000000004773e7 in main (argc=3, argv=0x7ffea5a0e790) at perf.c:606
> 
> Using hpp_dimension__add_output function to register
> the output column. It will also mark the dimension
> as taken and omit above stuck.

Thanks, did a quick review, looks sane, tested, fixed the problem,
applied.

- Arnaldo

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

* Re: [RFC 0/3] perf tools: Make perf_hpp__init respect output dimensions
  2015-10-06 12:25 [RFC 0/3] perf tools: Make perf_hpp__init respect output dimensions Jiri Olsa
                   ` (2 preceding siblings ...)
  2015-10-06 12:25 ` [PATCH 3/3] perf tools: Use hpp_dimension__add_output to register hpp columns Jiri Olsa
@ 2015-10-06 14:04 ` Namhyung Kim
  2015-10-06 14:28   ` Arnaldo Carvalho de Melo
  3 siblings, 1 reply; 10+ messages in thread
From: Namhyung Kim @ 2015-10-06 14:04 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Arnaldo Carvalho de Melo, lkml, David Ahern, Ingo Molnar, Peter Zijlstra

On Tue, Oct 6, 2015 at 9:25 PM, Jiri Olsa <jolsa@kernel.org> wrote:
> hi,
> The perf_hpp__init currently does not respect sorting dimensions
> and the setup_sorting function could endup queueing same format
> twice. That screwed up the perf_hpp__list and got stuck in loop
> within perf_hpp__setup_output_field function.
>
>   $ perf report -F +overhead
>
>   0x00000000004c1355 in perf_hpp__is_sort_entry (format=format@entry=0x880440 <perf_hpp.format>) at util/sort.c:1506
>   1506    {
>
>      #0  0x00000000004c1355 in perf_hpp__is_sort_entry (format=format@entry=0x880440 <perf_hpp.format>) at util/sort.c:1506
>      #1  0x00000000004c139d in perf_hpp__same_sort_entry (a=a@entry=0x880440 <perf_hpp.format>, b=b@entry=0x2bb2fe0) at util/sort.c:1380
>      #2  0x00000000004f8d3c in perf_hpp__setup_output_field () at ui/hist.c:554
>      #3  0x00000000004c1d1e in setup_sorting () at util/sort.c:1984
>      #4  0x000000000042efbf in cmd_report (argc=0, argv=0x7ffea5a0e790, prefix=<optimized out>) at builtin-report.c:874
>      #5  0x0000000000476f13 in run_builtin (p=p@entry=0x875628 <commands+168>, argc=argc@entry=3, argv=argv@entry=0x7ffea5a0e790) at perf.c:385
>      #6  0x000000000047710b in handle_internal_command (argc=3, argv=0x7ffea5a0e790) at perf.c:445
>      #7  0x0000000000477176 in run_argv (argcp=argcp@entry=0x7ffea5a0e5fc, argv=argv@entry=0x7ffea5a0e5f0) at perf.c:489
>      #8  0x00000000004773e7 in main (argc=3, argv=0x7ffea5a0e790) at perf.c:606
>
> Using hpp_dimension__add_output function to register
> the output column. It will also mark the dimension
> as taken and omit above stuck.
>
> It might need some other changes.. not sure, Namhyung? ;-)

Nope.  It looks good to me as is. :)  It should work once it sets up
the output field and sort list properly, so

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung



>
> Available in:
>   git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
>   perf/cols
>
> thanks,
> jirka
>
>
> ---
> Jiri Olsa (3):
>       perf tools: Get rid of superfluos call to reset_dimensions
>       perf tools: Introduce hpp_dimension__add_output function
>       perf tools: Use hpp_dimension__add_output to register hpp columns
>
>  tools/perf/ui/hist.c   | 16 ++++++++--------
>  tools/perf/util/sort.c |  8 ++++++--
>  tools/perf/util/sort.h |  2 ++
>  3 files changed, 16 insertions(+), 10 deletions(-)



-- 
Thanks,
Namhyung

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

* Re: [RFC 0/3] perf tools: Make perf_hpp__init respect output dimensions
  2015-10-06 14:04 ` [RFC 0/3] perf tools: Make perf_hpp__init respect output dimensions Namhyung Kim
@ 2015-10-06 14:28   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-06 14:28 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Jiri Olsa, lkml, David Ahern, Ingo Molnar, Peter Zijlstra

Em Tue, Oct 06, 2015 at 11:04:28PM +0900, Namhyung Kim escreveu:
> On Tue, Oct 6, 2015 at 9:25 PM, Jiri Olsa <jolsa@kernel.org> wrote:
> > hi,
> > The perf_hpp__init currently does not respect sorting dimensions
> > and the setup_sorting function could endup queueing same format
> > twice. That screwed up the perf_hpp__list and got stuck in loop
> > within perf_hpp__setup_output_field function.
> >
> >   $ perf report -F +overhead
> >
> >   0x00000000004c1355 in perf_hpp__is_sort_entry (format=format@entry=0x880440 <perf_hpp.format>) at util/sort.c:1506
> >   1506    {
> >
> >      #0  0x00000000004c1355 in perf_hpp__is_sort_entry (format=format@entry=0x880440 <perf_hpp.format>) at util/sort.c:1506
> >      #1  0x00000000004c139d in perf_hpp__same_sort_entry (a=a@entry=0x880440 <perf_hpp.format>, b=b@entry=0x2bb2fe0) at util/sort.c:1380
> >      #2  0x00000000004f8d3c in perf_hpp__setup_output_field () at ui/hist.c:554
> >      #3  0x00000000004c1d1e in setup_sorting () at util/sort.c:1984
> >      #4  0x000000000042efbf in cmd_report (argc=0, argv=0x7ffea5a0e790, prefix=<optimized out>) at builtin-report.c:874
> >      #5  0x0000000000476f13 in run_builtin (p=p@entry=0x875628 <commands+168>, argc=argc@entry=3, argv=argv@entry=0x7ffea5a0e790) at perf.c:385
> >      #6  0x000000000047710b in handle_internal_command (argc=3, argv=0x7ffea5a0e790) at perf.c:445
> >      #7  0x0000000000477176 in run_argv (argcp=argcp@entry=0x7ffea5a0e5fc, argv=argv@entry=0x7ffea5a0e5f0) at perf.c:489
> >      #8  0x00000000004773e7 in main (argc=3, argv=0x7ffea5a0e790) at perf.c:606
> >
> > Using hpp_dimension__add_output function to register
> > the output column. It will also mark the dimension
> > as taken and omit above stuck.
> >
> > It might need some other changes.. not sure, Namhyung? ;-)
> 
> Nope.  It looks good to me as is. :)  It should work once it sets up
> the output field and sort list properly, so
> 
> Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks, added.

- Arnaldo

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

* [tip:perf/core] perf tools: Get rid of superfluos call to reset_dimensions
  2015-10-06 12:25 ` [PATCH 1/3] perf tools: Get rid of superfluos call to reset_dimensions Jiri Olsa
@ 2015-10-08  9:45   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 10+ messages in thread
From: tip-bot for Jiri Olsa @ 2015-10-08  9:45 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, dsahern, linux-kernel, hpa, acme, tglx, jolsa,
	a.p.zijlstra, namhyung

Commit-ID:  0974d2c9719a4c74fea0f6886b9922b100b903a6
Gitweb:     http://git.kernel.org/tip/0974d2c9719a4c74fea0f6886b9922b100b903a6
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Tue, 6 Oct 2015 14:25:10 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 6 Oct 2015 18:04:58 -0300

perf tools: Get rid of superfluos call to reset_dimensions

There's no need to call reset_dimensions within __setup_output_field
function. It's already called in its caller setup_sorting right before
perf_hpp__init, which will be changed in following patch to respect
taken dimension.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444134312-29136-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/sort.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index ee94b72..8521e3c 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1917,8 +1917,6 @@ static int __setup_output_field(void)
 	if (field_order == NULL)
 		return 0;
 
-	reset_dimensions();
-
 	strp = str = strdup(field_order);
 	if (str == NULL) {
 		error("Not enough memory to setup output fields");

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

* [tip:perf/core] perf tools: Introduce hpp_dimension__add_output function
  2015-10-06 12:25 ` [PATCH 2/3] perf tools: Introduce hpp_dimension__add_output function Jiri Olsa
@ 2015-10-08  9:46   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 10+ messages in thread
From: tip-bot for Jiri Olsa @ 2015-10-08  9:46 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tglx, hpa, a.p.zijlstra, namhyung, jolsa, dsahern, mingo, acme,
	linux-kernel

Commit-ID:  beeaaeb3684d97e89548c1b6b6275329214014df
Gitweb:     http://git.kernel.org/tip/beeaaeb3684d97e89548c1b6b6275329214014df
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Tue, 6 Oct 2015 14:25:11 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 6 Oct 2015 18:04:59 -0300

perf tools: Introduce hpp_dimension__add_output function

This function will allow to register output column from ui code and
respect taken sort/output dimensions.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444134312-29136-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/sort.c | 6 ++++++
 tools/perf/util/sort.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 8521e3c..2d8ccd4 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1577,6 +1577,12 @@ static int __hpp_dimension__add_output(struct hpp_dimension *hd)
 	return 0;
 }
 
+int hpp_dimension__add_output(unsigned col)
+{
+	BUG_ON(col >= PERF_HPP__MAX_INDEX);
+	return __hpp_dimension__add_output(&hpp_sort_dimensions[col]);
+}
+
 int sort_dimension__add(const char *tok)
 {
 	unsigned int i;
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 33b3d30..3122885 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -234,4 +234,6 @@ void perf_hpp__set_elide(int idx, bool elide);
 int report_parse_ignore_callees_opt(const struct option *opt, const char *arg, int unset);
 
 bool is_strict_order(const char *order);
+
+int hpp_dimension__add_output(unsigned col);
 #endif	/* __PERF_SORT_H */

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

* [tip:perf/core] perf tools: Use hpp_dimension__add_output to register hpp columns
  2015-10-06 12:25 ` [PATCH 3/3] perf tools: Use hpp_dimension__add_output to register hpp columns Jiri Olsa
  2015-10-06 13:37   ` Arnaldo Carvalho de Melo
@ 2015-10-08  9:46   ` tip-bot for Jiri Olsa
  1 sibling, 0 replies; 10+ messages in thread
From: tip-bot for Jiri Olsa @ 2015-10-08  9:46 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tglx, jolsa, a.p.zijlstra, acme, mingo, linux-kernel, hpa,
	dsahern, namhyung

Commit-ID:  1178bfd41f3ab6914eb6884875b776bc3032c9b5
Gitweb:     http://git.kernel.org/tip/1178bfd41f3ab6914eb6884875b776bc3032c9b5
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Tue, 6 Oct 2015 14:25:12 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 6 Oct 2015 18:04:59 -0300

perf tools: Use hpp_dimension__add_output to register hpp columns

The perf_hpp__init currently does not respect sorting dimensions and the
setup_sorting function could endup queueing same format twice. That
screwed up the perf_hpp__list and got stuck in loop within
perf_hpp__setup_output_field function.

  $ perf report -F +overhead

  0x00000000004c1355 in perf_hpp__is_sort_entry (format=format@entry=0x880440 <perf_hpp.format>) at util/sort.c:1506
  1506    {

     #0  0x00000000004c1355 in perf_hpp__is_sort_entry (format=format@entry=0x880440 <perf_hpp.format>) at util/sort.c:1506
     #1  0x00000000004c139d in perf_hpp__same_sort_entry (a=a@entry=0x880440 <perf_hpp.format>, b=b@entry=0x2bb2fe0) at util/sort.c:1380
     #2  0x00000000004f8d3c in perf_hpp__setup_output_field () at ui/hist.c:554
     #3  0x00000000004c1d1e in setup_sorting () at util/sort.c:1984
     #4  0x000000000042efbf in cmd_report (argc=0, argv=0x7ffea5a0e790, prefix=<optimized out>) at builtin-report.c:874
     #5  0x0000000000476f13 in run_builtin (p=p@entry=0x875628 <commands+168>, argc=argc@entry=3, argv=argv@entry=0x7ffea5a0e790) at perf.c:385
     #6  0x000000000047710b in handle_internal_command (argc=3, argv=0x7ffea5a0e790) at perf.c:445
     #7  0x0000000000477176 in run_argv (argcp=argcp@entry=0x7ffea5a0e5fc, argv=argv@entry=0x7ffea5a0e5f0) at perf.c:489
     #8  0x00000000004773e7 in main (argc=3, argv=0x7ffea5a0e790) at perf.c:606

Using hpp_dimension__add_output function to register the output column.
It will also mark the dimension as taken and omit above stuck.

Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444134312-29136-4-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/hist.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 25d6083..5029ba2 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -463,27 +463,27 @@ void perf_hpp__init(void)
 		return;
 
 	if (symbol_conf.cumulate_callchain) {
-		perf_hpp__column_enable(PERF_HPP__OVERHEAD_ACC);
+		hpp_dimension__add_output(PERF_HPP__OVERHEAD_ACC);
 		perf_hpp__format[PERF_HPP__OVERHEAD].name = "Self";
 	}
 
-	perf_hpp__column_enable(PERF_HPP__OVERHEAD);
+	hpp_dimension__add_output(PERF_HPP__OVERHEAD);
 
 	if (symbol_conf.show_cpu_utilization) {
-		perf_hpp__column_enable(PERF_HPP__OVERHEAD_SYS);
-		perf_hpp__column_enable(PERF_HPP__OVERHEAD_US);
+		hpp_dimension__add_output(PERF_HPP__OVERHEAD_SYS);
+		hpp_dimension__add_output(PERF_HPP__OVERHEAD_US);
 
 		if (perf_guest) {
-			perf_hpp__column_enable(PERF_HPP__OVERHEAD_GUEST_SYS);
-			perf_hpp__column_enable(PERF_HPP__OVERHEAD_GUEST_US);
+			hpp_dimension__add_output(PERF_HPP__OVERHEAD_GUEST_SYS);
+			hpp_dimension__add_output(PERF_HPP__OVERHEAD_GUEST_US);
 		}
 	}
 
 	if (symbol_conf.show_nr_samples)
-		perf_hpp__column_enable(PERF_HPP__SAMPLES);
+		hpp_dimension__add_output(PERF_HPP__SAMPLES);
 
 	if (symbol_conf.show_total_period)
-		perf_hpp__column_enable(PERF_HPP__PERIOD);
+		hpp_dimension__add_output(PERF_HPP__PERIOD);
 
 	/* prepend overhead field for backward compatiblity.  */
 	list = &perf_hpp__format[PERF_HPP__OVERHEAD].sort_list;

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

end of thread, other threads:[~2015-10-08  9:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-06 12:25 [RFC 0/3] perf tools: Make perf_hpp__init respect output dimensions Jiri Olsa
2015-10-06 12:25 ` [PATCH 1/3] perf tools: Get rid of superfluos call to reset_dimensions Jiri Olsa
2015-10-08  9:45   ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-10-06 12:25 ` [PATCH 2/3] perf tools: Introduce hpp_dimension__add_output function Jiri Olsa
2015-10-08  9:46   ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-10-06 12:25 ` [PATCH 3/3] perf tools: Use hpp_dimension__add_output to register hpp columns Jiri Olsa
2015-10-06 13:37   ` Arnaldo Carvalho de Melo
2015-10-08  9:46   ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-10-06 14:04 ` [RFC 0/3] perf tools: Make perf_hpp__init respect output dimensions Namhyung Kim
2015-10-06 14:28   ` Arnaldo Carvalho de Melo

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