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


Groups > linux.kernel > #1346112 > unrolled thread

[PATCH 05/11] perf stat: Check existence of frontend/backed stalled cycles

Started byArnaldo Carvalho de Melo <acme@kernel.org>
First post2016-02-29 20:30 +0100
Last post2016-03-03 14:00 +0100
Articles 4 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 05/11] perf stat: Check existence of frontend/backed stalled cycles Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-29 20:30 +0100
    Re: [PATCH 05/11] perf stat: Check existence of frontend/backed  stalled cycles Ingo Molnar <mingo@kernel.org> - 2016-03-03 09:30 +0100
      Re: [PATCH 05/11] perf stat: Check existence of frontend/backed  stalled cycles Arnaldo Carvalho de Melo <acme@redhat.com> - 2016-03-03 13:50 +0100
        Re: [PATCH 05/11] perf stat: Check existence of frontend/backed  stalled cycles Arnaldo Carvalho de Melo <acme@redhat.com> - 2016-03-03 14:00 +0100

#1346112 — [PATCH 05/11] perf stat: Check existence of frontend/backed stalled cycles

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2016-02-29 20:30 +0100
Subject[PATCH 05/11] perf stat: Check existence of frontend/backed stalled cycles
Message-ID<r7BG2-7d5-17@gated-at.bofh.it>
From: Andi Kleen <ak@linux.intel.com>

Only put the frontend/backend stalled cycles into the default perf stat
events when the CPU actually supports them.

This avoids empty columns with --metric-only on newer Intel CPUs.

Committer note:

Before:

  $ perf stat ls
  a.patch

  Performance counter stats for 'ls':

         0.822067 task-clock (msec)   #   0.873 CPUs utilized   (82.26%)
                0 context-switches    #   0.000 K/sec           (82.26%)
                0 cpu-migrations      #   0.000 K/sec           (82.26%)
              125 page-faults         #   0.152 M/sec           (82.26%)
        2,516,127 cycles              #   3.061 GHz             (82.84%)
  <not supported> stalled-cycles-frontend
  <not supported> stalled-cycles-backend
        2,430,467 instructions        #   0.97  insn per cycle  (82.84%)
          486,235 branches            # 591.479 M/sec           (82.84%)
           18,389 branch-misses       #   3.78% of all branches (82.84%)

      0.000941536 seconds time elapsed
  $

After:

  $ perf stat ls
  a.patch

  Performance counter stats for 'ls':

         0.824919 task-clock (msec)   #   0.893 CPUs utilized   (85.47%)
                0 context-switches    #   0.000 K/sec           (85.47%)
                0 cpu-migrations      #   0.000 K/sec           (85.47%)
              124 page-faults         #   0.150 M/sec           (85.47%)
          2521790 cycles              #   3.057 GHz             (86.15%)
          2364913 instructions        #   0.94  insn per cycle  (86.15%)
           471970 branches            # 572.141 M/sec           (86.15%)
            16935 branch-misses       #   3.59% of all branches (86.15%)

      0.000923397 seconds time elapsed
  $

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1456532881-26621-2-git-send-email-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-stat.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 8c0bc0fe5179..24f222dd2a8a 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1441,7 +1441,7 @@ static int perf_stat_init_aggr_mode_file(struct perf_stat *st)
  */
 static int add_default_attributes(void)
 {
-	struct perf_event_attr default_attrs[] = {
+	struct perf_event_attr default_attrs0[] = {
 
   { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_TASK_CLOCK		},
   { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_CONTEXT_SWITCHES	},
@@ -1449,8 +1449,14 @@ static int add_default_attributes(void)
   { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_PAGE_FAULTS		},
 
   { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CPU_CYCLES		},
+};
+	struct perf_event_attr frontend_attrs[] = {
   { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_STALLED_CYCLES_FRONTEND	},
+};
+	struct perf_event_attr backend_attrs[] = {
   { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_STALLED_CYCLES_BACKEND	},
+};
+	struct perf_event_attr default_attrs1[] = {
   { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_INSTRUCTIONS		},
   { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_INSTRUCTIONS	},
   { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_MISSES		},
@@ -1567,7 +1573,19 @@ static int add_default_attributes(void)
 	}
 
 	if (!evsel_list->nr_entries) {
-		if (perf_evlist__add_default_attrs(evsel_list, default_attrs) < 0)
+		if (perf_evlist__add_default_attrs(evsel_list, default_attrs0) < 0)
+			return -1;
+		if (pmu_have_event("cpu", "stalled-cycles-frontend")) {
+			if (perf_evlist__add_default_attrs(evsel_list,
+						frontend_attrs) < 0)
+				return -1;
+		}
+		if (pmu_have_event("cpu", "stalled-cycles-backend")) {
+			if (perf_evlist__add_default_attrs(evsel_list,
+						backend_attrs) < 0)
+				return -1;
+		}
+		if (perf_evlist__add_default_attrs(evsel_list, default_attrs1) < 0)
 			return -1;
 	}
 
-- 
2.5.0

[toc] | [next] | [standalone]


#1348895 — Re: [PATCH 05/11] perf stat: Check existence of frontend/backed stalled cycles

FromIngo Molnar <mingo@kernel.org>
Date2016-03-03 09:30 +0100
SubjectRe: [PATCH 05/11] perf stat: Check existence of frontend/backed stalled cycles
Message-ID<r8wNY-4hQ-19@gated-at.bofh.it>
In reply to#1346112
* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Before:
> 
>   $ perf stat ls
>   a.patch
> 
>   Performance counter stats for 'ls':
> 
>          0.822067 task-clock (msec)   #   0.873 CPUs utilized   (82.26%)
>                 0 context-switches    #   0.000 K/sec           (82.26%)
>                 0 cpu-migrations      #   0.000 K/sec           (82.26%)
>               125 page-faults         #   0.152 M/sec           (82.26%)
>         2,516,127 cycles              #   3.061 GHz             (82.84%)
>   <not supported> stalled-cycles-frontend
>   <not supported> stalled-cycles-backend
>         2,430,467 instructions        #   0.97  insn per cycle  (82.84%)
>           486,235 branches            # 591.479 M/sec           (82.84%)
>            18,389 branch-misses       #   3.78% of all branches (82.84%)
> 
>       0.000941536 seconds time elapsed
>   $
> 
> After:
> 
>   $ perf stat ls
>   a.patch
> 
>   Performance counter stats for 'ls':
> 
>          0.824919 task-clock (msec)   #   0.893 CPUs utilized   (85.47%)
>                 0 context-switches    #   0.000 K/sec           (85.47%)
>                 0 cpu-migrations      #   0.000 K/sec           (85.47%)
>               124 page-faults         #   0.150 M/sec           (85.47%)
>           2521790 cycles              #   3.057 GHz             (86.15%)
>           2364913 instructions        #   0.94  insn per cycle  (86.15%)
>            471970 branches            # 572.141 M/sec           (86.15%)
>             16935 branch-misses       #   3.59% of all branches (86.15%)
> 
>       0.000923397 seconds time elapsed
>   $

Btw., the output format regression is visible in this changelog already...

Thanks,

	Ingo

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


#1349117 — Re: [PATCH 05/11] perf stat: Check existence of frontend/backed stalled cycles

FromArnaldo Carvalho de Melo <acme@redhat.com>
Date2016-03-03 13:50 +0100
SubjectRe: [PATCH 05/11] perf stat: Check existence of frontend/backed stalled cycles
Message-ID<r8ARA-7b8-31@gated-at.bofh.it>
In reply to#1348895
Em Thu, Mar 03, 2016 at 09:28:18AM +0100, Ingo Molnar escreveu:
> 
> * Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> 
> > Before:
> > 
> >   $ perf stat ls
> >   a.patch
> > 
> >   Performance counter stats for 'ls':
> > 
> >          0.822067 task-clock (msec)   #   0.873 CPUs utilized   (82.26%)
> >                 0 context-switches    #   0.000 K/sec           (82.26%)
> >                 0 cpu-migrations      #   0.000 K/sec           (82.26%)
> >               125 page-faults         #   0.152 M/sec           (82.26%)
> >         2,516,127 cycles              #   3.061 GHz             (82.84%)
> >   <not supported> stalled-cycles-frontend
> >   <not supported> stalled-cycles-backend
> >         2,430,467 instructions        #   0.97  insn per cycle  (82.84%)
> >           486,235 branches            # 591.479 M/sec           (82.84%)
> >            18,389 branch-misses       #   3.78% of all branches (82.84%)
> > 
> >       0.000941536 seconds time elapsed
> >   $
> > 
> > After:
> > 
> >   $ perf stat ls
> >   a.patch
> > 
> >   Performance counter stats for 'ls':
> > 
> >          0.824919 task-clock (msec)   #   0.893 CPUs utilized   (85.47%)
> >                 0 context-switches    #   0.000 K/sec           (85.47%)
> >                 0 cpu-migrations      #   0.000 K/sec           (85.47%)
> >               124 page-faults         #   0.150 M/sec           (85.47%)
> >           2521790 cycles              #   3.057 GHz             (86.15%)
> >           2364913 instructions        #   0.94  insn per cycle  (86.15%)
> >            471970 branches            # 572.141 M/sec           (86.15%)
> >             16935 branch-misses       #   3.59% of all branches (86.15%)
> > 
> >       0.000923397 seconds time elapsed
> >   $
> 
> Btw., the output format regression is visible in this changelog already...

Right, uf, should've pick this up at this point :-\

Will go back and fix it up, so that we don't introduce a regression.

- Arnaldo

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


#1349124 — Re: [PATCH 05/11] perf stat: Check existence of frontend/backed stalled cycles

FromArnaldo Carvalho de Melo <acme@redhat.com>
Date2016-03-03 14:00 +0100
SubjectRe: [PATCH 05/11] perf stat: Check existence of frontend/backed stalled cycles
Message-ID<r8B1g-7eH-9@gated-at.bofh.it>
In reply to#1349117
Em Thu, Mar 03, 2016 at 09:49:00AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Thu, Mar 03, 2016 at 09:28:18AM +0100, Ingo Molnar escreveu:
> > 
> > * Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> > 
> > > Before:
> > > 
> > >   $ perf stat ls
> > >   a.patch
> > > 
> > >   Performance counter stats for 'ls':
> > > 
> > >          0.822067 task-clock (msec)   #   0.873 CPUs utilized   (82.26%)
> > >                 0 context-switches    #   0.000 K/sec           (82.26%)
> > >                 0 cpu-migrations      #   0.000 K/sec           (82.26%)
> > >               125 page-faults         #   0.152 M/sec           (82.26%)
> > >         2,516,127 cycles              #   3.061 GHz             (82.84%)
> > >   <not supported> stalled-cycles-frontend
> > >   <not supported> stalled-cycles-backend
> > >         2,430,467 instructions        #   0.97  insn per cycle  (82.84%)
> > >           486,235 branches            # 591.479 M/sec           (82.84%)
> > >            18,389 branch-misses       #   3.78% of all branches (82.84%)
> > > 
> > >       0.000941536 seconds time elapsed
> > >   $
> > > 
> > > After:
> > > 
> > >   $ perf stat ls
> > >   a.patch
> > > 
> > >   Performance counter stats for 'ls':
> > > 
> > >          0.824919 task-clock (msec)   #   0.893 CPUs utilized   (85.47%)
> > >                 0 context-switches    #   0.000 K/sec           (85.47%)
> > >                 0 cpu-migrations      #   0.000 K/sec           (85.47%)
> > >               124 page-faults         #   0.150 M/sec           (85.47%)
> > >           2521790 cycles              #   3.057 GHz             (86.15%)
> > >           2364913 instructions        #   0.94  insn per cycle  (86.15%)
> > >            471970 branches            # 572.141 M/sec           (86.15%)
> > >             16935 branch-misses       #   3.59% of all branches (86.15%)
> > > 
> > >       0.000923397 seconds time elapsed
> > >   $
> > 
> > Btw., the output format regression is visible in this changelog already...
> 
> Right, uf, should've pick this up at this point :-\
> 
> Will go back and fix it up, so that we don't introduce a regression.

Well, in this case its not a matter of fixing the patch, but making sure
that Jiri's locale pmu parsing fix comes before this patch, so inserting
a patch, will do.

- Arnaldo

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web