Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1400522 > unrolled thread

[PATCH 1/3] perf diff: Fix indentation of stalled backend cycle

Started byNamhyung Kim <namhyung@kernel.org>
First post2016-05-13 08:10 +0200
Last post2016-05-20 08:50 +0200
Articles 8 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/3] perf diff: Fix indentation of stalled backend cycle Namhyung Kim <namhyung@kernel.org> - 2016-05-13 08:10 +0200
    [PATCH 3/3] perf stat: Use cpu-clock event for cpu targets Namhyung Kim <namhyung@kernel.org> - 2016-05-13 08:10 +0200
      [tip:perf/urgent] perf stat: Use cpu-clock event for cpu targets tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-05-20 08:50 +0200
    Re: [PATCH 1/3] perf diff: Fix indentation of stalled backend cycle Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-13 13:50 +0200
      Re: [PATCH 1/3] perf diff: Fix indentation of stalled backend cycle Namhyung Kim <namhyung@kernel.org> - 2016-05-13 15:50 +0200
        Re: [PATCH 1/3] perf diff: Fix indentation of stalled backend cycle Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-13 20:00 +0200
    Re: [PATCH 1/3] perf diff: Fix indentation of stalled backend cycle Andi Kleen <andi@firstfloor.org> - 2016-05-13 16:10 +0200
    [tip:perf/urgent] perf stat: Fix indentation of stalled backend  cycle tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-05-20 08:50 +0200

#1400522 — [PATCH 1/3] perf diff: Fix indentation of stalled backend cycle

FromNamhyung Kim <namhyung@kernel.org>
Date2016-05-13 08:10 +0200
Subject[PATCH 1/3] perf diff: Fix indentation of stalled backend cycle
Message-ID<ryesp-5QZ-3@gated-at.bofh.it>
The commit 140aeadc1fb5 ("perf stat: Abstract stat metrics printing")
changed way to print shadow metrics, but it missed to update the width
of stalled backend cycles event to 7.2% like others.  This resulted in
misaligned output like below:

 Performance counter stats for 'pwd':

          0.638313      task-clock (msec)         #    0.567 CPUs utilized
                 0      context-switches          #    0.000 K/sec
                 0      cpu-migrations            #    0.000 K/sec
                54      page-faults               #    0.085 M/sec
           885,600      cycles                    #    1.387 GHz
           558,438      stalled-cycles-frontend   #   63.06% frontend cycles idle
           431,355      stalled-cycles-backend    #  48.71% backend cycles idle
           674,956      instructions              #    0.76  insn per cycle
                                                  #    0.83  stalled cycles per insn
           130,380      branches                  #  204.257 M/sec
     <not counted>      branch-misses

       0.001125426 seconds time elapsed

Cc: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/stat-shadow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
index fdb71961143e..61200fcac5ef 100644
--- a/tools/perf/util/stat-shadow.c
+++ b/tools/perf/util/stat-shadow.c
@@ -188,7 +188,7 @@ static void print_stalled_cycles_backend(int cpu,
 
 	color = get_ratio_color(GRC_STALLED_CYCLES_BE, ratio);
 
-	out->print_metric(out->ctx, color, "%6.2f%%", "backend cycles idle", ratio);
+	out->print_metric(out->ctx, color, "%7.2f%%", "backend cycles idle", ratio);
 }
 
 static void print_branch_misses(int cpu,
-- 
2.8.2

[toc] | [next] | [standalone]


#1400524 — [PATCH 3/3] perf stat: Use cpu-clock event for cpu targets

FromNamhyung Kim <namhyung@kernel.org>
Date2016-05-13 08:10 +0200
Subject[PATCH 3/3] perf stat: Use cpu-clock event for cpu targets
Message-ID<ryesq-5QZ-15@gated-at.bofh.it>
In reply to#1400522
Currently perf stat always counts task-clock event by default.  But it's
somewhat confusing for system-wide targets (especially with 'sleep N' as
the 'sleep' task just sleeps and doesn't use cputime).  Changing to
cpu-clock event instead for that case makes more sense IMHO.

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

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 5645a8361de6..d602e9e93dc1 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1904,6 +1904,9 @@ static int add_default_attributes(void)
 	}
 
 	if (!evsel_list->nr_entries) {
+		if (target__has_cpu(&target))
+			default_attrs0[0].config = PERF_COUNT_SW_CPU_CLOCK;
+
 		if (perf_evlist__add_default_attrs(evsel_list, default_attrs0) < 0)
 			return -1;
 		if (pmu_have_event("cpu", "stalled-cycles-frontend")) {
-- 
2.8.2

[toc] | [prev] | [next] | [standalone]


#1404164 — [tip:perf/urgent] perf stat: Use cpu-clock event for cpu targets

Fromtip-bot for Namhyung Kim <tipbot@zytor.com>
Date2016-05-20 08:50 +0200
Subject[tip:perf/urgent] perf stat: Use cpu-clock event for cpu targets
Message-ID<rAMpY-25Y-27@gated-at.bofh.it>
In reply to#1400524
Commit-ID:  a1f3d56761df31f0ffeb215b974e26d5613e92a4
Gitweb:     http://git.kernel.org/tip/a1f3d56761df31f0ffeb215b974e26d5613e92a4
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Fri, 13 May 2016 15:01:03 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 16 May 2016 23:11:47 -0300

perf stat: Use cpu-clock event for cpu targets

Currently 'perf stat' always counts task-clock event by default.  But
it's somewhat confusing for system-wide targets (especially with 'sleep
N' as the 'sleep' task just sleeps and doesn't use cputime).  Changing
to cpu-clock event instead for that case makes more sense IMHO.

Before:
  # perf stat -a sleep 0.1

   Performance counter stats for 'system wide':

        403.038603      task-clock (msec)     #    4.001 CPUs utilized
               150      context-switches      #    0.372 K/sec
                 7      cpu-migrations        #    0.017 K/sec
                71      page-faults           #    0.176 K/sec
        23,705,169      cycles                #    0.059 GHz
        15,888,166      instructions          #    0.67  insn per cycle
         3,326,078      branches              #    8.253 M/sec
            87,643      branch-misses         #    2.64% of all branches

       0.100737009 seconds time elapsed

  #

After:

  # perf stat -a sleep 0.1

   Performance counter stats for 'system wide':

        404.271182      cpu-clock (msec)      #    4.000 CPUs utilized
               143      context-switches      #    0.354 K/sec
                13      cpu-migrations        #    0.032 K/sec
                73      page-faults           #    0.181 K/sec
        22,119,220      cycles                #    0.055 GHz
        13,622,065      instructions          #    0.62  insn per cycle
         2,918,769      branches              #    7.220 M/sec
            85,033      branch-misses         #    2.91% of all branches

       0.101073089 seconds time elapsed

  #

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1463119263-5569-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-stat.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 16a923c..efdd232 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1905,6 +1905,9 @@ static int add_default_attributes(void)
 	}
 
 	if (!evsel_list->nr_entries) {
+		if (target__has_cpu(&target))
+			default_attrs0[0].config = PERF_COUNT_SW_CPU_CLOCK;
+
 		if (perf_evlist__add_default_attrs(evsel_list, default_attrs0) < 0)
 			return -1;
 		if (pmu_have_event("cpu", "stalled-cycles-frontend")) {

[toc] | [prev] | [next] | [standalone]


#1400722

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2016-05-13 13:50 +0200
Message-ID<ryjLs-2sD-11@gated-at.bofh.it>
In reply to#1400522
Em Fri, May 13, 2016 at 03:01:01PM +0900, Namhyung Kim escreveu:
> The commit 140aeadc1fb5 ("perf stat: Abstract stat metrics printing")
> changed way to print shadow metrics, but it missed to update the width
> of stalled backend cycles event to 7.2% like others.  This resulted in
> misaligned output like below:

Thanks for pointing out the cset that introduced the problem, helps in
reviewing! Next time please consider adding it right before your
Signed-off-by line as:

Fixes: 140aeadc1fb5 ("perf stat: Abstract stat metrics printing")

Thanks!

- Arnaldo
 
>  Performance counter stats for 'pwd':
> 
>           0.638313      task-clock (msec)         #    0.567 CPUs utilized
>                  0      context-switches          #    0.000 K/sec
>                  0      cpu-migrations            #    0.000 K/sec
>                 54      page-faults               #    0.085 M/sec
>            885,600      cycles                    #    1.387 GHz
>            558,438      stalled-cycles-frontend   #   63.06% frontend cycles idle
>            431,355      stalled-cycles-backend    #  48.71% backend cycles idle
>            674,956      instructions              #    0.76  insn per cycle
>                                                   #    0.83  stalled cycles per insn
>            130,380      branches                  #  204.257 M/sec
>      <not counted>      branch-misses
> 
>        0.001125426 seconds time elapsed
> 
> Cc: Andi Kleen <andi@firstfloor.org>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/util/stat-shadow.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
> index fdb71961143e..61200fcac5ef 100644
> --- a/tools/perf/util/stat-shadow.c
> +++ b/tools/perf/util/stat-shadow.c
> @@ -188,7 +188,7 @@ static void print_stalled_cycles_backend(int cpu,
>  
>  	color = get_ratio_color(GRC_STALLED_CYCLES_BE, ratio);
>  
> -	out->print_metric(out->ctx, color, "%6.2f%%", "backend cycles idle", ratio);
> +	out->print_metric(out->ctx, color, "%7.2f%%", "backend cycles idle", ratio);
>  }
>  
>  static void print_branch_misses(int cpu,
> -- 
> 2.8.2

[toc] | [prev] | [next] | [standalone]


#1400801

FromNamhyung Kim <namhyung@kernel.org>
Date2016-05-13 15:50 +0200
Message-ID<rylDz-4eO-3@gated-at.bofh.it>
In reply to#1400722
Hi Arnaldo,

On Fri, May 13, 2016 at 08:48:48AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, May 13, 2016 at 03:01:01PM +0900, Namhyung Kim escreveu:
> > The commit 140aeadc1fb5 ("perf stat: Abstract stat metrics printing")
> > changed way to print shadow metrics, but it missed to update the width
> > of stalled backend cycles event to 7.2% like others.  This resulted in
> > misaligned output like below:
> 
> Thanks for pointing out the cset that introduced the problem, helps in
> reviewing! Next time please consider adding it right before your
> Signed-off-by line as:
> 
> Fixes: 140aeadc1fb5 ("perf stat: Abstract stat metrics printing")
> 
> Thanks!

Ok, will do it later.  Btw I found the subject line should start with
'perf stat' instead of 'perf diff'..

Thanks,
Namhyung


>  
> >  Performance counter stats for 'pwd':
> > 
> >           0.638313      task-clock (msec)         #    0.567 CPUs utilized
> >                  0      context-switches          #    0.000 K/sec
> >                  0      cpu-migrations            #    0.000 K/sec
> >                 54      page-faults               #    0.085 M/sec
> >            885,600      cycles                    #    1.387 GHz
> >            558,438      stalled-cycles-frontend   #   63.06% frontend cycles idle
> >            431,355      stalled-cycles-backend    #  48.71% backend cycles idle
> >            674,956      instructions              #    0.76  insn per cycle
> >                                                   #    0.83  stalled cycles per insn
> >            130,380      branches                  #  204.257 M/sec
> >      <not counted>      branch-misses
> > 
> >        0.001125426 seconds time elapsed
> > 
> > Cc: Andi Kleen <andi@firstfloor.org>
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> > ---
> >  tools/perf/util/stat-shadow.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
> > index fdb71961143e..61200fcac5ef 100644
> > --- a/tools/perf/util/stat-shadow.c
> > +++ b/tools/perf/util/stat-shadow.c
> > @@ -188,7 +188,7 @@ static void print_stalled_cycles_backend(int cpu,
> >  
> >  	color = get_ratio_color(GRC_STALLED_CYCLES_BE, ratio);
> >  
> > -	out->print_metric(out->ctx, color, "%6.2f%%", "backend cycles idle", ratio);
> > +	out->print_metric(out->ctx, color, "%7.2f%%", "backend cycles idle", ratio);
> >  }
> >  
> >  static void print_branch_misses(int cpu,
> > -- 
> > 2.8.2

[toc] | [prev] | [next] | [standalone]


#1400925

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2016-05-13 20:00 +0200
Message-ID<rypxx-8kL-9@gated-at.bofh.it>
In reply to#1400801
Em Fri, May 13, 2016 at 10:42:24PM +0900, Namhyung Kim escreveu:
> Hi Arnaldo,
> 
> On Fri, May 13, 2016 at 08:48:48AM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Fri, May 13, 2016 at 03:01:01PM +0900, Namhyung Kim escreveu:
> > > The commit 140aeadc1fb5 ("perf stat: Abstract stat metrics printing")
> > > changed way to print shadow metrics, but it missed to update the width
> > > of stalled backend cycles event to 7.2% like others.  This resulted in
> > > misaligned output like below:
> > 
> > Thanks for pointing out the cset that introduced the problem, helps in
> > reviewing! Next time please consider adding it right before your
> > Signed-off-by line as:
> > 
> > Fixes: 140aeadc1fb5 ("perf stat: Abstract stat metrics printing")
> > 
> > Thanks!
> 
> Ok, will do it later.  Btw I found the subject line should start with

No need, I did it already, and also renamed the subject to "perf stat:
..."

> 'perf stat' instead of 'perf diff'..

Fixed,

thanks,

- Arnaldo
 
> Thanks,
> Namhyung
> 
> 
> >  
> > >  Performance counter stats for 'pwd':
> > > 
> > >           0.638313      task-clock (msec)         #    0.567 CPUs utilized
> > >                  0      context-switches          #    0.000 K/sec
> > >                  0      cpu-migrations            #    0.000 K/sec
> > >                 54      page-faults               #    0.085 M/sec
> > >            885,600      cycles                    #    1.387 GHz
> > >            558,438      stalled-cycles-frontend   #   63.06% frontend cycles idle
> > >            431,355      stalled-cycles-backend    #  48.71% backend cycles idle
> > >            674,956      instructions              #    0.76  insn per cycle
> > >                                                   #    0.83  stalled cycles per insn
> > >            130,380      branches                  #  204.257 M/sec
> > >      <not counted>      branch-misses
> > > 
> > >        0.001125426 seconds time elapsed
> > > 
> > > Cc: Andi Kleen <andi@firstfloor.org>
> > > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> > > ---
> > >  tools/perf/util/stat-shadow.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
> > > index fdb71961143e..61200fcac5ef 100644
> > > --- a/tools/perf/util/stat-shadow.c
> > > +++ b/tools/perf/util/stat-shadow.c
> > > @@ -188,7 +188,7 @@ static void print_stalled_cycles_backend(int cpu,
> > >  
> > >  	color = get_ratio_color(GRC_STALLED_CYCLES_BE, ratio);
> > >  
> > > -	out->print_metric(out->ctx, color, "%6.2f%%", "backend cycles idle", ratio);
> > > +	out->print_metric(out->ctx, color, "%7.2f%%", "backend cycles idle", ratio);
> > >  }
> > >  
> > >  static void print_branch_misses(int cpu,
> > > -- 
> > > 2.8.2

[toc] | [prev] | [next] | [standalone]


#1400819

FromAndi Kleen <andi@firstfloor.org>
Date2016-05-13 16:10 +0200
Message-ID<rylWX-4R7-29@gated-at.bofh.it>
In reply to#1400522
On Fri, May 13, 2016 at 03:01:01PM +0900, Namhyung Kim wrote:
> The commit 140aeadc1fb5 ("perf stat: Abstract stat metrics printing")
> changed way to print shadow metrics, but it missed to update the width
> of stalled backend cycles event to 7.2% like others.  This resulted in
> misaligned output like below:

Thanks.

My preferred action would be actually kill
stalled-cycles-frontend/backend.
I don't know any CPU where it is accurate.

TopDown is much better.

But as long as it is kept it is better to align it right.


-Andi

[toc] | [prev] | [next] | [standalone]


#1404156 — [tip:perf/urgent] perf stat: Fix indentation of stalled backend cycle

Fromtip-bot for Namhyung Kim <tipbot@zytor.com>
Date2016-05-20 08:50 +0200
Subject[tip:perf/urgent] perf stat: Fix indentation of stalled backend cycle
Message-ID<rAMpX-25Y-1@gated-at.bofh.it>
In reply to#1400522
Commit-ID:  b0404be8d6186f9f3c23e2b5ff247e667be90652
Gitweb:     http://git.kernel.org/tip/b0404be8d6186f9f3c23e2b5ff247e667be90652
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Fri, 13 May 2016 15:01:01 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 16 May 2016 23:11:45 -0300

perf stat: Fix indentation of stalled backend cycle

The commit 140aeadc1fb5 ("perf stat: Abstract stat metrics printing")
changed how shadow metrics are printed, but it missed to update the
width of the stalled backend cycles event to 7.2% like others.  This
resulted in misaligned output like below:

  Performance counter stats for 'pwd':

          0.638313      task-clock (msec)         #    0.567 CPUs utilized
                 0      context-switches          #    0.000 K/sec
                 0      cpu-migrations            #    0.000 K/sec
                54      page-faults               #    0.085 M/sec
           885,600      cycles                    #    1.387 GHz
           558,438      stalled-cycles-frontend   #   63.06% frontend cycles idle
           431,355      stalled-cycles-backend    #  48.71% backend cycles idle
           674,956      instructions              #    0.76  insn per cycle
                                                  #    0.83  stalled cycles per insn
           130,380      branches                  #  204.257 M/sec
     <not counted>      branch-misses

       0.001125426 seconds time elapsed

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Fixes: 140aeadc1fb5 ("perf stat: Abstract stat metrics printing")
Link: http://lkml.kernel.org/r/1463119263-5569-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/stat-shadow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
index fdb7196..61200fc 100644
--- a/tools/perf/util/stat-shadow.c
+++ b/tools/perf/util/stat-shadow.c
@@ -188,7 +188,7 @@ static void print_stalled_cycles_backend(int cpu,
 
 	color = get_ratio_color(GRC_STALLED_CYCLES_BE, ratio);
 
-	out->print_metric(out->ctx, color, "%6.2f%%", "backend cycles idle", ratio);
+	out->print_metric(out->ctx, color, "%7.2f%%", "backend cycles idle", ratio);
 }
 
 static void print_branch_misses(int cpu,

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web