linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2] perf/stat: Report unsupported events properly
@ 2015-02-13 18:40 Suzuki K. Poulose
  2015-02-13 19:39 ` David Ahern
  2015-03-03  6:22 ` [tip:perf/core] perf stat: " tip-bot for Suzuki K. Poulose
  0 siblings, 2 replies; 6+ messages in thread
From: Suzuki K. Poulose @ 2015-02-13 18:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: Suzuki K. Poulose, Jiri Olsa, Arnaldo Carvalho de Melo

From: "Suzuki K. Poulose" <suzuki.poulose@arm.com>

Commit 1971f59 (perf stat: Use read_counter in read_counter_aggr )
broke the perf stat output for unsupported counters.

 $ perf stat -v -a -C 0 -e CCI_400/config=24/ sleep 1
 Warning:
 CCI_400/config=24/ event is not supported by the kernel.

  Performance counter stats for 'system wide':

                  0      CCI_400/config=24/

        1.080265400 seconds time elapsed

Where it used to be :

$ perf stat -v -a -C 0 -e CCI_400/config=24/ sleep 1
 Warning:
 CCI_400/config=24/ event is not supported by the kernel.

  Performance counter stats for 'system wide':

    <not supported>      CCI_400/config=24/

        1.083840675 seconds time elapsed

This patch fixes the issues by checking if the counter is supported,
before reading and logging the counter value.

Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
---
 tools/perf/builtin-stat.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index e598e4e..d28949d 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -510,6 +510,9 @@ static int read_counter(struct perf_evsel *counter)
 	int ncpus = perf_evsel__nr_cpus(counter);
 	int cpu, thread;
 
+	if (!counter->supported)
+		return -ENOENT;
+
 	if (counter->system_wide)
 		nthreads = 1;
 
@@ -1285,7 +1288,7 @@ static void print_counter_aggr(struct perf_evsel *counter, char *prefix)
 	if (prefix)
 		fprintf(output, "%s", prefix);
 
-	if (scaled == -1) {
+	if (scaled == -1 || !counter->supported) {
 		fprintf(output, "%*s%s",
 			csv_output ? 0 : 18,
 			counter->supported ? CNTR_NOT_COUNTED : CNTR_NOT_SUPPORTED,
-- 
1.7.9.5



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

* Re: [PATCHv2] perf/stat: Report unsupported events properly
  2015-02-13 18:40 [PATCHv2] perf/stat: Report unsupported events properly Suzuki K. Poulose
@ 2015-02-13 19:39 ` David Ahern
  2015-02-13 20:50   ` Arnaldo Carvalho de Melo
  2015-03-03  6:22 ` [tip:perf/core] perf stat: " tip-bot for Suzuki K. Poulose
  1 sibling, 1 reply; 6+ messages in thread
From: David Ahern @ 2015-02-13 19:39 UTC (permalink / raw)
  To: Suzuki K. Poulose, linux-kernel; +Cc: Jiri Olsa, Arnaldo Carvalho de Melo



On 02/13/2015 11:40 AM, Suzuki K. Poulose wrote:
> From: "Suzuki K. Poulose" <suzuki.poulose@arm.com>
>
> Commit 1971f59 (perf stat: Use read_counter in read_counter_aggr )
> broke the perf stat output for unsupported counters.
>
>   $ perf stat -v -a -C 0 -e CCI_400/config=24/ sleep 1
>   Warning:
>   CCI_400/config=24/ event is not supported by the kernel.
>
>    Performance counter stats for 'system wide':
>
>                    0      CCI_400/config=24/
>
>          1.080265400 seconds time elapsed
>
> Where it used to be :
>
> $ perf stat -v -a -C 0 -e CCI_400/config=24/ sleep 1
>   Warning:
>   CCI_400/config=24/ event is not supported by the kernel.
>
>    Performance counter stats for 'system wide':
>
>      <not supported>      CCI_400/config=24/
>
>          1.083840675 seconds time elapsed
>
> This patch fixes the issues by checking if the counter is supported,
> before reading and logging the counter value.
>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
> ---
>   tools/perf/builtin-stat.c |    5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index e598e4e..d28949d 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -510,6 +510,9 @@ static int read_counter(struct perf_evsel *counter)
>   	int ncpus = perf_evsel__nr_cpus(counter);
>   	int cpu, thread;
>
> +	if (!counter->supported)
> +		return -ENOENT;
> +
>   	if (counter->system_wide)
>   		nthreads = 1;
>
> @@ -1285,7 +1288,7 @@ static void print_counter_aggr(struct perf_evsel *counter, char *prefix)
>   	if (prefix)
>   		fprintf(output, "%s", prefix);
>
> -	if (scaled == -1) {
> +	if (scaled == -1 || !counter->supported) {
>   		fprintf(output, "%*s%s",
>   			csv_output ? 0 : 18,
>   			counter->supported ? CNTR_NOT_COUNTED : CNTR_NOT_SUPPORTED,
>

Just hit this as well.

Acked-and-Tested-by: David Ahern <dsahern@gmail.com>


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

* Re: [PATCHv2] perf/stat: Report unsupported events properly
  2015-02-13 19:39 ` David Ahern
@ 2015-02-13 20:50   ` Arnaldo Carvalho de Melo
  2015-02-17 10:13     ` Suzuki K. Poulose
  2015-02-27 19:40     ` David Ahern
  0 siblings, 2 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-02-13 20:50 UTC (permalink / raw)
  To: David Ahern; +Cc: Suzuki K. Poulose, linux-kernel, Jiri Olsa

Em Fri, Feb 13, 2015 at 12:39:24PM -0700, David Ahern escreveu:
> 
> 
> On 02/13/2015 11:40 AM, Suzuki K. Poulose wrote:
> >From: "Suzuki K. Poulose" <suzuki.poulose@arm.com>
> >
> >Commit 1971f59 (perf stat: Use read_counter in read_counter_aggr )
> >broke the perf stat output for unsupported counters.
> >
> >  $ perf stat -v -a -C 0 -e CCI_400/config=24/ sleep 1
> >  Warning:
> >  CCI_400/config=24/ event is not supported by the kernel.
> >
> >   Performance counter stats for 'system wide':
> >
> >                   0      CCI_400/config=24/
> >
> >         1.080265400 seconds time elapsed
> >
> >Where it used to be :
> >
> >$ perf stat -v -a -C 0 -e CCI_400/config=24/ sleep 1
> >  Warning:
> >  CCI_400/config=24/ event is not supported by the kernel.
> >
> >   Performance counter stats for 'system wide':
> >
> >     <not supported>      CCI_400/config=24/
> >
> >         1.083840675 seconds time elapsed
> >
> >This patch fixes the issues by checking if the counter is supported,
> >before reading and logging the counter value.
> >
> >Cc: Jiri Olsa <jolsa@kernel.org>
> >Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> >Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
> >---
> >  tools/perf/builtin-stat.c |    5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> >diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> >index e598e4e..d28949d 100644
> >--- a/tools/perf/builtin-stat.c
> >+++ b/tools/perf/builtin-stat.c
> >@@ -510,6 +510,9 @@ static int read_counter(struct perf_evsel *counter)
> >  	int ncpus = perf_evsel__nr_cpus(counter);
> >  	int cpu, thread;
> >
> >+	if (!counter->supported)
> >+		return -ENOENT;
> >+
> >  	if (counter->system_wide)
> >  		nthreads = 1;
> >
> >@@ -1285,7 +1288,7 @@ static void print_counter_aggr(struct perf_evsel *counter, char *prefix)
> >  	if (prefix)
> >  		fprintf(output, "%s", prefix);
> >
> >-	if (scaled == -1) {
> >+	if (scaled == -1 || !counter->supported) {
> >  		fprintf(output, "%*s%s",
> >  			csv_output ? 0 : 18,
> >  			counter->supported ? CNTR_NOT_COUNTED : CNTR_NOT_SUPPORTED,
> >
> 
> Just hit this as well.
> 
> Acked-and-Tested-by: David Ahern <dsahern@gmail.com>

Gack, 10ms after I sent my pre-California pull req :-\

Will go in the next one :-)

- Arnaldo

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

* Re: [PATCHv2] perf/stat: Report unsupported events properly
  2015-02-13 20:50   ` Arnaldo Carvalho de Melo
@ 2015-02-17 10:13     ` Suzuki K. Poulose
  2015-02-27 19:40     ` David Ahern
  1 sibling, 0 replies; 6+ messages in thread
From: Suzuki K. Poulose @ 2015-02-17 10:13 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, David Ahern; +Cc: linux-kernel, Jiri Olsa

On 13/02/15 20:50, Arnaldo Carvalho de Melo wrote:
> Em Fri, Feb 13, 2015 at 12:39:24PM -0700, David Ahern escreveu:
>>
>>
>> On 02/13/2015 11:40 AM, Suzuki K. Poulose wrote:
>>> From: "Suzuki K. Poulose" <suzuki.poulose@arm.com>
>>>
>>> Commit 1971f59 (perf stat: Use read_counter in read_counter_aggr )
>>> broke the perf stat output for unsupported counters.
>>>
>>>   $ perf stat -v -a -C 0 -e CCI_400/config=24/ sleep 1
>>>   Warning:
>>>   CCI_400/config=24/ event is not supported by the kernel.
>>>
>>>    Performance counter stats for 'system wide':
>>>
>>>                    0      CCI_400/config=24/
>>>
>>>          1.080265400 seconds time elapsed
>>>
>>> Where it used to be :
>>>
>>> $ perf stat -v -a -C 0 -e CCI_400/config=24/ sleep 1
>>>   Warning:
>>>   CCI_400/config=24/ event is not supported by the kernel.
>>>
>>>    Performance counter stats for 'system wide':
>>>
>>>      <not supported>      CCI_400/config=24/
>>>
>>>          1.083840675 seconds time elapsed
>>>
>>> This patch fixes the issues by checking if the counter is supported,
>>> before reading and logging the counter value.
>>>
>>> Cc: Jiri Olsa <jolsa@kernel.org>
>>> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
>>> Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
>>> ---
>>>   tools/perf/builtin-stat.c |    5 ++++-
>>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
>>> index e598e4e..d28949d 100644
>>> --- a/tools/perf/builtin-stat.c
>>> +++ b/tools/perf/builtin-stat.c
>>> @@ -510,6 +510,9 @@ static int read_counter(struct perf_evsel *counter)
>>>   	int ncpus = perf_evsel__nr_cpus(counter);
>>>   	int cpu, thread;
>>>
>>> +	if (!counter->supported)
>>> +		return -ENOENT;
>>> +
>>>   	if (counter->system_wide)
>>>   		nthreads = 1;
>>>
>>> @@ -1285,7 +1288,7 @@ static void print_counter_aggr(struct perf_evsel *counter, char *prefix)
>>>   	if (prefix)
>>>   		fprintf(output, "%s", prefix);
>>>
>>> -	if (scaled == -1) {
>>> +	if (scaled == -1 || !counter->supported) {
>>>   		fprintf(output, "%*s%s",
>>>   			csv_output ? 0 : 18,
>>>   			counter->supported ? CNTR_NOT_COUNTED : CNTR_NOT_SUPPORTED,
>>>
>>
>> Just hit this as well.
>>
>> Acked-and-Tested-by: David Ahern <dsahern@gmail.com>
>
> Gack, 10ms after I sent my pre-California pull req :-\
>
> Will go in the next one :-)
I think this may need to goto 3.19 stable series as well. Missed that. 
Do you want me to send it there ?

Cheers
Suzuki



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

* Re: [PATCHv2] perf/stat: Report unsupported events properly
  2015-02-13 20:50   ` Arnaldo Carvalho de Melo
  2015-02-17 10:13     ` Suzuki K. Poulose
@ 2015-02-27 19:40     ` David Ahern
  1 sibling, 0 replies; 6+ messages in thread
From: David Ahern @ 2015-02-27 19:40 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Suzuki K. Poulose, linux-kernel, Jiri Olsa

On 2/13/15 1:50 PM, Arnaldo Carvalho de Melo wrote:
>
> Gack, 10ms after I sent my pre-California pull req :-\
>
> Will go in the next one :-)
>

still not in your queues.


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

* [tip:perf/core] perf stat: Report unsupported events properly
  2015-02-13 18:40 [PATCHv2] perf/stat: Report unsupported events properly Suzuki K. Poulose
  2015-02-13 19:39 ` David Ahern
@ 2015-03-03  6:22 ` tip-bot for Suzuki K. Poulose
  1 sibling, 0 replies; 6+ messages in thread
From: tip-bot for Suzuki K. Poulose @ 2015-03-03  6:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, tglx, suzuki.poulose, jolsa, dsahern, acme, linux-kernel, mingo

Commit-ID:  3b4331d9a4f2d99603c38bfcac79943b7c6c5439
Gitweb:     http://git.kernel.org/tip/3b4331d9a4f2d99603c38bfcac79943b7c6c5439
Author:     Suzuki K. Poulose <suzuki.poulose@arm.com>
AuthorDate: Fri, 13 Feb 2015 18:40:58 +0000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 2 Mar 2015 11:51:17 -0300

perf stat: Report unsupported events properly

Commit 1971f59 (perf stat: Use read_counter in read_counter_aggr )
broke the perf stat output for unsupported counters.

 $ perf stat -v -a -C 0 -e CCI_400/config=24/ sleep 1
 Warning:
 CCI_400/config=24/ event is not supported by the kernel.

  Performance counter stats for 'system wide':

                  0      CCI_400/config=24/

        1.080265400 seconds time elapsed

Where it used to be :

$ perf stat -v -a -C 0 -e CCI_400/config=24/ sleep 1
 Warning:
 CCI_400/config=24/ event is not supported by the kernel.

  Performance counter stats for 'system wide':

    <not supported>      CCI_400/config=24/

        1.083840675 seconds time elapsed

This patch fixes the issues by checking if the counter is supported,
before reading and logging the counter value.

Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
Acked-by: David Ahern <dsahern@gmail.com>
Tested-by: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/1423852858-8455-1-git-send-email-suzuki.poulose@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-stat.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index e598e4e..d28949d 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -510,6 +510,9 @@ static int read_counter(struct perf_evsel *counter)
 	int ncpus = perf_evsel__nr_cpus(counter);
 	int cpu, thread;
 
+	if (!counter->supported)
+		return -ENOENT;
+
 	if (counter->system_wide)
 		nthreads = 1;
 
@@ -1285,7 +1288,7 @@ static void print_counter_aggr(struct perf_evsel *counter, char *prefix)
 	if (prefix)
 		fprintf(output, "%s", prefix);
 
-	if (scaled == -1) {
+	if (scaled == -1 || !counter->supported) {
 		fprintf(output, "%*s%s",
 			csv_output ? 0 : 18,
 			counter->supported ? CNTR_NOT_COUNTED : CNTR_NOT_SUPPORTED,

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

end of thread, other threads:[~2015-03-03  6:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-13 18:40 [PATCHv2] perf/stat: Report unsupported events properly Suzuki K. Poulose
2015-02-13 19:39 ` David Ahern
2015-02-13 20:50   ` Arnaldo Carvalho de Melo
2015-02-17 10:13     ` Suzuki K. Poulose
2015-02-27 19:40     ` David Ahern
2015-03-03  6:22 ` [tip:perf/core] perf stat: " tip-bot for Suzuki K. Poulose

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