[PATCH 3/6] perf, tools, stat: Support metrics in --per-core/socket mode

2016-02-26 Thread Andi Kleen
From: Andi Kleen Enable metrics printing in --per-core / --per-socket mode. We need to save the shadow metrics in a unique place. Always use the first CPU in the aggregation. Then use the same CPU to retrieve the shadow value later. Example output: % perf stat --per-core

[PATCH 3/6] perf, tools, stat: Support metrics in --per-core/socket mode

2016-02-26 Thread Andi Kleen
From: Andi Kleen Enable metrics printing in --per-core / --per-socket mode. We need to save the shadow metrics in a unique place. Always use the first CPU in the aggregation. Then use the same CPU to retrieve the shadow value later. Example output: % perf stat --per-core -a ./BC1s

Re: [PATCH 3/6] perf, tools, stat: Support metrics in --per-core/socket mode

2016-02-26 Thread Andi Kleen
> > + > > static void print_aggr(char *prefix) > > { > > FILE *output = stat_config.output; > > @@ -982,6 +1024,8 @@ static void print_aggr(char *prefix) > > if (!(aggr_map || aggr_get_id)) > > return; > > > > + aggr_update_shadow(); > > this should be called from

Re: [PATCH 3/6] perf, tools, stat: Support metrics in --per-core/socket mode

2016-02-26 Thread Andi Kleen
> > + > > static void print_aggr(char *prefix) > > { > > FILE *output = stat_config.output; > > @@ -982,6 +1024,8 @@ static void print_aggr(char *prefix) > > if (!(aggr_map || aggr_get_id)) > > return; > > > > + aggr_update_shadow(); > > this should be called from

Re: [PATCH 3/6] perf, tools, stat: Support metrics in --per-core/socket mode

2016-02-22 Thread Jiri Olsa
On Mon, Feb 22, 2016 at 05:52:02PM +0100, Andi Kleen wrote: > On Sun, Feb 21, 2016 at 06:15:35PM +0100, Jiri Olsa wrote: > > On Wed, Feb 17, 2016 at 02:44:02PM -0800, Andi Kleen wrote: > > > > SNIP > > > > > @@ -892,7 +908,10 @@ static void printout(int id, int nr, struct > > > perf_evsel

Re: [PATCH 3/6] perf, tools, stat: Support metrics in --per-core/socket mode

2016-02-22 Thread Jiri Olsa
On Mon, Feb 22, 2016 at 05:52:02PM +0100, Andi Kleen wrote: > On Sun, Feb 21, 2016 at 06:15:35PM +0100, Jiri Olsa wrote: > > On Wed, Feb 17, 2016 at 02:44:02PM -0800, Andi Kleen wrote: > > > > SNIP > > > > > @@ -892,7 +908,10 @@ static void printout(int id, int nr, struct > > > perf_evsel

Re: [PATCH 3/6] perf, tools, stat: Support metrics in --per-core/socket mode

2016-02-22 Thread Andi Kleen
On Sun, Feb 21, 2016 at 06:15:35PM +0100, Jiri Olsa wrote: > On Wed, Feb 17, 2016 at 02:44:02PM -0800, Andi Kleen wrote: > > SNIP > > > @@ -892,7 +908,10 @@ static void printout(int id, int nr, struct perf_evsel > > *counter, double uval, > > struct perf_stat_output_ctx out; > > struct

Re: [PATCH 3/6] perf, tools, stat: Support metrics in --per-core/socket mode

2016-02-22 Thread Andi Kleen
On Sun, Feb 21, 2016 at 06:15:35PM +0100, Jiri Olsa wrote: > On Wed, Feb 17, 2016 at 02:44:02PM -0800, Andi Kleen wrote: > > SNIP > > > @@ -892,7 +908,10 @@ static void printout(int id, int nr, struct perf_evsel > > *counter, double uval, > > struct perf_stat_output_ctx out; > > struct

Re: [PATCH 3/6] perf, tools, stat: Support metrics in --per-core/socket mode

2016-02-21 Thread Jiri Olsa
On Wed, Feb 17, 2016 at 02:44:02PM -0800, Andi Kleen wrote: SNIP > @@ -892,7 +908,10 @@ static void printout(int id, int nr, struct perf_evsel > *counter, double uval, > struct perf_stat_output_ctx out; > struct outstate os = { > .fh = stat_config.output, > -

Re: [PATCH 3/6] perf, tools, stat: Support metrics in --per-core/socket mode

2016-02-21 Thread Jiri Olsa
On Wed, Feb 17, 2016 at 02:44:02PM -0800, Andi Kleen wrote: SNIP > @@ -892,7 +908,10 @@ static void printout(int id, int nr, struct perf_evsel > *counter, double uval, > struct perf_stat_output_ctx out; > struct outstate os = { > .fh = stat_config.output, > -

Re: [PATCH 3/6] perf, tools, stat: Support metrics in --per-core/socket mode

2016-02-21 Thread Jiri Olsa
On Wed, Feb 17, 2016 at 02:44:02PM -0800, Andi Kleen wrote: SNIP > +static void aggr_update_shadow(void) > +{ > + int cpu, cpu2, s2, id, s; > + u64 val; > + struct perf_evsel *counter; > + > + for (s = 0; s < aggr_map->nr; s++) { > + id = aggr_map->map[s]; > +

Re: [PATCH 3/6] perf, tools, stat: Support metrics in --per-core/socket mode

2016-02-21 Thread Jiri Olsa
On Wed, Feb 17, 2016 at 02:44:02PM -0800, Andi Kleen wrote: SNIP > +static void aggr_update_shadow(void) > +{ > + int cpu, cpu2, s2, id, s; > + u64 val; > + struct perf_evsel *counter; > + > + for (s = 0; s < aggr_map->nr; s++) { > + id = aggr_map->map[s]; > +

Re: [PATCH 3/6] perf, tools, stat: Support metrics in --per-core/socket mode

2016-02-21 Thread Jiri Olsa
On Wed, Feb 17, 2016 at 02:44:02PM -0800, Andi Kleen wrote: SNIP > > perf_stat__print_shadow_stats(counter, uval, > stat_config.aggr_mode == AGGR_GLOBAL ? 0 : > - cpu_map__id_to_cpu(id), > +

Re: [PATCH 3/6] perf, tools, stat: Support metrics in --per-core/socket mode

2016-02-21 Thread Jiri Olsa
On Wed, Feb 17, 2016 at 02:44:02PM -0800, Andi Kleen wrote: SNIP > > perf_stat__print_shadow_stats(counter, uval, > stat_config.aggr_mode == AGGR_GLOBAL ? 0 : > - cpu_map__id_to_cpu(id), > +

[PATCH 3/6] perf, tools, stat: Support metrics in --per-core/socket mode

2016-02-17 Thread Andi Kleen
From: Andi Kleen Enable metrics printing in --per-core / --per-socket mode. We need to save the shadow metrics in a unique place. Always use the first CPU in the aggregation. Then use the same CPU to retrieve the shadow value later. Example output: % perf stat --per-core

[PATCH 3/6] perf, tools, stat: Support metrics in --per-core/socket mode

2016-02-17 Thread Andi Kleen
From: Andi Kleen Enable metrics printing in --per-core / --per-socket mode. We need to save the shadow metrics in a unique place. Always use the first CPU in the aggregation. Then use the same CPU to retrieve the shadow value later. Example output: % perf stat --per-core -a ./BC1s