public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] perf tools: Document relation of per-thread event count feature
@ 2015-05-09 15:19 Namhyung Kim
  2015-05-09 15:19 ` [PATCH 2/3] perf report: Force tty output if -T/--thread option is given Namhyung Kim
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Namhyung Kim @ 2015-05-09 15:19 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern

The 'perf record -s' and 'perf report -T' should be used together to see
per-thread event counts.  Document the relation of these commands.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/Documentation/perf-record.txt | 3 ++-
 tools/perf/Documentation/perf-report.txt | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index 76a141e326da..405c46555a63 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -147,7 +147,8 @@ OPTIONS
 
 -s::
 --stat::
-	Per thread counts.
+	Record per-thread event counts.  Use it with 'perf report -T' to see
+	the values.
 
 -d::
 --data::
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 896672badba3..610e1e2cd035 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -34,7 +34,8 @@ OPTIONS
 
 -T::
 --threads::
-	Show per-thread event counters
+	Show per-thread event counters.  The input data file should be recorded
+	with -s option.
 -c::
 --comms=::
 	Only consider symbols in these comms. CSV that understands
-- 
2.3.7


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

* [PATCH 2/3] perf report: Force tty output if -T/--thread option is given
  2015-05-09 15:19 [PATCH 1/3] perf tools: Document relation of per-thread event count feature Namhyung Kim
@ 2015-05-09 15:19 ` Namhyung Kim
  2015-05-10 17:16   ` Arnaldo Carvalho de Melo
  2015-05-15  6:43   ` [tip:perf/core] perf report: Force tty output if -T/ --thread option is given tip-bot for Namhyung Kim
  2015-05-09 15:19 ` [PATCH 3/3] perf report: Do not restrict -T option by other options Namhyung Kim
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 17+ messages in thread
From: Namhyung Kim @ 2015-05-09 15:19 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern

The -T/--thread option is supported only on --stdio mode (at least for
now).  So enforce the tty output if the option was requested.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/builtin-report.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index b63aeda719be..ee541ad555f2 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -803,8 +803,8 @@ repeat:
 		goto error;
 	}
 
-	/* Force tty output for header output. */
-	if (report.header || report.header_only)
+	/* Force tty output for header output and per-thread stat. */
+	if (report.header || report.header_only || report.show_threads)
 		use_browser = 0;
 
 	if (strcmp(input_name, "-") != 0)
-- 
2.3.7


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

* [PATCH 3/3] perf report: Do not restrict -T option by other options
  2015-05-09 15:19 [PATCH 1/3] perf tools: Document relation of per-thread event count feature Namhyung Kim
  2015-05-09 15:19 ` [PATCH 2/3] perf report: Force tty output if -T/--thread option is given Namhyung Kim
@ 2015-05-09 15:19 ` Namhyung Kim
  2015-05-10 17:20   ` Arnaldo Carvalho de Melo
  2015-05-09 16:13 ` [PATCH 1/3] perf tools: Document relation of per-thread event count feature David Ahern
  2015-05-15  6:43 ` [tip:perf/core] perf tools: Document relation of per-thread event count feature tip-bot for Namhyung Kim
  3 siblings, 1 reply; 17+ messages in thread
From: Namhyung Kim @ 2015-05-09 15:19 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern

It seems there's no reason to suppress per-thread event stat by -T
option when -s or -p option is used.  Make it work with those options.

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

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index ee541ad555f2..0ae5eaaaf766 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -330,15 +330,14 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
 	}
 
 	if (sort_order == NULL &&
-	    parent_pattern == default_parent_pattern) {
+	    parent_pattern == default_parent_pattern)
 		fprintf(stdout, "#\n# (%s)\n#\n", help);
 
-		if (rep->show_threads) {
-			bool style = !strcmp(rep->pretty_printing_style, "raw");
-			perf_read_values_display(stdout, &rep->show_threads_values,
-						 style);
-			perf_read_values_destroy(&rep->show_threads_values);
-		}
+	if (rep->show_threads) {
+		bool style = !strcmp(rep->pretty_printing_style, "raw");
+		perf_read_values_display(stdout, &rep->show_threads_values,
+					 style);
+		perf_read_values_destroy(&rep->show_threads_values);
 	}
 
 	return 0;
-- 
2.3.7


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

* Re: [PATCH 1/3] perf tools: Document relation of per-thread event count feature
  2015-05-09 15:19 [PATCH 1/3] perf tools: Document relation of per-thread event count feature Namhyung Kim
  2015-05-09 15:19 ` [PATCH 2/3] perf report: Force tty output if -T/--thread option is given Namhyung Kim
  2015-05-09 15:19 ` [PATCH 3/3] perf report: Do not restrict -T option by other options Namhyung Kim
@ 2015-05-09 16:13 ` David Ahern
  2015-05-11 13:49   ` [PATCH 5/3] perf report: Check attr.inherit_stat bit for --show-threads Namhyung Kim
  2015-05-15  6:43 ` [tip:perf/core] perf tools: Document relation of per-thread event count feature tip-bot for Namhyung Kim
  3 siblings, 1 reply; 17+ messages in thread
From: David Ahern @ 2015-05-09 16:13 UTC (permalink / raw)
  To: Namhyung Kim, Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML

On 5/9/15 9:19 AM, Namhyung Kim wrote:
> diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
> index 896672badba3..610e1e2cd035 100644
> --- a/tools/perf/Documentation/perf-report.txt
> +++ b/tools/perf/Documentation/perf-report.txt
> @@ -34,7 +34,8 @@ OPTIONS
>
>   -T::
>   --threads::
> -	Show per-thread event counters
> +	Show per-thread event counters.  The input data file should be recorded
> +	with -s option.
>   -c::
>   --comms=::
>   	Only consider symbols in these comms. CSV that understands
>

perf-report can verify that inherit_stat is set in attr's if 
show_threads is requested.

David

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

* Re: [PATCH 2/3] perf report: Force tty output if -T/--thread option is given
  2015-05-09 15:19 ` [PATCH 2/3] perf report: Force tty output if -T/--thread option is given Namhyung Kim
@ 2015-05-10 17:16   ` Arnaldo Carvalho de Melo
  2015-05-11 13:46     ` [PATCH 4/3] perf report: Show error message for incompatible UI request Namhyung Kim
  2015-05-15  6:43   ` [tip:perf/core] perf report: Force tty output if -T/ --thread option is given tip-bot for Namhyung Kim
  1 sibling, 1 reply; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-05-10 17:16 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern

Em Sun, May 10, 2015 at 12:19:43AM +0900, Namhyung Kim escreveu:
> The -T/--thread option is supported only on --stdio mode (at least for
> now).  So enforce the tty output if the option was requested.
> 
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/builtin-report.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index b63aeda719be..ee541ad555f2 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -803,8 +803,8 @@ repeat:
>  		goto error;
>  	}
>  
> -	/* Force tty output for header output. */
> -	if (report.header || report.header_only)
> +	/* Force tty output for header output and per-thread stat. */
> +	if (report.header || report.header_only || report.show_threads)
>  		use_browser = 0;

I will apply, but please consider sending a followup patch to emit a
warning for the cases when --tui or --gtk is explicitely passed, i.e.
emit a warning saying that that is not possible.

- Arnaldo

>  
>  	if (strcmp(input_name, "-") != 0)
> -- 
> 2.3.7

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

* Re: [PATCH 3/3] perf report: Do not restrict -T option by other options
  2015-05-09 15:19 ` [PATCH 3/3] perf report: Do not restrict -T option by other options Namhyung Kim
@ 2015-05-10 17:20   ` Arnaldo Carvalho de Melo
  2015-05-11 13:43     ` Namhyung Kim
  2015-05-11 13:44     ` [PATCH v2 " Namhyung Kim
  0 siblings, 2 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-05-10 17:20 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern

Em Sun, May 10, 2015 at 12:19:44AM +0900, Namhyung Kim escreveu:
> It seems there's no reason to suppress per-thread event stat by -T
> option when -s or -p option is used.  Make it work with those options.

Not applying on my perf/core branch, please check, I'll push what I have
now.

- Arnaldo
 
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/builtin-report.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index ee541ad555f2..0ae5eaaaf766 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -330,15 +330,14 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
>  	}
>  
>  	if (sort_order == NULL &&
> -	    parent_pattern == default_parent_pattern) {
> +	    parent_pattern == default_parent_pattern)
>  		fprintf(stdout, "#\n# (%s)\n#\n", help);
>  
> -		if (rep->show_threads) {
> -			bool style = !strcmp(rep->pretty_printing_style, "raw");
> -			perf_read_values_display(stdout, &rep->show_threads_values,
> -						 style);
> -			perf_read_values_destroy(&rep->show_threads_values);
> -		}
> +	if (rep->show_threads) {
> +		bool style = !strcmp(rep->pretty_printing_style, "raw");
> +		perf_read_values_display(stdout, &rep->show_threads_values,
> +					 style);
> +		perf_read_values_destroy(&rep->show_threads_values);
>  	}
>  
>  	return 0;
> -- 
> 2.3.7

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

* Re: [PATCH 3/3] perf report: Do not restrict -T option by other options
  2015-05-10 17:20   ` Arnaldo Carvalho de Melo
@ 2015-05-11 13:43     ` Namhyung Kim
  2015-05-11 13:44     ` [PATCH v2 " Namhyung Kim
  1 sibling, 0 replies; 17+ messages in thread
From: Namhyung Kim @ 2015-05-11 13:43 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern

Hi Arnaldo,

On Sun, May 10, 2015 at 02:20:59PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Sun, May 10, 2015 at 12:19:44AM +0900, Namhyung Kim escreveu:
> > It seems there's no reason to suppress per-thread event stat by -T
> > option when -s or -p option is used.  Make it work with those options.
> 
> Not applying on my perf/core branch, please check, I'll push what I have
> now.

It seems that it's because the commit e944ec2ca00f ("perf report: Fix
-T/--threads option to work again") in the perf/urgent is not merged
to the perf/core yet.

I'll resend v2 soon.

Thanks,
Namhyung


> 
> - Arnaldo
>  
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> > ---
> >  tools/perf/builtin-report.c | 13 ++++++-------
> >  1 file changed, 6 insertions(+), 7 deletions(-)
> > 
> > diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> > index ee541ad555f2..0ae5eaaaf766 100644
> > --- a/tools/perf/builtin-report.c
> > +++ b/tools/perf/builtin-report.c
> > @@ -330,15 +330,14 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
> >  	}
> >  
> >  	if (sort_order == NULL &&
> > -	    parent_pattern == default_parent_pattern) {
> > +	    parent_pattern == default_parent_pattern)
> >  		fprintf(stdout, "#\n# (%s)\n#\n", help);
> >  
> > -		if (rep->show_threads) {
> > -			bool style = !strcmp(rep->pretty_printing_style, "raw");
> > -			perf_read_values_display(stdout, &rep->show_threads_values,
> > -						 style);
> > -			perf_read_values_destroy(&rep->show_threads_values);
> > -		}
> > +	if (rep->show_threads) {
> > +		bool style = !strcmp(rep->pretty_printing_style, "raw");
> > +		perf_read_values_display(stdout, &rep->show_threads_values,
> > +					 style);
> > +		perf_read_values_destroy(&rep->show_threads_values);
> >  	}
> >  
> >  	return 0;
> > -- 
> > 2.3.7

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

* [PATCH v2 3/3] perf report: Do not restrict -T option by other options
  2015-05-10 17:20   ` Arnaldo Carvalho de Melo
  2015-05-11 13:43     ` Namhyung Kim
@ 2015-05-11 13:44     ` Namhyung Kim
  2015-05-11 14:08       ` Arnaldo Carvalho de Melo
  2015-05-15  6:45       ` [tip:perf/core] " tip-bot for Namhyung Kim
  1 sibling, 2 replies; 17+ messages in thread
From: Namhyung Kim @ 2015-05-11 13:44 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern

It seems there's no reason to suppress per-thread event stat by -T
option when -s or -p option is used.  Make it work with those options.

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

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index f11da6f52c21..08a4246d6b62 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -333,15 +333,14 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
 	}
 
 	if (sort_order == default_sort_order &&
-	    parent_pattern == default_parent_pattern) {
+	    parent_pattern == default_parent_pattern)
 		fprintf(stdout, "#\n# (%s)\n#\n", help);
 
-		if (rep->show_threads) {
-			bool style = !strcmp(rep->pretty_printing_style, "raw");
-			perf_read_values_display(stdout, &rep->show_threads_values,
-						 style);
-			perf_read_values_destroy(&rep->show_threads_values);
-		}
+	if (rep->show_threads) {
+		bool style = !strcmp(rep->pretty_printing_style, "raw");
+		perf_read_values_display(stdout, &rep->show_threads_values,
+					 style);
+		perf_read_values_destroy(&rep->show_threads_values);
 	}
 
 	return 0;
-- 
2.4.0


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

* [PATCH 4/3] perf report: Show error message for incompatible UI request
  2015-05-10 17:16   ` Arnaldo Carvalho de Melo
@ 2015-05-11 13:46     ` Namhyung Kim
  2015-05-11 14:03       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 17+ messages in thread
From: Namhyung Kim @ 2015-05-11 13:46 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern

Currently --header, --header-only and --threads/-T options are supported
on stdio mode only.  Show warning if user passes one of --tui or --gtk
option with these like below:

  $ perf report -T --tui
  Error: --threads option cannot be used with --tui

   usage: perf report [<options>]

          -T, --threads     Show per-thread event counters
          --tui             Use the TUI interface

Requested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/builtin-report.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 08a4246d6b62..6ac2c7a01a63 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -815,9 +815,24 @@ repeat:
 	}
 
 	/* Force tty output for header output and per-thread stat. */
-	if (report.header || report.header_only || report.show_threads)
+	if (report.header || report.header_only || report.show_threads) {
 		use_browser = 0;
 
+		if (report.use_tui || report.use_gtk) {
+			pr_err("Error: %s option cannot be used with %s\n",
+			       report.header_only ? "--header-only" :
+			       report.header ? "--header" : "--threads",
+			       report.use_tui ? "--tui" : "--gtk");
+
+			parse_options_usage(report_usage, options,
+					    report.header_only ? "header-only" :
+					    report.header ? "header": "threads", 0);
+			parse_options_usage(NULL, options,
+					    report.use_tui ? "tui" : "gtk", 0);
+			goto error;
+		}
+	}
+
 	if (strcmp(input_name, "-") != 0)
 		setup_browser(true);
 	else
-- 
2.4.0


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

* [PATCH 5/3] perf report: Check attr.inherit_stat bit for --show-threads
  2015-05-09 16:13 ` [PATCH 1/3] perf tools: Document relation of per-thread event count feature David Ahern
@ 2015-05-11 13:49   ` Namhyung Kim
  2015-05-11 15:35     ` [PATCH v2 " Namhyung Kim
  0 siblings, 1 reply; 17+ messages in thread
From: Namhyung Kim @ 2015-05-11 13:49 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern

Check the evsel->attr.inherit_stat bit and show warning message if it's
missing and -T/--threads option was given:

  $ perf report -T
  Error: perf.data file has no per-thread stat data.
         Did you run 'perf record' with -s option?

Suggested-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/builtin-report.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 6ac2c7a01a63..ac2dc057cbc5 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -848,6 +848,19 @@ repeat:
 		      stdout);
 	}
 
+	if (report.show_threads) {
+		struct perf_evsel *evsel;
+
+		evlist__for_each(session->evlist, evsel) {
+			if (!evsel->attr.inherit_stat) {
+				pr_err("Error: %s file has no per-thread stat data.\n"
+				       "       Did you run 'perf record' with -s option?\n",
+					input_name);
+				goto error;
+			}
+		}
+	}
+
 	/*
 	 * Only in the TUI browser we are doing integrated annotation,
 	 * so don't allocate extra space that won't be used in the stdio
-- 
2.4.0


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

* Re: [PATCH 4/3] perf report: Show error message for incompatible UI request
  2015-05-11 13:46     ` [PATCH 4/3] perf report: Show error message for incompatible UI request Namhyung Kim
@ 2015-05-11 14:03       ` Arnaldo Carvalho de Melo
  2015-05-11 15:37         ` Namhyung Kim
  0 siblings, 1 reply; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-05-11 14:03 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern

Em Mon, May 11, 2015 at 10:46:23PM +0900, Namhyung Kim escreveu:
> Currently --header, --header-only and --threads/-T options are supported
> on stdio mode only.  Show warning if user passes one of --tui or --gtk
> option with these like below:
> 
>   $ perf report -T --tui
>   Error: --threads option cannot be used with --tui
> 
>    usage: perf report [<options>]
> 
>           -T, --threads     Show per-thread event counters
>           --tui             Use the TUI interface
> 
> Requested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>

So thanks for that! Can you please check that it applies on top of my
perf/core branch? I had already applied your patch :-\ Just pushed the
branch, should be at git.kernel.org soon.

- Arnaldo

> ---
>  tools/perf/builtin-report.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index 08a4246d6b62..6ac2c7a01a63 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -815,9 +815,24 @@ repeat:
>  	}
>  
>  	/* Force tty output for header output and per-thread stat. */
> -	if (report.header || report.header_only || report.show_threads)
> +	if (report.header || report.header_only || report.show_threads) {
>  		use_browser = 0;
>  
> +		if (report.use_tui || report.use_gtk) {
> +			pr_err("Error: %s option cannot be used with %s\n",
> +			       report.header_only ? "--header-only" :
> +			       report.header ? "--header" : "--threads",
> +			       report.use_tui ? "--tui" : "--gtk");
> +
> +			parse_options_usage(report_usage, options,
> +					    report.header_only ? "header-only" :
> +					    report.header ? "header": "threads", 0);
> +			parse_options_usage(NULL, options,
> +					    report.use_tui ? "tui" : "gtk", 0);
> +			goto error;
> +		}
> +	}
> +
>  	if (strcmp(input_name, "-") != 0)
>  		setup_browser(true);
>  	else
> -- 
> 2.4.0

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

* Re: [PATCH v2 3/3] perf report: Do not restrict -T option by other options
  2015-05-11 13:44     ` [PATCH v2 " Namhyung Kim
@ 2015-05-11 14:08       ` Arnaldo Carvalho de Melo
  2015-05-15  6:45       ` [tip:perf/core] " tip-bot for Namhyung Kim
  1 sibling, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-05-11 14:08 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern

Em Mon, May 11, 2015 at 10:44:39PM +0900, Namhyung Kim escreveu:
> It seems there's no reason to suppress per-thread event stat by -T
> option when -s or -p option is used.  Make it work with those options.

Thanks, applied to perf/core.

- Arnaldo

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

* [PATCH v2 5/3] perf report: Check attr.inherit_stat bit for --show-threads
  2015-05-11 13:49   ` [PATCH 5/3] perf report: Check attr.inherit_stat bit for --show-threads Namhyung Kim
@ 2015-05-11 15:35     ` Namhyung Kim
  0 siblings, 0 replies; 17+ messages in thread
From: Namhyung Kim @ 2015-05-11 15:35 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern

Check the evsel->attr.inherit_stat bit and show warning message if it's
missing and -T/--threads option was given:

  $ perf report -T
  Error: perf.data file has no per-thread stat data.
         Did you run 'perf record' with -s option?

Suggested-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
Move error message before header info message

 tools/perf/builtin-report.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 6ac2c7a01a63..343cca2a2779 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -833,6 +833,19 @@ repeat:
 		}
 	}
 
+	if (report.show_threads) {
+		struct perf_evsel *evsel;
+
+		evlist__for_each(session->evlist, evsel) {
+			if (!evsel->attr.inherit_stat) {
+				pr_err("Error: %s file has no per-thread stat data.\n"
+				       "       Did you run 'perf record' with -s option?\n",
+					input_name);
+				goto error;
+			}
+		}
+	}
+
 	if (strcmp(input_name, "-") != 0)
 		setup_browser(true);
 	else
-- 
2.4.0


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

* Re: [PATCH 4/3] perf report: Show error message for incompatible UI request
  2015-05-11 14:03       ` Arnaldo Carvalho de Melo
@ 2015-05-11 15:37         ` Namhyung Kim
  0 siblings, 0 replies; 17+ messages in thread
From: Namhyung Kim @ 2015-05-11 15:37 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern

On Mon, May 11, 2015 at 11:03:09AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, May 11, 2015 at 10:46:23PM +0900, Namhyung Kim escreveu:
> > Currently --header, --header-only and --threads/-T options are supported
> > on stdio mode only.  Show warning if user passes one of --tui or --gtk
> > option with these like below:
> > 
> >   $ perf report -T --tui
> >   Error: --threads option cannot be used with --tui
> > 
> >    usage: perf report [<options>]
> > 
> >           -T, --threads     Show per-thread event counters
> >           --tui             Use the TUI interface
> > 
> > Requested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> 
> So thanks for that! Can you please check that it applies on top of my
> perf/core branch? I had already applied your patch :-\ Just pushed the
> branch, should be at git.kernel.org soon.

Looks OK to me.

Thanks,
Namhyung

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

* [tip:perf/core] perf tools: Document relation of per-thread event count feature
  2015-05-09 15:19 [PATCH 1/3] perf tools: Document relation of per-thread event count feature Namhyung Kim
                   ` (2 preceding siblings ...)
  2015-05-09 16:13 ` [PATCH 1/3] perf tools: Document relation of per-thread event count feature David Ahern
@ 2015-05-15  6:43 ` tip-bot for Namhyung Kim
  3 siblings, 0 replies; 17+ messages in thread
From: tip-bot for Namhyung Kim @ 2015-05-15  6:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, hpa, tglx, a.p.zijlstra, dsahern, linux-kernel, jolsa,
	mingo, namhyung

Commit-ID:  1f91d5fd03d410365d9781ce981f9712b19a0751
Gitweb:     http://git.kernel.org/tip/1f91d5fd03d410365d9781ce981f9712b19a0751
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Sun, 10 May 2015 00:19:42 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 12 May 2015 09:59:48 -0300

perf tools: Document relation of per-thread event count feature

The 'perf record -s' and 'perf report -T' should be used together to see
per-thread event counts.  Document the relation of these commands.

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>
Link: http://lkml.kernel.org/r/1431184784-30525-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-record.txt | 3 ++-
 tools/perf/Documentation/perf-report.txt | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index 57dd57b..280533e 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -147,7 +147,8 @@ OPTIONS
 
 -s::
 --stat::
-	Per thread counts.
+	Record per-thread event counts.  Use it with 'perf report -T' to see
+	the values.
 
 -d::
 --data::
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 27190ed..c33b69f 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -34,7 +34,8 @@ OPTIONS
 
 -T::
 --threads::
-	Show per-thread event counters
+	Show per-thread event counters.  The input data file should be recorded
+	with -s option.
 -c::
 --comms=::
 	Only consider symbols in these comms. CSV that understands

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

* [tip:perf/core] perf report: Force tty output if -T/ --thread option is given
  2015-05-09 15:19 ` [PATCH 2/3] perf report: Force tty output if -T/--thread option is given Namhyung Kim
  2015-05-10 17:16   ` Arnaldo Carvalho de Melo
@ 2015-05-15  6:43   ` tip-bot for Namhyung Kim
  1 sibling, 0 replies; 17+ messages in thread
From: tip-bot for Namhyung Kim @ 2015-05-15  6:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: jolsa, linux-kernel, namhyung, tglx, dsahern, a.p.zijlstra, hpa,
	acme, mingo

Commit-ID:  b138f42ed4920f808b5599efc2c4b150c27a4153
Gitweb:     http://git.kernel.org/tip/b138f42ed4920f808b5599efc2c4b150c27a4153
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Sun, 10 May 2015 00:19:43 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 12 May 2015 09:59:48 -0300

perf report: Force tty output if -T/--thread option is given

The -T/--thread option is supported only on --stdio mode (at least for
now).  So enforce the tty output if the option was requested.

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>
Link: http://lkml.kernel.org/r/1431184784-30525-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-report.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 62b49ca..4d642db 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -815,8 +815,8 @@ repeat:
 		goto error;
 	}
 
-	/* Force tty output for header output. */
-	if (report.header || report.header_only)
+	/* Force tty output for header output and per-thread stat. */
+	if (report.header || report.header_only || report.show_threads)
 		use_browser = 0;
 
 	if (strcmp(input_name, "-") != 0)

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

* [tip:perf/core] perf report: Do not restrict -T option by other options
  2015-05-11 13:44     ` [PATCH v2 " Namhyung Kim
  2015-05-11 14:08       ` Arnaldo Carvalho de Melo
@ 2015-05-15  6:45       ` tip-bot for Namhyung Kim
  1 sibling, 0 replies; 17+ messages in thread
From: tip-bot for Namhyung Kim @ 2015-05-15  6:45 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: jolsa, dsahern, acme, tglx, a.p.zijlstra, namhyung, mingo,
	linux-kernel, hpa

Commit-ID:  021162cf02fcfa80cbae5f3b7304e9cb392962eb
Gitweb:     http://git.kernel.org/tip/021162cf02fcfa80cbae5f3b7304e9cb392962eb
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Mon, 11 May 2015 22:44:39 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 12 May 2015 09:59:51 -0300

perf report: Do not restrict -T option by other options

It seems there's no reason to suppress per-thread event stat by -T
option when -s or -p option is used.  Make it work with those options.

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>
Link: http://lkml.kernel.org/r/1431351879-23798-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-report.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 4d642db..92fca21 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -333,15 +333,14 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
 	}
 
 	if (sort_order == NULL &&
-	    parent_pattern == default_parent_pattern) {
+	    parent_pattern == default_parent_pattern)
 		fprintf(stdout, "#\n# (%s)\n#\n", help);
 
-		if (rep->show_threads) {
-			bool style = !strcmp(rep->pretty_printing_style, "raw");
-			perf_read_values_display(stdout, &rep->show_threads_values,
-						 style);
-			perf_read_values_destroy(&rep->show_threads_values);
-		}
+	if (rep->show_threads) {
+		bool style = !strcmp(rep->pretty_printing_style, "raw");
+		perf_read_values_display(stdout, &rep->show_threads_values,
+					 style);
+		perf_read_values_destroy(&rep->show_threads_values);
 	}
 
 	return 0;

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

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

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-09 15:19 [PATCH 1/3] perf tools: Document relation of per-thread event count feature Namhyung Kim
2015-05-09 15:19 ` [PATCH 2/3] perf report: Force tty output if -T/--thread option is given Namhyung Kim
2015-05-10 17:16   ` Arnaldo Carvalho de Melo
2015-05-11 13:46     ` [PATCH 4/3] perf report: Show error message for incompatible UI request Namhyung Kim
2015-05-11 14:03       ` Arnaldo Carvalho de Melo
2015-05-11 15:37         ` Namhyung Kim
2015-05-15  6:43   ` [tip:perf/core] perf report: Force tty output if -T/ --thread option is given tip-bot for Namhyung Kim
2015-05-09 15:19 ` [PATCH 3/3] perf report: Do not restrict -T option by other options Namhyung Kim
2015-05-10 17:20   ` Arnaldo Carvalho de Melo
2015-05-11 13:43     ` Namhyung Kim
2015-05-11 13:44     ` [PATCH v2 " Namhyung Kim
2015-05-11 14:08       ` Arnaldo Carvalho de Melo
2015-05-15  6:45       ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-05-09 16:13 ` [PATCH 1/3] perf tools: Document relation of per-thread event count feature David Ahern
2015-05-11 13:49   ` [PATCH 5/3] perf report: Check attr.inherit_stat bit for --show-threads Namhyung Kim
2015-05-11 15:35     ` [PATCH v2 " Namhyung Kim
2015-05-15  6:43 ` [tip:perf/core] perf tools: Document relation of per-thread event count feature tip-bot for Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox