Re: [PATCH] perf stat: Don't print bogus data when one event is requested

2014-04-09 Thread Jiri Olsa
On Thu, Mar 27, 2014 at 06:20:59PM -0400, Ramkumar Ramachandra wrote:
> When only the stalled-cycles-frontend event is requested:
> 
>   $ perf stat -e stalled-cycles-frontend -- git s
>   ## acme...ram/acme
> 
>Performance counter stats for 'git s':
> 
>  326,947,423  stalled-cycles-frontend   #0.00% frontend 
> cycles idle
> 
>  0.363599976 seconds time elapsed
> 
> The 0.00% frontend cycles idle comment in the output is totally bogus
> and misleading. Omit printing it here, as well as in the
> stalled-cycles-backend case.

hi,
I agree with the change, but the reason for 0% is not only that
'one' event was stated, but that 'cycles' event is missing in
measurement.

Please change your changelog accordingly, the change itself
looks ok.

thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] perf stat: Don't print bogus data when one event is requested

2014-04-09 Thread Jiri Olsa
On Thu, Mar 27, 2014 at 06:20:59PM -0400, Ramkumar Ramachandra wrote:
 When only the stalled-cycles-frontend event is requested:
 
   $ perf stat -e stalled-cycles-frontend -- git s
   ## acme...ram/acme
 
Performance counter stats for 'git s':
 
  326,947,423  stalled-cycles-frontend   #0.00% frontend 
 cycles idle
 
  0.363599976 seconds time elapsed
 
 The 0.00% frontend cycles idle comment in the output is totally bogus
 and misleading. Omit printing it here, as well as in the
 stalled-cycles-backend case.

hi,
I agree with the change, but the reason for 0% is not only that
'one' event was stated, but that 'cycles' event is missing in
measurement.

Please change your changelog accordingly, the change itself
looks ok.

thanks,
jirka
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] perf stat: Don't print bogus data when one event is requested

2014-03-27 Thread Ramkumar Ramachandra
When only the stalled-cycles-frontend event is requested:

  $ perf stat -e stalled-cycles-frontend -- git s
  ## acme...ram/acme

   Performance counter stats for 'git s':

 326,947,423  stalled-cycles-frontend   #0.00% frontend cycles 
idle

 0.363599976 seconds time elapsed

The 0.00% frontend cycles idle comment in the output is totally bogus
and misleading. Omit printing it here, as well as in the
stalled-cycles-backend case.

Cc: Jiri Olsa 
Cc: David Ahern 
Cc: Arnaldo Carvalho de Melo 
Signed-off-by: Ramkumar Ramachandra 
---
 tools/perf/builtin-stat.c | 26 --
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 8b0e1c9..0bd98fa 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -797,14 +797,13 @@ static void print_stalled_cycles_frontend(int cpu,
 
total = avg_stats(_cycles_stats[cpu]);
 
-   if (total)
+   if (total) {
ratio = avg / total * 100.0;
-
-   color = get_ratio_color(GRC_STALLED_CYCLES_FE, ratio);
-
-   fprintf(output, " #  ");
-   color_fprintf(output, color, "%6.2f%%", ratio);
-   fprintf(output, " frontend cycles idle   ");
+   color = get_ratio_color(GRC_STALLED_CYCLES_FE, ratio);
+   fprintf(output, " #  ");
+   color_fprintf(output, color, "%6.2f%%", ratio);
+   fprintf(output, " frontend cycles idle   ");
+   }
 }
 
 static void print_stalled_cycles_backend(int cpu,
@@ -816,14 +815,13 @@ static void print_stalled_cycles_backend(int cpu,
 
total = avg_stats(_cycles_stats[cpu]);
 
-   if (total)
+   if (total) {
ratio = avg / total * 100.0;
-
-   color = get_ratio_color(GRC_STALLED_CYCLES_BE, ratio);
-
-   fprintf(output, " #  ");
-   color_fprintf(output, color, "%6.2f%%", ratio);
-   fprintf(output, " backend  cycles idle   ");
+   color = get_ratio_color(GRC_STALLED_CYCLES_BE, ratio);
+   fprintf(output, " #  ");
+   color_fprintf(output, color, "%6.2f%%", ratio);
+   fprintf(output, " backend  cycles idle   ");
+   }
 }
 
 static void print_branch_misses(int cpu,
-- 
1.9.0.431.g014438b

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] perf stat: Don't print bogus data when one event is requested

2014-03-27 Thread Ramkumar Ramachandra
When only the stalled-cycles-frontend event is requested:

  $ perf stat -e stalled-cycles-frontend -- git s
  ## acme...ram/acme

   Performance counter stats for 'git s':

 326,947,423  stalled-cycles-frontend   #0.00% frontend cycles 
idle

 0.363599976 seconds time elapsed

The 0.00% frontend cycles idle comment in the output is totally bogus
and misleading. Omit printing it here, as well as in the
stalled-cycles-backend case.

Cc: Jiri Olsa jo...@redhat.com
Cc: David Ahern dsah...@gmail.com
Cc: Arnaldo Carvalho de Melo a...@redhat.com
Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 tools/perf/builtin-stat.c | 26 --
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 8b0e1c9..0bd98fa 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -797,14 +797,13 @@ static void print_stalled_cycles_frontend(int cpu,
 
total = avg_stats(runtime_cycles_stats[cpu]);
 
-   if (total)
+   if (total) {
ratio = avg / total * 100.0;
-
-   color = get_ratio_color(GRC_STALLED_CYCLES_FE, ratio);
-
-   fprintf(output,  #  );
-   color_fprintf(output, color, %6.2f%%, ratio);
-   fprintf(output,  frontend cycles idle   );
+   color = get_ratio_color(GRC_STALLED_CYCLES_FE, ratio);
+   fprintf(output,  #  );
+   color_fprintf(output, color, %6.2f%%, ratio);
+   fprintf(output,  frontend cycles idle   );
+   }
 }
 
 static void print_stalled_cycles_backend(int cpu,
@@ -816,14 +815,13 @@ static void print_stalled_cycles_backend(int cpu,
 
total = avg_stats(runtime_cycles_stats[cpu]);
 
-   if (total)
+   if (total) {
ratio = avg / total * 100.0;
-
-   color = get_ratio_color(GRC_STALLED_CYCLES_BE, ratio);
-
-   fprintf(output,  #  );
-   color_fprintf(output, color, %6.2f%%, ratio);
-   fprintf(output,  backend  cycles idle   );
+   color = get_ratio_color(GRC_STALLED_CYCLES_BE, ratio);
+   fprintf(output,  #  );
+   color_fprintf(output, color, %6.2f%%, ratio);
+   fprintf(output,  backend  cycles idle   );
+   }
 }
 
 static void print_branch_misses(int cpu,
-- 
1.9.0.431.g014438b

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/