All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf report: Fix some option handling on --stdio
@ 2015-05-13 15:03 Namhyung Kim
  2015-05-13 16:07 ` Arnaldo Carvalho de Melo
  2015-05-15  6:46 ` [tip:perf/core] " tip-bot for Namhyung Kim
  0 siblings, 2 replies; 4+ messages in thread
From: Namhyung Kim @ 2015-05-13 15:03 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern, Taeung Song

There's a bug that perf report sometimes ignore some options on --stdio
output.  This bug is triggered only if a related config variable is
set.  For example, let's assume we have a following config file.

  $ cat ~/.perfconfig
  [call-graph]
    print-type = graph
  [hist]
    percentage = absolute

Then, following perf config will not honor some options.

  $ perf record -ag sleep 1
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.199 MB perf.data (77 samples) ]

  $ perf report -g none --stdio
  # To display the perf.data header info, please use --header/--header-only options.
  #
  # Samples: 77  of event 'cycles'
  # Event count (approx.): 25425383
  #
  # Overhead  Command          Shared Object            Symbol
  # ........  ...............  .......................  ..............
  #
      16.34%  swapper          [kernel.vmlinux]         [k] intel_idle
                      |
                      ---intel_idle
                         cpuidle_enter_state
                         cpuidle_enter
                         cpu_startup_entry
   ...

With '-g none' option, it should not show callchains, but it still shows
callchains.  However it works as expected on --tui output.

Similarly, '--percentage relative' option is not work and still shows a
absolute percentage values.

Looking at the source, I found that those setting were overwritten by
config variables when setup_pager() called.  The setup_pager() is to
start a pager process so that it can manage long lines of output on the
stdio mode.  But as it calls the perf_config() after parsing arguments,
the settings were overwritten regardless of command line options.

The reason it calls perf_config() is to find the 'pager_program' which
might be set by a config variable, I guess.  However current perf code
does not provide the config variable for it, so it's just meaningless
IMHO.  Eliminating the call makes the option working as expected.

Cc: Taeung Song <treeze.taeung@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/cache.h       | 1 -
 tools/perf/util/environment.c | 1 -
 tools/perf/util/pager.c       | 5 -----
 3 files changed, 7 deletions(-)

diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h
index fbcca21d66ab..c861373aaed3 100644
--- a/tools/perf/util/cache.h
+++ b/tools/perf/util/cache.h
@@ -30,7 +30,6 @@ extern const char *perf_config_dirname(const char *, const char *);
 
 /* pager.c */
 extern void setup_pager(void);
-extern const char *pager_program;
 extern int pager_in_use(void);
 extern int pager_use_color;
 
diff --git a/tools/perf/util/environment.c b/tools/perf/util/environment.c
index 275b0ee345f5..7405123692f1 100644
--- a/tools/perf/util/environment.c
+++ b/tools/perf/util/environment.c
@@ -5,5 +5,4 @@
  */
 #include "cache.h"
 
-const char *pager_program;
 int pager_use_color = 1;
diff --git a/tools/perf/util/pager.c b/tools/perf/util/pager.c
index 31ee02d4e988..53ef006a951c 100644
--- a/tools/perf/util/pager.c
+++ b/tools/perf/util/pager.c
@@ -50,11 +50,6 @@ void setup_pager(void)
 
 	if (!isatty(1))
 		return;
-	if (!pager) {
-		if (!pager_program)
-			perf_config(perf_default_config, NULL);
-		pager = pager_program;
-	}
 	if (!pager)
 		pager = getenv("PAGER");
 	if (!(pager || access("/usr/bin/pager", X_OK)))
-- 
2.4.0


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

* Re: [PATCH] perf report: Fix some option handling on --stdio
  2015-05-13 15:03 [PATCH] perf report: Fix some option handling on --stdio Namhyung Kim
@ 2015-05-13 16:07 ` Arnaldo Carvalho de Melo
  2015-05-14  8:06   ` Namhyung Kim
  2015-05-15  6:46 ` [tip:perf/core] " tip-bot for Namhyung Kim
  1 sibling, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-05-13 16:07 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern, Taeung Song

Em Thu, May 14, 2015 at 12:03:26AM +0900, Namhyung Kim escreveu:
> There's a bug that perf report sometimes ignore some options on --stdio
> output.  This bug is triggered only if a related config variable is
> set.  For example, let's assume we have a following config file.

Testing, please next time indicate against what branch this is to be
applied, as I thought about perf/core, but it doesn't apply there, so
tried perf/urgent, where it applies.

- Arnaldo
 
>   $ cat ~/.perfconfig
>   [call-graph]
>     print-type = graph
>   [hist]
>     percentage = absolute
> 
> Then, following perf config will not honor some options.
> 
>   $ perf record -ag sleep 1
>   [ perf record: Woken up 1 times to write data ]
>   [ perf record: Captured and wrote 0.199 MB perf.data (77 samples) ]
> 
>   $ perf report -g none --stdio
>   # To display the perf.data header info, please use --header/--header-only options.
>   #
>   # Samples: 77  of event 'cycles'
>   # Event count (approx.): 25425383
>   #
>   # Overhead  Command          Shared Object            Symbol
>   # ........  ...............  .......................  ..............
>   #
>       16.34%  swapper          [kernel.vmlinux]         [k] intel_idle
>                       |
>                       ---intel_idle
>                          cpuidle_enter_state
>                          cpuidle_enter
>                          cpu_startup_entry
>    ...
> 
> With '-g none' option, it should not show callchains, but it still shows
> callchains.  However it works as expected on --tui output.
> 
> Similarly, '--percentage relative' option is not work and still shows a
> absolute percentage values.
> 
> Looking at the source, I found that those setting were overwritten by
> config variables when setup_pager() called.  The setup_pager() is to
> start a pager process so that it can manage long lines of output on the
> stdio mode.  But as it calls the perf_config() after parsing arguments,
> the settings were overwritten regardless of command line options.
> 
> The reason it calls perf_config() is to find the 'pager_program' which
> might be set by a config variable, I guess.  However current perf code
> does not provide the config variable for it, so it's just meaningless
> IMHO.  Eliminating the call makes the option working as expected.
> 
> Cc: Taeung Song <treeze.taeung@gmail.com>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/util/cache.h       | 1 -
>  tools/perf/util/environment.c | 1 -
>  tools/perf/util/pager.c       | 5 -----
>  3 files changed, 7 deletions(-)
> 
> diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h
> index fbcca21d66ab..c861373aaed3 100644
> --- a/tools/perf/util/cache.h
> +++ b/tools/perf/util/cache.h
> @@ -30,7 +30,6 @@ extern const char *perf_config_dirname(const char *, const char *);
>  
>  /* pager.c */
>  extern void setup_pager(void);
> -extern const char *pager_program;
>  extern int pager_in_use(void);
>  extern int pager_use_color;
>  
> diff --git a/tools/perf/util/environment.c b/tools/perf/util/environment.c
> index 275b0ee345f5..7405123692f1 100644
> --- a/tools/perf/util/environment.c
> +++ b/tools/perf/util/environment.c
> @@ -5,5 +5,4 @@
>   */
>  #include "cache.h"
>  
> -const char *pager_program;
>  int pager_use_color = 1;
> diff --git a/tools/perf/util/pager.c b/tools/perf/util/pager.c
> index 31ee02d4e988..53ef006a951c 100644
> --- a/tools/perf/util/pager.c
> +++ b/tools/perf/util/pager.c
> @@ -50,11 +50,6 @@ void setup_pager(void)
>  
>  	if (!isatty(1))
>  		return;
> -	if (!pager) {
> -		if (!pager_program)
> -			perf_config(perf_default_config, NULL);
> -		pager = pager_program;
> -	}
>  	if (!pager)
>  		pager = getenv("PAGER");
>  	if (!(pager || access("/usr/bin/pager", X_OK)))
> -- 
> 2.4.0

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

* Re: [PATCH] perf report: Fix some option handling on --stdio
  2015-05-13 16:07 ` Arnaldo Carvalho de Melo
@ 2015-05-14  8:06   ` Namhyung Kim
  0 siblings, 0 replies; 4+ messages in thread
From: Namhyung Kim @ 2015-05-14  8:06 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern, Taeung Song

Hi Arnaldo,

On Wed, May 13, 2015 at 01:07:19PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, May 14, 2015 at 12:03:26AM +0900, Namhyung Kim escreveu:
> > There's a bug that perf report sometimes ignore some options on --stdio
> > output.  This bug is triggered only if a related config variable is
> > set.  For example, let's assume we have a following config file.
> 
> Testing, please next time indicate against what branch this is to be
> applied, as I thought about perf/core, but it doesn't apply there, so
> tried perf/urgent, where it applies.

Oh, sorry about that.  I actually intended to apply it to the
perf/core but forgot to rebase to the current code.  It's fortunate
that it can be applied to perf/urgent cleanly though. :)

I'll add an indication next time if patch should go to other branch
than perf/core.

Thanks,
Namhyung

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

* [tip:perf/core] perf report: Fix some option handling on --stdio
  2015-05-13 15:03 [PATCH] perf report: Fix some option handling on --stdio Namhyung Kim
  2015-05-13 16:07 ` Arnaldo Carvalho de Melo
@ 2015-05-15  6:46 ` tip-bot for Namhyung Kim
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Namhyung Kim @ 2015-05-15  6:46 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, treeze.taeung, mingo, dsahern, namhyung, hpa,
	jolsa, tglx, a.p.zijlstra, acme

Commit-ID:  4fd113b5ce803da0b8fa0494513bedfdf2feb483
Gitweb:     http://git.kernel.org/tip/4fd113b5ce803da0b8fa0494513bedfdf2feb483
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Thu, 14 May 2015 00:03:26 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 14 May 2015 10:05:22 -0300

perf report: Fix some option handling on --stdio

There's a bug that perf report sometimes ignore some options on --stdio
output.  This bug is triggered only if a related config variable is set.
For example, let's assume we have a following config file.

  $ cat ~/.perfconfig
  [call-graph]
    print-type = graph
  [hist]
    percentage = absolute

Then, following perf config will not honor some options.

  $ perf record -ag sleep 1
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.199 MB perf.data (77 samples) ]

  $ perf report -g none --stdio
  # To display the perf.data header info, please use --header/--header-only options.
  #
  # Samples: 77  of event 'cycles'
  # Event count (approx.): 25425383
  #
  # Overhead  Command          Shared Object            Symbol
  # ........  ...............  .......................  ..............
  #
      16.34%  swapper          [kernel.vmlinux]         [k] intel_idle
                      |
                      ---intel_idle
                         cpuidle_enter_state
                         cpuidle_enter
                         cpu_startup_entry
   ...

With '-g none' option, it should not show callchains, but it still shows
callchains.  However it works as expected on --tui output.

Similarly, '--percentage relative' option is not work and still shows a
absolute percentage values.

Looking at the source, I found that those setting were overwritten by
config variables when setup_pager() called.  The setup_pager() is to
start a pager process so that it can manage long lines of output on the
stdio mode.  But as it calls the perf_config() after parsing arguments,
the settings were overwritten regardless of command line options.

The reason it calls perf_config() is to find the 'pager_program' which
might be set by a config variable, I guess.  However current perf code
does not provide the config variable for it, so it's just meaningless
IMHO.  Eliminating the call makes the option working as expected.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Taeung Song <treeze.taeung@gmail.com>
Link: http://lkml.kernel.org/r/1431529406-6762-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/cache.h       | 1 -
 tools/perf/util/environment.c | 1 -
 tools/perf/util/pager.c       | 5 -----
 3 files changed, 7 deletions(-)

diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h
index fbcca21..c861373 100644
--- a/tools/perf/util/cache.h
+++ b/tools/perf/util/cache.h
@@ -30,7 +30,6 @@ extern const char *perf_config_dirname(const char *, const char *);
 
 /* pager.c */
 extern void setup_pager(void);
-extern const char *pager_program;
 extern int pager_in_use(void);
 extern int pager_use_color;
 
diff --git a/tools/perf/util/environment.c b/tools/perf/util/environment.c
index 275b0ee..7405123 100644
--- a/tools/perf/util/environment.c
+++ b/tools/perf/util/environment.c
@@ -5,5 +5,4 @@
  */
 #include "cache.h"
 
-const char *pager_program;
 int pager_use_color = 1;
diff --git a/tools/perf/util/pager.c b/tools/perf/util/pager.c
index 31ee02d..53ef006 100644
--- a/tools/perf/util/pager.c
+++ b/tools/perf/util/pager.c
@@ -50,11 +50,6 @@ void setup_pager(void)
 
 	if (!isatty(1))
 		return;
-	if (!pager) {
-		if (!pager_program)
-			perf_config(perf_default_config, NULL);
-		pager = pager_program;
-	}
 	if (!pager)
 		pager = getenv("PAGER");
 	if (!(pager || access("/usr/bin/pager", X_OK)))

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

end of thread, other threads:[~2015-05-15  6:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-13 15:03 [PATCH] perf report: Fix some option handling on --stdio Namhyung Kim
2015-05-13 16:07 ` Arnaldo Carvalho de Melo
2015-05-14  8:06   ` Namhyung Kim
2015-05-15  6:46 ` [tip:perf/core] " 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.