Re: perf, tools: Refactor and support interval and CSV metrics

2016-03-10 Thread Jiri Olsa
On Mon, Mar 07, 2016 at 10:11:43PM +0100, Andi Kleen wrote:

SNIP

> > 
> > I did not see the change for print_no_aggr_metric function
> > in commit:
> >perf, tools, stat: Add --metric-only support for -A
> > 
> > which I saw in the email..
> > 
> > however now im confused, I did not noticed I had a wrong tree,
> > however git can't resolve the git tree you mentioned:
> 
> I pushed again. Can you try again? Probably I made some mistake with
> git.

I rebased your branch on top of current Arlnaldo's perf/core
and only 3 patches were missing.. I just ack-ed them

thanks,
jirka


Re: perf, tools: Refactor and support interval and CSV metrics

2016-03-10 Thread Jiri Olsa
On Mon, Mar 07, 2016 at 10:11:43PM +0100, Andi Kleen wrote:

SNIP

> > 
> > I did not see the change for print_no_aggr_metric function
> > in commit:
> >perf, tools, stat: Add --metric-only support for -A
> > 
> > which I saw in the email..
> > 
> > however now im confused, I did not noticed I had a wrong tree,
> > however git can't resolve the git tree you mentioned:
> 
> I pushed again. Can you try again? Probably I made some mistake with
> git.

I rebased your branch on top of current Arlnaldo's perf/core
and only 3 patches were missing.. I just ack-ed them

thanks,
jirka


Re: perf, tools: Refactor and support interval and CSV metrics

2016-03-07 Thread Andi Kleen
On Mon, Mar 07, 2016 at 07:48:39PM +0100, Jiri Olsa wrote:
> On Mon, Mar 07, 2016 at 07:22:27PM +0100, Andi Kleen wrote:
> > On Mon, Mar 07, 2016 at 11:08:42AM +0100, Jiri Olsa wrote:
> > > On Thu, Mar 03, 2016 at 03:57:31PM -0800, Andi Kleen wrote:
> > > 
> > > SNIP
> > > 
> > > > 
> > > > % perf stat -x, --metric-only  -a -I 1000
> > > >  1.001381652,frontend cycles idle,insn per cycle,stalled cycles per 
> > > > insn,branch-misses of all branches,
> > > >  1.001381652,173.32,0.83,2.09,1.73,
> > > >  2.002073343,199.47,1.07,1.60,2.14,
> > > >  3.002875524,109.52,0.22,7.83,1.63,
> > > >  4.003970059,132.10,0.17,10.85,1.51,
> > > >  5.004818754,181.60,0.22,8.87,2.22,
> > > > 
> > > > 
> > > > Available in
> > > > git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
> > > > perf/stat-metrics-21
> > > 
> > > this branch contains old version of:
> > >   perf, tools, stat: Add --metric-only support for -A
> > 
> > Old in what way? Looks correct to me.
> > 
> > 
> > commit e26ba80593023c24c8276ad9853acd7e56ca92ed
> > Author: Andi Kleen 
> > Date:   Sat Dec 19 11:22:55 2015 -0800
> > 
> > perf, tools, stat: Add --metric-only support for -A
> > 
> > Add metric only support for -A too. This requires a new print
> > function that prints the metrics in the right order.
> > 
> > v2: Fix manpage
> > v3: Simplify nrcpus computation
> > Signed-off-by: Andi Kleen 
> 
> I did not see the change for print_no_aggr_metric function
> in commit:
>perf, tools, stat: Add --metric-only support for -A
> 
> which I saw in the email..
> 
> however now im confused, I did not noticed I had a wrong tree,
> however git can't resolve the git tree you mentioned:

I pushed again. Can you try again? Probably I made some mistake with
git.

-Andi


Re: perf, tools: Refactor and support interval and CSV metrics

2016-03-07 Thread Andi Kleen
On Mon, Mar 07, 2016 at 07:48:39PM +0100, Jiri Olsa wrote:
> On Mon, Mar 07, 2016 at 07:22:27PM +0100, Andi Kleen wrote:
> > On Mon, Mar 07, 2016 at 11:08:42AM +0100, Jiri Olsa wrote:
> > > On Thu, Mar 03, 2016 at 03:57:31PM -0800, Andi Kleen wrote:
> > > 
> > > SNIP
> > > 
> > > > 
> > > > % perf stat -x, --metric-only  -a -I 1000
> > > >  1.001381652,frontend cycles idle,insn per cycle,stalled cycles per 
> > > > insn,branch-misses of all branches,
> > > >  1.001381652,173.32,0.83,2.09,1.73,
> > > >  2.002073343,199.47,1.07,1.60,2.14,
> > > >  3.002875524,109.52,0.22,7.83,1.63,
> > > >  4.003970059,132.10,0.17,10.85,1.51,
> > > >  5.004818754,181.60,0.22,8.87,2.22,
> > > > 
> > > > 
> > > > Available in
> > > > git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
> > > > perf/stat-metrics-21
> > > 
> > > this branch contains old version of:
> > >   perf, tools, stat: Add --metric-only support for -A
> > 
> > Old in what way? Looks correct to me.
> > 
> > 
> > commit e26ba80593023c24c8276ad9853acd7e56ca92ed
> > Author: Andi Kleen 
> > Date:   Sat Dec 19 11:22:55 2015 -0800
> > 
> > perf, tools, stat: Add --metric-only support for -A
> > 
> > Add metric only support for -A too. This requires a new print
> > function that prints the metrics in the right order.
> > 
> > v2: Fix manpage
> > v3: Simplify nrcpus computation
> > Signed-off-by: Andi Kleen 
> 
> I did not see the change for print_no_aggr_metric function
> in commit:
>perf, tools, stat: Add --metric-only support for -A
> 
> which I saw in the email..
> 
> however now im confused, I did not noticed I had a wrong tree,
> however git can't resolve the git tree you mentioned:

I pushed again. Can you try again? Probably I made some mistake with
git.

-Andi


Re: perf, tools: Refactor and support interval and CSV metrics

2016-03-07 Thread Jiri Olsa
On Mon, Mar 07, 2016 at 07:22:27PM +0100, Andi Kleen wrote:
> On Mon, Mar 07, 2016 at 11:08:42AM +0100, Jiri Olsa wrote:
> > On Thu, Mar 03, 2016 at 03:57:31PM -0800, Andi Kleen wrote:
> > 
> > SNIP
> > 
> > > 
> > > % perf stat -x, --metric-only  -a -I 1000
> > >  1.001381652,frontend cycles idle,insn per cycle,stalled cycles per 
> > > insn,branch-misses of all branches,
> > >  1.001381652,173.32,0.83,2.09,1.73,
> > >  2.002073343,199.47,1.07,1.60,2.14,
> > >  3.002875524,109.52,0.22,7.83,1.63,
> > >  4.003970059,132.10,0.17,10.85,1.51,
> > >  5.004818754,181.60,0.22,8.87,2.22,
> > > 
> > > 
> > > Available in
> > > git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
> > > perf/stat-metrics-21
> > 
> > this branch contains old version of:
> >   perf, tools, stat: Add --metric-only support for -A
> 
> Old in what way? Looks correct to me.
> 
> 
> commit e26ba80593023c24c8276ad9853acd7e56ca92ed
> Author: Andi Kleen 
> Date:   Sat Dec 19 11:22:55 2015 -0800
> 
> perf, tools, stat: Add --metric-only support for -A
> 
> Add metric only support for -A too. This requires a new print
> function that prints the metrics in the right order.
> 
> v2: Fix manpage
> v3: Simplify nrcpus computation
> Signed-off-by: Andi Kleen 

I did not see the change for print_no_aggr_metric function
in commit:
   perf, tools, stat: Add --metric-only support for -A

which I saw in the email..

however now im confused, I did not noticed I had a wrong tree,
however git can't resolve the git tree you mentioned:

> Available in
> git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
> perf/stat-metrics-21

[jolsa@krava perf]$ git remote add ak1 
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
[jolsa@krava perf]$ git remote update ak1
Fetching ak1
fatal: remote error: access denied or repository not exported: 
/pub/scm/linux/kernel/git/ak/linux-misc-2.6
error: Could not fetch ak1

so I guess the one I have is the correct one:
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc

however:
[jolsa@krava perf]$ git remote update ak
Fetching ak
[jolsa@krava perf]$ git branch -r | grep stat-metrics-21
[jolsa@krava perf]$

jirka


Re: perf, tools: Refactor and support interval and CSV metrics

2016-03-07 Thread Jiri Olsa
On Mon, Mar 07, 2016 at 07:22:27PM +0100, Andi Kleen wrote:
> On Mon, Mar 07, 2016 at 11:08:42AM +0100, Jiri Olsa wrote:
> > On Thu, Mar 03, 2016 at 03:57:31PM -0800, Andi Kleen wrote:
> > 
> > SNIP
> > 
> > > 
> > > % perf stat -x, --metric-only  -a -I 1000
> > >  1.001381652,frontend cycles idle,insn per cycle,stalled cycles per 
> > > insn,branch-misses of all branches,
> > >  1.001381652,173.32,0.83,2.09,1.73,
> > >  2.002073343,199.47,1.07,1.60,2.14,
> > >  3.002875524,109.52,0.22,7.83,1.63,
> > >  4.003970059,132.10,0.17,10.85,1.51,
> > >  5.004818754,181.60,0.22,8.87,2.22,
> > > 
> > > 
> > > Available in
> > > git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
> > > perf/stat-metrics-21
> > 
> > this branch contains old version of:
> >   perf, tools, stat: Add --metric-only support for -A
> 
> Old in what way? Looks correct to me.
> 
> 
> commit e26ba80593023c24c8276ad9853acd7e56ca92ed
> Author: Andi Kleen 
> Date:   Sat Dec 19 11:22:55 2015 -0800
> 
> perf, tools, stat: Add --metric-only support for -A
> 
> Add metric only support for -A too. This requires a new print
> function that prints the metrics in the right order.
> 
> v2: Fix manpage
> v3: Simplify nrcpus computation
> Signed-off-by: Andi Kleen 

I did not see the change for print_no_aggr_metric function
in commit:
   perf, tools, stat: Add --metric-only support for -A

which I saw in the email..

however now im confused, I did not noticed I had a wrong tree,
however git can't resolve the git tree you mentioned:

> Available in
> git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
> perf/stat-metrics-21

[jolsa@krava perf]$ git remote add ak1 
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
[jolsa@krava perf]$ git remote update ak1
Fetching ak1
fatal: remote error: access denied or repository not exported: 
/pub/scm/linux/kernel/git/ak/linux-misc-2.6
error: Could not fetch ak1

so I guess the one I have is the correct one:
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc

however:
[jolsa@krava perf]$ git remote update ak
Fetching ak
[jolsa@krava perf]$ git branch -r | grep stat-metrics-21
[jolsa@krava perf]$

jirka


Re: perf, tools: Refactor and support interval and CSV metrics

2016-03-07 Thread Andi Kleen
On Mon, Mar 07, 2016 at 11:08:42AM +0100, Jiri Olsa wrote:
> On Thu, Mar 03, 2016 at 03:57:31PM -0800, Andi Kleen wrote:
> 
> SNIP
> 
> > 
> > % perf stat -x, --metric-only  -a -I 1000
> >  1.001381652,frontend cycles idle,insn per cycle,stalled cycles per 
> > insn,branch-misses of all branches,
> >  1.001381652,173.32,0.83,2.09,1.73,
> >  2.002073343,199.47,1.07,1.60,2.14,
> >  3.002875524,109.52,0.22,7.83,1.63,
> >  4.003970059,132.10,0.17,10.85,1.51,
> >  5.004818754,181.60,0.22,8.87,2.22,
> > 
> > 
> > Available in
> > git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
> > perf/stat-metrics-21
> 
> this branch contains old version of:
>   perf, tools, stat: Add --metric-only support for -A

Old in what way? Looks correct to me.


commit e26ba80593023c24c8276ad9853acd7e56ca92ed
Author: Andi Kleen 
Date:   Sat Dec 19 11:22:55 2015 -0800

perf, tools, stat: Add --metric-only support for -A

Add metric only support for -A too. This requires a new print
function that prints the metrics in the right order.

v2: Fix manpage
v3: Simplify nrcpus computation
Signed-off-by: Andi Kleen 



Re: perf, tools: Refactor and support interval and CSV metrics

2016-03-07 Thread Andi Kleen
On Mon, Mar 07, 2016 at 11:08:42AM +0100, Jiri Olsa wrote:
> On Thu, Mar 03, 2016 at 03:57:31PM -0800, Andi Kleen wrote:
> 
> SNIP
> 
> > 
> > % perf stat -x, --metric-only  -a -I 1000
> >  1.001381652,frontend cycles idle,insn per cycle,stalled cycles per 
> > insn,branch-misses of all branches,
> >  1.001381652,173.32,0.83,2.09,1.73,
> >  2.002073343,199.47,1.07,1.60,2.14,
> >  3.002875524,109.52,0.22,7.83,1.63,
> >  4.003970059,132.10,0.17,10.85,1.51,
> >  5.004818754,181.60,0.22,8.87,2.22,
> > 
> > 
> > Available in
> > git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
> > perf/stat-metrics-21
> 
> this branch contains old version of:
>   perf, tools, stat: Add --metric-only support for -A

Old in what way? Looks correct to me.


commit e26ba80593023c24c8276ad9853acd7e56ca92ed
Author: Andi Kleen 
Date:   Sat Dec 19 11:22:55 2015 -0800

perf, tools, stat: Add --metric-only support for -A

Add metric only support for -A too. This requires a new print
function that prints the metrics in the right order.

v2: Fix manpage
v3: Simplify nrcpus computation
Signed-off-by: Andi Kleen 



Re: perf, tools: Refactor and support interval and CSV metrics

2016-03-07 Thread Jiri Olsa
On Thu, Mar 03, 2016 at 03:57:31PM -0800, Andi Kleen wrote:

SNIP

> 
> % perf stat -x, --metric-only  -a -I 1000
>  1.001381652,frontend cycles idle,insn per cycle,stalled cycles per 
> insn,branch-misses of all branches,
>  1.001381652,173.32,0.83,2.09,1.73,
>  2.002073343,199.47,1.07,1.60,2.14,
>  3.002875524,109.52,0.22,7.83,1.63,
>  4.003970059,132.10,0.17,10.85,1.51,
>  5.004818754,181.60,0.22,8.87,2.22,
> 
> 
> Available in
> git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
> perf/stat-metrics-21

this branch contains old version of:
  perf, tools, stat: Add --metric-only support for -A

thanks,
jirka


Re: perf, tools: Refactor and support interval and CSV metrics

2016-03-07 Thread Jiri Olsa
On Thu, Mar 03, 2016 at 03:57:31PM -0800, Andi Kleen wrote:

SNIP

> 
> % perf stat -x, --metric-only  -a -I 1000
>  1.001381652,frontend cycles idle,insn per cycle,stalled cycles per 
> insn,branch-misses of all branches,
>  1.001381652,173.32,0.83,2.09,1.73,
>  2.002073343,199.47,1.07,1.60,2.14,
>  3.002875524,109.52,0.22,7.83,1.63,
>  4.003970059,132.10,0.17,10.85,1.51,
>  5.004818754,181.60,0.22,8.87,2.22,
> 
> 
> Available in
> git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
> perf/stat-metrics-21

this branch contains old version of:
  perf, tools, stat: Add --metric-only support for -A

thanks,
jirka


perf, tools: Refactor and support interval and CSV metrics

2016-03-03 Thread Andi Kleen
Fixed even more last feedback.

[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]
[v6: Fix running/noise printing patch.]
[v7: Reorder and merge two patches to avoid a bisect hole where unsupported was
printed as 0]
[v8: Minor fixes for review feedback. See changelog in patches.]
[v9: Fix newline bug. Add support for -A for --metric-only]
[v10: Remove extra "noise" printing (Jiri)
  Fix fields in documentation (Jiri)]
[v11: Fix manpage again. Avoid extra metric output in CSV mode.]
[v12: Move CSV metrics fields to after running/enabled/variance.
  Minor fixes.]
[v13: Address review comments. Now probe for stalled events 
  in advance to avoid empty columns or lines. Fix -A shadowing.
  Various minor changes. Drop merged patches.]
[v14: Fix empty lines with CSV metrics. Avoid one more empty column
  in metric-only.]
[v15: Add missing fields in manpage. Use extra init function 
  for frontend event. Various smaller fixes. Add acked-by.]
[v16: Fix manpage again. Merge --per-thread crash patch.
  Add comments to --metric-only.]
[v17: Man page fixes. Simplify -A --metric-only nrcpus computation.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode,
and finally a --metric-only mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode:

% perf stat  -x, -I1000 -a sleep 1
 1.000982778,12006.549977,,task-clock,12006547787,100.00
 1.000982778,12822,,context-switches,12007100604,100.00,0.001,M/sec
 1.000982778,175,,cpu-migrations,12007180306,100.00,0.015,K/sec
 1.000982778,3404,,page-faults,12007185482,100.00,0.284,K/sec
 1.000982778,1930307489,,cycles,12007018233,100.00,0.161,GHz
 
1.000982778,6971803638,,stalled-cycles-frontend,12006902870,100.00,361.18,frontend
 cycles idle
 1.000982778,464493941,,instructions,12006873327,100.00,0.24,insn per cycle
 1.000982778,,15.01,stalled cycles per insn
 1.000982778,86548409,,branches,12006758420,100.00,7.208,M/sec
 1.000982778,4933638,,branch-misses,12006648104,100.00,5.70,of all branches

Now includes metrics

Metric only mode:

Concicse information if you only care about computed metrics, not raw values

% perf stat --metric-only  -a -I 1000
 1.001452803 frontend cycles idle insn per cycle   stalled cycles 
per insn branch-misses of all branches
 1.001452803  158.91%   0.662.39
2.92%
 2.002192321  180.63%   0.762.08
2.96%
 3.003088282  150.59%   0.622.57
2.84%
 4.004369835  196.20%   0.981.62
3.79%
 5.005227314  231.98%   0.841.90
4.71%


Metric only mode in CSV (flat format, easy to plot and analyze in statistical 
tools like JMP, R, pandas, gnuplot):

% perf stat -x, --metric-only  -a -I 1000
 1.001381652,frontend cycles idle,insn per cycle,stalled cycles per 
insn,branch-misses of all branches,
 

perf, tools: Refactor and support interval and CSV metrics

2016-03-03 Thread Andi Kleen
Fixed even more last feedback.

[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]
[v6: Fix running/noise printing patch.]
[v7: Reorder and merge two patches to avoid a bisect hole where unsupported was
printed as 0]
[v8: Minor fixes for review feedback. See changelog in patches.]
[v9: Fix newline bug. Add support for -A for --metric-only]
[v10: Remove extra "noise" printing (Jiri)
  Fix fields in documentation (Jiri)]
[v11: Fix manpage again. Avoid extra metric output in CSV mode.]
[v12: Move CSV metrics fields to after running/enabled/variance.
  Minor fixes.]
[v13: Address review comments. Now probe for stalled events 
  in advance to avoid empty columns or lines. Fix -A shadowing.
  Various minor changes. Drop merged patches.]
[v14: Fix empty lines with CSV metrics. Avoid one more empty column
  in metric-only.]
[v15: Add missing fields in manpage. Use extra init function 
  for frontend event. Various smaller fixes. Add acked-by.]
[v16: Fix manpage again. Merge --per-thread crash patch.
  Add comments to --metric-only.]
[v17: Man page fixes. Simplify -A --metric-only nrcpus computation.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode,
and finally a --metric-only mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode:

% perf stat  -x, -I1000 -a sleep 1
 1.000982778,12006.549977,,task-clock,12006547787,100.00
 1.000982778,12822,,context-switches,12007100604,100.00,0.001,M/sec
 1.000982778,175,,cpu-migrations,12007180306,100.00,0.015,K/sec
 1.000982778,3404,,page-faults,12007185482,100.00,0.284,K/sec
 1.000982778,1930307489,,cycles,12007018233,100.00,0.161,GHz
 
1.000982778,6971803638,,stalled-cycles-frontend,12006902870,100.00,361.18,frontend
 cycles idle
 1.000982778,464493941,,instructions,12006873327,100.00,0.24,insn per cycle
 1.000982778,,15.01,stalled cycles per insn
 1.000982778,86548409,,branches,12006758420,100.00,7.208,M/sec
 1.000982778,4933638,,branch-misses,12006648104,100.00,5.70,of all branches

Now includes metrics

Metric only mode:

Concicse information if you only care about computed metrics, not raw values

% perf stat --metric-only  -a -I 1000
 1.001452803 frontend cycles idle insn per cycle   stalled cycles 
per insn branch-misses of all branches
 1.001452803  158.91%   0.662.39
2.92%
 2.002192321  180.63%   0.762.08
2.96%
 3.003088282  150.59%   0.622.57
2.84%
 4.004369835  196.20%   0.981.62
3.79%
 5.005227314  231.98%   0.841.90
4.71%


Metric only mode in CSV (flat format, easy to plot and analyze in statistical 
tools like JMP, R, pandas, gnuplot):

% perf stat -x, --metric-only  -a -I 1000
 1.001381652,frontend cycles idle,insn per cycle,stalled cycles per 
insn,branch-misses of all branches,
 

perf, tools: Refactor and support interval and CSV metrics

2016-03-02 Thread Andi Kleen
Fixed even more last feedback.

[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]
[v6: Fix running/noise printing patch.]
[v7: Reorder and merge two patches to avoid a bisect hole where unsupported was
printed as 0]
[v8: Minor fixes for review feedback. See changelog in patches.]
[v9: Fix newline bug. Add support for -A for --metric-only]
[v10: Remove extra "noise" printing (Jiri)
  Fix fields in documentation (Jiri)]
[v11: Fix manpage again. Avoid extra metric output in CSV mode.]
[v12: Move CSV metrics fields to after running/enabled/variance.
  Minor fixes.]
[v13: Address review comments. Now probe for stalled events 
  in advance to avoid empty columns or lines. Fix -A shadowing.
  Various minor changes. Drop merged patches.]
[v14: Fix empty lines with CSV metrics. Avoid one more empty column
  in metric-only.]
[v15: Add missing fields in manpage. Use extra init function 
  for frontend event. Various smaller fixes. Add acked-by.]
[v16: Fix manpage again. Merge --per-thread crash patch.
  Add comments to --metric-only.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode,
and finally a --metric-only mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode:

% perf stat  -x, -I1000 -a sleep 1
 1.000982778,12006.549977,,task-clock,12006547787,100.00
 1.000982778,12822,,context-switches,12007100604,100.00,0.001,M/sec
 1.000982778,175,,cpu-migrations,12007180306,100.00,0.015,K/sec
 1.000982778,3404,,page-faults,12007185482,100.00,0.284,K/sec
 1.000982778,1930307489,,cycles,12007018233,100.00,0.161,GHz
 
1.000982778,6971803638,,stalled-cycles-frontend,12006902870,100.00,361.18,frontend
 cycles idle
 1.000982778,464493941,,instructions,12006873327,100.00,0.24,insn per cycle
 1.000982778,,15.01,stalled cycles per insn
 1.000982778,86548409,,branches,12006758420,100.00,7.208,M/sec
 1.000982778,4933638,,branch-misses,12006648104,100.00,5.70,of all branches

Now includes metrics

Metric only mode:

Concicse information if you only care about computed metrics, not raw values

% perf stat --metric-only  -a -I 1000
 1.001452803 frontend cycles idle insn per cycle   stalled cycles 
per insn branch-misses of all branches
 1.001452803  158.91%   0.662.39
2.92%
 2.002192321  180.63%   0.762.08
2.96%
 3.003088282  150.59%   0.622.57
2.84%
 4.004369835  196.20%   0.981.62
3.79%
 5.005227314  231.98%   0.841.90
4.71%


Metric only mode in CSV (flat format, easy to plot and analyze in statistical 
tools like JMP, R, pandas, gnuplot):

% perf stat -x, --metric-only  -a -I 1000
 1.001381652,frontend cycles idle,insn per cycle,stalled cycles per 
insn,branch-misses of all branches,
 1.001381652,173.32,0.83,2.09,1.73,
 

perf, tools: Refactor and support interval and CSV metrics

2016-03-02 Thread Andi Kleen
Fixed even more last feedback.

[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]
[v6: Fix running/noise printing patch.]
[v7: Reorder and merge two patches to avoid a bisect hole where unsupported was
printed as 0]
[v8: Minor fixes for review feedback. See changelog in patches.]
[v9: Fix newline bug. Add support for -A for --metric-only]
[v10: Remove extra "noise" printing (Jiri)
  Fix fields in documentation (Jiri)]
[v11: Fix manpage again. Avoid extra metric output in CSV mode.]
[v12: Move CSV metrics fields to after running/enabled/variance.
  Minor fixes.]
[v13: Address review comments. Now probe for stalled events 
  in advance to avoid empty columns or lines. Fix -A shadowing.
  Various minor changes. Drop merged patches.]
[v14: Fix empty lines with CSV metrics. Avoid one more empty column
  in metric-only.]
[v15: Add missing fields in manpage. Use extra init function 
  for frontend event. Various smaller fixes. Add acked-by.]
[v16: Fix manpage again. Merge --per-thread crash patch.
  Add comments to --metric-only.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode,
and finally a --metric-only mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode:

% perf stat  -x, -I1000 -a sleep 1
 1.000982778,12006.549977,,task-clock,12006547787,100.00
 1.000982778,12822,,context-switches,12007100604,100.00,0.001,M/sec
 1.000982778,175,,cpu-migrations,12007180306,100.00,0.015,K/sec
 1.000982778,3404,,page-faults,12007185482,100.00,0.284,K/sec
 1.000982778,1930307489,,cycles,12007018233,100.00,0.161,GHz
 
1.000982778,6971803638,,stalled-cycles-frontend,12006902870,100.00,361.18,frontend
 cycles idle
 1.000982778,464493941,,instructions,12006873327,100.00,0.24,insn per cycle
 1.000982778,,15.01,stalled cycles per insn
 1.000982778,86548409,,branches,12006758420,100.00,7.208,M/sec
 1.000982778,4933638,,branch-misses,12006648104,100.00,5.70,of all branches

Now includes metrics

Metric only mode:

Concicse information if you only care about computed metrics, not raw values

% perf stat --metric-only  -a -I 1000
 1.001452803 frontend cycles idle insn per cycle   stalled cycles 
per insn branch-misses of all branches
 1.001452803  158.91%   0.662.39
2.92%
 2.002192321  180.63%   0.762.08
2.96%
 3.003088282  150.59%   0.622.57
2.84%
 4.004369835  196.20%   0.981.62
3.79%
 5.005227314  231.98%   0.841.90
4.71%


Metric only mode in CSV (flat format, easy to plot and analyze in statistical 
tools like JMP, R, pandas, gnuplot):

% perf stat -x, --metric-only  -a -I 1000
 1.001381652,frontend cycles idle,insn per cycle,stalled cycles per 
insn,branch-misses of all branches,
 1.001381652,173.32,0.83,2.09,1.73,
 

Re: perf, tools: Refactor and support interval and CSV metrics

2016-03-01 Thread Arnaldo Carvalho de Melo
Em Tue, Mar 01, 2016 at 10:57:45AM -0800, Andi Kleen escreveu:
> Fixed even more last feedback.
> 
> [v5: Fix mainly bisect problems. No regressions introduced by one
> patch and fixed again later. Some minor fixes in addition]
> [v6: Fix running/noise printing patch.]
> [v7: Reorder and merge two patches to avoid a bisect hole where unsupported 
> was
> printed as 0]
> [v8: Minor fixes for review feedback. See changelog in patches.]
> [v9: Fix newline bug. Add support for -A for --metric-only]
> [v10: Remove extra "noise" printing (Jiri)
>   Fix fields in documentation (Jiri)]
> [v11: Fix manpage again. Avoid extra metric output in CSV mode.]
> [v12: Move CSV metrics fields to after running/enabled/variance.
>   Minor fixes.]
> [v13: Address review comments. Now probe for stalled events 
>   in advance to avoid empty columns or lines. Fix -A shadowing.
>   Various minor changes. Drop merged patches.]
> [v14: Fix empty lines with CSV metrics. Avoid one more empty column
>   in metric-only.]
> [v15: Add missing fields in manpage. Use extra init function 
>   for frontend event. Various smaller fixes. Add acked-by.]

Please check acme/perf/core, I processed various patches that you are
resubmitting.

https://git.kernel.org/cgit/linux/kernel/git/acme/linux.git/log/?h=perf/core

Doing that you force me to check if there were changes in the patches
already applied :-\

I already collected the Acked-by tags.

I'll continue after the ones I already merged.

- Arnaldo
 
> Currently perf stat does not support printing computed metrics for interval 
> (-I xxx)
> or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful 
> to know.
> 
> This patch implements them. The main obstacle was that the
> metrics printing was all open coded all over the metrics computation code.
> The second patch refactors the metrics printing to work through call backs 
> that
> can be more easily changed. This also cleans up the metrics printing 
> significantly.
> The indentation is now handled through printf, no more need to manually count 
> spaces.
> 
> Then based on that it implements metrics printing for CSV and interval mode,
> and finally a --metric-only mode.
> 
> Example output:
> 
> % perf stat  -I1000 -a sleep 1
> #  time  counts unit eventsmetric 
>  multiplex
>  1.001301370   12020.049593  task-clock (msec)
>  (100.00%)
>  1.001301370  3,952  context-switches  #0.329 
> K/sec(100.00%)
>  1.001301370 69  cpu-migrations#0.006 
> K/sec(100.00%)
>  1.001301370 76  page-faults   #0.006 
> K/sec  
>  1.001301370386,582,789  cycles#0.032 
> GHz  (100.00%)
>  1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
> frontend cycles idle (100.00%)
>  1.001301370  stalled-cycles-backend   
>  1.001301370101,751,678  instructions  #0.26  
> insn per cycle 
>  1.001301370   #7.04  
> stalled cycles per insn  (100.00%)
>  1.001301370 20,914,692  branches  #1.740 
> M/sec(100.00%)
>  1.001301370  1,943,630  branch-misses #9.29% 
> of all branches
> 
> CSV mode:
> 
> % perf stat  -x, -I1000 -a sleep 1
>  1.000982778,12006.549977,,task-clock,12006547787,100.00
>  1.000982778,12822,,context-switches,12007100604,100.00,0.001,M/sec
>  1.000982778,175,,cpu-migrations,12007180306,100.00,0.015,K/sec
>  1.000982778,3404,,page-faults,12007185482,100.00,0.284,K/sec
>  1.000982778,1930307489,,cycles,12007018233,100.00,0.161,GHz
>  
> 1.000982778,6971803638,,stalled-cycles-frontend,12006902870,100.00,361.18,frontend
>  cycles idle
>  1.000982778,464493941,,instructions,12006873327,100.00,0.24,insn per 
> cycle
>  1.000982778,,15.01,stalled cycles per insn
>  1.000982778,86548409,,branches,12006758420,100.00,7.208,M/sec
>  1.000982778,4933638,,branch-misses,12006648104,100.00,5.70,of all 
> branches
> 
> Now includes metrics
> 
> Metric only mode:
> 
> Concicse information if you only care about computed metrics, not raw values
> 
> % perf stat --metric-only  -a -I 1000
>  1.001452803 frontend cycles idle insn per cycle   stalled cycles 
> per insn branch-misses of all branches
>  1.001452803  158.91%   0.662.39  
>   2.92%
>  2.002192321  180.63%   0.762.08  
>   2.96%
>  3.003088282  150.59%   0.622.57  
>   2.84%
>  

Re: perf, tools: Refactor and support interval and CSV metrics

2016-03-01 Thread Arnaldo Carvalho de Melo
Em Tue, Mar 01, 2016 at 10:57:45AM -0800, Andi Kleen escreveu:
> Fixed even more last feedback.
> 
> [v5: Fix mainly bisect problems. No regressions introduced by one
> patch and fixed again later. Some minor fixes in addition]
> [v6: Fix running/noise printing patch.]
> [v7: Reorder and merge two patches to avoid a bisect hole where unsupported 
> was
> printed as 0]
> [v8: Minor fixes for review feedback. See changelog in patches.]
> [v9: Fix newline bug. Add support for -A for --metric-only]
> [v10: Remove extra "noise" printing (Jiri)
>   Fix fields in documentation (Jiri)]
> [v11: Fix manpage again. Avoid extra metric output in CSV mode.]
> [v12: Move CSV metrics fields to after running/enabled/variance.
>   Minor fixes.]
> [v13: Address review comments. Now probe for stalled events 
>   in advance to avoid empty columns or lines. Fix -A shadowing.
>   Various minor changes. Drop merged patches.]
> [v14: Fix empty lines with CSV metrics. Avoid one more empty column
>   in metric-only.]
> [v15: Add missing fields in manpage. Use extra init function 
>   for frontend event. Various smaller fixes. Add acked-by.]

Please check acme/perf/core, I processed various patches that you are
resubmitting.

https://git.kernel.org/cgit/linux/kernel/git/acme/linux.git/log/?h=perf/core

Doing that you force me to check if there were changes in the patches
already applied :-\

I already collected the Acked-by tags.

I'll continue after the ones I already merged.

- Arnaldo
 
> Currently perf stat does not support printing computed metrics for interval 
> (-I xxx)
> or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful 
> to know.
> 
> This patch implements them. The main obstacle was that the
> metrics printing was all open coded all over the metrics computation code.
> The second patch refactors the metrics printing to work through call backs 
> that
> can be more easily changed. This also cleans up the metrics printing 
> significantly.
> The indentation is now handled through printf, no more need to manually count 
> spaces.
> 
> Then based on that it implements metrics printing for CSV and interval mode,
> and finally a --metric-only mode.
> 
> Example output:
> 
> % perf stat  -I1000 -a sleep 1
> #  time  counts unit eventsmetric 
>  multiplex
>  1.001301370   12020.049593  task-clock (msec)
>  (100.00%)
>  1.001301370  3,952  context-switches  #0.329 
> K/sec(100.00%)
>  1.001301370 69  cpu-migrations#0.006 
> K/sec(100.00%)
>  1.001301370 76  page-faults   #0.006 
> K/sec  
>  1.001301370386,582,789  cycles#0.032 
> GHz  (100.00%)
>  1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
> frontend cycles idle (100.00%)
>  1.001301370  stalled-cycles-backend   
>  1.001301370101,751,678  instructions  #0.26  
> insn per cycle 
>  1.001301370   #7.04  
> stalled cycles per insn  (100.00%)
>  1.001301370 20,914,692  branches  #1.740 
> M/sec(100.00%)
>  1.001301370  1,943,630  branch-misses #9.29% 
> of all branches
> 
> CSV mode:
> 
> % perf stat  -x, -I1000 -a sleep 1
>  1.000982778,12006.549977,,task-clock,12006547787,100.00
>  1.000982778,12822,,context-switches,12007100604,100.00,0.001,M/sec
>  1.000982778,175,,cpu-migrations,12007180306,100.00,0.015,K/sec
>  1.000982778,3404,,page-faults,12007185482,100.00,0.284,K/sec
>  1.000982778,1930307489,,cycles,12007018233,100.00,0.161,GHz
>  
> 1.000982778,6971803638,,stalled-cycles-frontend,12006902870,100.00,361.18,frontend
>  cycles idle
>  1.000982778,464493941,,instructions,12006873327,100.00,0.24,insn per 
> cycle
>  1.000982778,,15.01,stalled cycles per insn
>  1.000982778,86548409,,branches,12006758420,100.00,7.208,M/sec
>  1.000982778,4933638,,branch-misses,12006648104,100.00,5.70,of all 
> branches
> 
> Now includes metrics
> 
> Metric only mode:
> 
> Concicse information if you only care about computed metrics, not raw values
> 
> % perf stat --metric-only  -a -I 1000
>  1.001452803 frontend cycles idle insn per cycle   stalled cycles 
> per insn branch-misses of all branches
>  1.001452803  158.91%   0.662.39  
>   2.92%
>  2.002192321  180.63%   0.762.08  
>   2.96%
>  3.003088282  150.59%   0.622.57  
>   2.84%
>  

perf, tools: Refactor and support interval and CSV metrics

2016-03-01 Thread Andi Kleen
Fixed even more last feedback.

[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]
[v6: Fix running/noise printing patch.]
[v7: Reorder and merge two patches to avoid a bisect hole where unsupported was
printed as 0]
[v8: Minor fixes for review feedback. See changelog in patches.]
[v9: Fix newline bug. Add support for -A for --metric-only]
[v10: Remove extra "noise" printing (Jiri)
  Fix fields in documentation (Jiri)]
[v11: Fix manpage again. Avoid extra metric output in CSV mode.]
[v12: Move CSV metrics fields to after running/enabled/variance.
  Minor fixes.]
[v13: Address review comments. Now probe for stalled events 
  in advance to avoid empty columns or lines. Fix -A shadowing.
  Various minor changes. Drop merged patches.]
[v14: Fix empty lines with CSV metrics. Avoid one more empty column
  in metric-only.]
[v15: Add missing fields in manpage. Use extra init function 
  for frontend event. Various smaller fixes. Add acked-by.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode,
and finally a --metric-only mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode:

% perf stat  -x, -I1000 -a sleep 1
 1.000982778,12006.549977,,task-clock,12006547787,100.00
 1.000982778,12822,,context-switches,12007100604,100.00,0.001,M/sec
 1.000982778,175,,cpu-migrations,12007180306,100.00,0.015,K/sec
 1.000982778,3404,,page-faults,12007185482,100.00,0.284,K/sec
 1.000982778,1930307489,,cycles,12007018233,100.00,0.161,GHz
 
1.000982778,6971803638,,stalled-cycles-frontend,12006902870,100.00,361.18,frontend
 cycles idle
 1.000982778,464493941,,instructions,12006873327,100.00,0.24,insn per cycle
 1.000982778,,15.01,stalled cycles per insn
 1.000982778,86548409,,branches,12006758420,100.00,7.208,M/sec
 1.000982778,4933638,,branch-misses,12006648104,100.00,5.70,of all branches

Now includes metrics

Metric only mode:

Concicse information if you only care about computed metrics, not raw values

% perf stat --metric-only  -a -I 1000
 1.001452803 frontend cycles idle insn per cycle   stalled cycles 
per insn branch-misses of all branches
 1.001452803  158.91%   0.662.39
2.92%
 2.002192321  180.63%   0.762.08
2.96%
 3.003088282  150.59%   0.622.57
2.84%
 4.004369835  196.20%   0.981.62
3.79%
 5.005227314  231.98%   0.841.90
4.71%


Metric only mode in CSV (flat format, easy to plot and analyze in statistical 
tools like JMP, R, pandas, gnuplot):

% perf stat -x, --metric-only  -a -I 1000
 1.001381652,frontend cycles idle,insn per cycle,stalled cycles per 
insn,branch-misses of all branches,
 1.001381652,173.32,0.83,2.09,1.73,
 2.002073343,199.47,1.07,1.60,2.14,
 3.002875524,109.52,0.22,7.83,1.63,
 4.003970059,132.10,0.17,10.85,1.51,
 

perf, tools: Refactor and support interval and CSV metrics

2016-03-01 Thread Andi Kleen
Fixed even more last feedback.

[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]
[v6: Fix running/noise printing patch.]
[v7: Reorder and merge two patches to avoid a bisect hole where unsupported was
printed as 0]
[v8: Minor fixes for review feedback. See changelog in patches.]
[v9: Fix newline bug. Add support for -A for --metric-only]
[v10: Remove extra "noise" printing (Jiri)
  Fix fields in documentation (Jiri)]
[v11: Fix manpage again. Avoid extra metric output in CSV mode.]
[v12: Move CSV metrics fields to after running/enabled/variance.
  Minor fixes.]
[v13: Address review comments. Now probe for stalled events 
  in advance to avoid empty columns or lines. Fix -A shadowing.
  Various minor changes. Drop merged patches.]
[v14: Fix empty lines with CSV metrics. Avoid one more empty column
  in metric-only.]
[v15: Add missing fields in manpage. Use extra init function 
  for frontend event. Various smaller fixes. Add acked-by.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode,
and finally a --metric-only mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode:

% perf stat  -x, -I1000 -a sleep 1
 1.000982778,12006.549977,,task-clock,12006547787,100.00
 1.000982778,12822,,context-switches,12007100604,100.00,0.001,M/sec
 1.000982778,175,,cpu-migrations,12007180306,100.00,0.015,K/sec
 1.000982778,3404,,page-faults,12007185482,100.00,0.284,K/sec
 1.000982778,1930307489,,cycles,12007018233,100.00,0.161,GHz
 
1.000982778,6971803638,,stalled-cycles-frontend,12006902870,100.00,361.18,frontend
 cycles idle
 1.000982778,464493941,,instructions,12006873327,100.00,0.24,insn per cycle
 1.000982778,,15.01,stalled cycles per insn
 1.000982778,86548409,,branches,12006758420,100.00,7.208,M/sec
 1.000982778,4933638,,branch-misses,12006648104,100.00,5.70,of all branches

Now includes metrics

Metric only mode:

Concicse information if you only care about computed metrics, not raw values

% perf stat --metric-only  -a -I 1000
 1.001452803 frontend cycles idle insn per cycle   stalled cycles 
per insn branch-misses of all branches
 1.001452803  158.91%   0.662.39
2.92%
 2.002192321  180.63%   0.762.08
2.96%
 3.003088282  150.59%   0.622.57
2.84%
 4.004369835  196.20%   0.981.62
3.79%
 5.005227314  231.98%   0.841.90
4.71%


Metric only mode in CSV (flat format, easy to plot and analyze in statistical 
tools like JMP, R, pandas, gnuplot):

% perf stat -x, --metric-only  -a -I 1000
 1.001381652,frontend cycles idle,insn per cycle,stalled cycles per 
insn,branch-misses of all branches,
 1.001381652,173.32,0.83,2.09,1.73,
 2.002073343,199.47,1.07,1.60,2.14,
 3.002875524,109.52,0.22,7.83,1.63,
 4.003970059,132.10,0.17,10.85,1.51,
 

Re: perf, tools: Refactor and support interval and CSV metrics

2016-03-01 Thread Arnaldo Carvalho de Melo
Em Mon, Feb 29, 2016 at 02:36:19PM -0800, Andi Kleen escreveu:
> Fixed last feedback.
> 
> [v5: Fix mainly bisect problems. No regressions introduced by one
> patch and fixed again later. Some minor fixes in addition]
> [v6: Fix running/noise printing patch.]
> [v7: Reorder and merge two patches to avoid a bisect hole where unsupported 
> was
> printed as 0]
> [v8: Minor fixes for review feedback. See changelog in patches.]
> [v9: Fix newline bug. Add support for -A for --metric-only]
> [v10: Remove extra "noise" printing (Jiri)
>   Fix fields in documentation (Jiri)]
> [v11: Fix manpage again. Avoid extra metric output in CSV mode.]
> [v12: Move CSV metrics fields to after running/enabled/variance.
>   Minor fixes.]
> [v13: Address review comments. Now probe for stalled events 
>   in advance to avoid empty columns or lines. Fix -A shadowing.
>   Various minor changes. Drop merged patches.]
> [v14: Fix empty lines with CSV metrics. Avoid one more empty column
>   in metric-only.]

1/7 was already merged, pushed to Ingo, applied (2,3)/7.

- Arnaldo


Re: perf, tools: Refactor and support interval and CSV metrics

2016-03-01 Thread Arnaldo Carvalho de Melo
Em Mon, Feb 29, 2016 at 02:36:19PM -0800, Andi Kleen escreveu:
> Fixed last feedback.
> 
> [v5: Fix mainly bisect problems. No regressions introduced by one
> patch and fixed again later. Some minor fixes in addition]
> [v6: Fix running/noise printing patch.]
> [v7: Reorder and merge two patches to avoid a bisect hole where unsupported 
> was
> printed as 0]
> [v8: Minor fixes for review feedback. See changelog in patches.]
> [v9: Fix newline bug. Add support for -A for --metric-only]
> [v10: Remove extra "noise" printing (Jiri)
>   Fix fields in documentation (Jiri)]
> [v11: Fix manpage again. Avoid extra metric output in CSV mode.]
> [v12: Move CSV metrics fields to after running/enabled/variance.
>   Minor fixes.]
> [v13: Address review comments. Now probe for stalled events 
>   in advance to avoid empty columns or lines. Fix -A shadowing.
>   Various minor changes. Drop merged patches.]
> [v14: Fix empty lines with CSV metrics. Avoid one more empty column
>   in metric-only.]

1/7 was already merged, pushed to Ingo, applied (2,3)/7.

- Arnaldo


perf, tools: Refactor and support interval and CSV metrics

2016-02-29 Thread Andi Kleen
Fixed last feedback.

[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]
[v6: Fix running/noise printing patch.]
[v7: Reorder and merge two patches to avoid a bisect hole where unsupported was
printed as 0]
[v8: Minor fixes for review feedback. See changelog in patches.]
[v9: Fix newline bug. Add support for -A for --metric-only]
[v10: Remove extra "noise" printing (Jiri)
  Fix fields in documentation (Jiri)]
[v11: Fix manpage again. Avoid extra metric output in CSV mode.]
[v12: Move CSV metrics fields to after running/enabled/variance.
  Minor fixes.]
[v13: Address review comments. Now probe for stalled events 
  in advance to avoid empty columns or lines. Fix -A shadowing.
  Various minor changes. Drop merged patches.]
[v14: Fix empty lines with CSV metrics. Avoid one more empty column
  in metric-only.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode,
and finally a --metric-only mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode:

% perf stat  -x, -I1000 -a sleep 1
 1.000982778,12006.549977,,task-clock,12006547787,100.00
 1.000982778,12822,,context-switches,12007100604,100.00,0.001,M/sec
 1.000982778,175,,cpu-migrations,12007180306,100.00,0.015,K/sec
 1.000982778,3404,,page-faults,12007185482,100.00,0.284,K/sec
 1.000982778,1930307489,,cycles,12007018233,100.00,0.161,GHz
 
1.000982778,6971803638,,stalled-cycles-frontend,12006902870,100.00,361.18,frontend
 cycles idle
 1.000982778,464493941,,instructions,12006873327,100.00,0.24,insn per cycle
 1.000982778,,15.01,stalled cycles per insn
 1.000982778,86548409,,branches,12006758420,100.00,7.208,M/sec
 1.000982778,4933638,,branch-misses,12006648104,100.00,5.70,of all branches

Now includes metrics

Metric only mode:

Concicse information if you only care about computed metrics, not raw values

% perf stat --metric-only  -a -I 1000
 1.001452803 frontend cycles idle insn per cycle   stalled cycles 
per insn branch-misses of all branches
 1.001452803  158.91%   0.662.39
2.92%
 2.002192321  180.63%   0.762.08
2.96%
 3.003088282  150.59%   0.622.57
2.84%
 4.004369835  196.20%   0.981.62
3.79%
 5.005227314  231.98%   0.841.90
4.71%


Metric only mode in CSV (flat format, easy to plot and analyze in statistical 
tools like JMP, R, pandas, gnuplot):

% perf stat -x, --metric-only  -a -I 1000
 1.001381652,frontend cycles idle,insn per cycle,stalled cycles per 
insn,branch-misses of all branches,
 1.001381652,173.32,0.83,2.09,1.73,
 2.002073343,199.47,1.07,1.60,2.14,
 3.002875524,109.52,0.22,7.83,1.63,
 4.003970059,132.10,0.17,10.85,1.51,
 5.004818754,181.60,0.22,8.87,2.22,


Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
perf/stat-metrics-18


perf, tools: Refactor and support interval and CSV metrics

2016-02-29 Thread Andi Kleen
Fixed last feedback.

[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]
[v6: Fix running/noise printing patch.]
[v7: Reorder and merge two patches to avoid a bisect hole where unsupported was
printed as 0]
[v8: Minor fixes for review feedback. See changelog in patches.]
[v9: Fix newline bug. Add support for -A for --metric-only]
[v10: Remove extra "noise" printing (Jiri)
  Fix fields in documentation (Jiri)]
[v11: Fix manpage again. Avoid extra metric output in CSV mode.]
[v12: Move CSV metrics fields to after running/enabled/variance.
  Minor fixes.]
[v13: Address review comments. Now probe for stalled events 
  in advance to avoid empty columns or lines. Fix -A shadowing.
  Various minor changes. Drop merged patches.]
[v14: Fix empty lines with CSV metrics. Avoid one more empty column
  in metric-only.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode,
and finally a --metric-only mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode:

% perf stat  -x, -I1000 -a sleep 1
 1.000982778,12006.549977,,task-clock,12006547787,100.00
 1.000982778,12822,,context-switches,12007100604,100.00,0.001,M/sec
 1.000982778,175,,cpu-migrations,12007180306,100.00,0.015,K/sec
 1.000982778,3404,,page-faults,12007185482,100.00,0.284,K/sec
 1.000982778,1930307489,,cycles,12007018233,100.00,0.161,GHz
 
1.000982778,6971803638,,stalled-cycles-frontend,12006902870,100.00,361.18,frontend
 cycles idle
 1.000982778,464493941,,instructions,12006873327,100.00,0.24,insn per cycle
 1.000982778,,15.01,stalled cycles per insn
 1.000982778,86548409,,branches,12006758420,100.00,7.208,M/sec
 1.000982778,4933638,,branch-misses,12006648104,100.00,5.70,of all branches

Now includes metrics

Metric only mode:

Concicse information if you only care about computed metrics, not raw values

% perf stat --metric-only  -a -I 1000
 1.001452803 frontend cycles idle insn per cycle   stalled cycles 
per insn branch-misses of all branches
 1.001452803  158.91%   0.662.39
2.92%
 2.002192321  180.63%   0.762.08
2.96%
 3.003088282  150.59%   0.622.57
2.84%
 4.004369835  196.20%   0.981.62
3.79%
 5.005227314  231.98%   0.841.90
4.71%


Metric only mode in CSV (flat format, easy to plot and analyze in statistical 
tools like JMP, R, pandas, gnuplot):

% perf stat -x, --metric-only  -a -I 1000
 1.001381652,frontend cycles idle,insn per cycle,stalled cycles per 
insn,branch-misses of all branches,
 1.001381652,173.32,0.83,2.09,1.73,
 2.002073343,199.47,1.07,1.60,2.14,
 3.002875524,109.52,0.22,7.83,1.63,
 4.003970059,132.10,0.17,10.85,1.51,
 5.004818754,181.60,0.22,8.87,2.22,


Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
perf/stat-metrics-18


perf, tools: Refactor and support interval and CSV metrics

2016-02-26 Thread Andi Kleen
[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]
[v6: Fix running/noise printing patch.]
[v7: Reorder and merge two patches to avoid a bisect hole where unsupported was
printed as 0]
[v8: Minor fixes for review feedback. See changelog in patches.]
[v9: Fix newline bug. Add support for -A for --metric-only]
[v10: Remove extra "noise" printing (Jiri)
  Fix fields in documentation (Jiri)]
[v11: Fix manpage again. Avoid extra metric output in CSV mode.]
[v12: Move CSV metrics fields to after running/enabled/variance.
  Minor fixes.]
[v13: Address review comments. Now probe for stalled events 
  in advance to avoid empty columns or lines. Fix -A shadowing.
  Various minor changes. Drop merged patches.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode,
and finally a --metric-only mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode:

% perf stat  -x, -I1000 -a sleep 1
 1.000982778,12006.549977,,task-clock,12006547787,100.00
 1.000982778,12822,,context-switches,12007100604,100.00,0.001,M/sec
 1.000982778,175,,cpu-migrations,12007180306,100.00,0.015,K/sec
 1.000982778,3404,,page-faults,12007185482,100.00,0.284,K/sec
 1.000982778,1930307489,,cycles,12007018233,100.00,0.161,GHz
 
1.000982778,6971803638,,stalled-cycles-frontend,12006902870,100.00,361.18,frontend
 cycles idle
 1.000982778,464493941,,instructions,12006873327,100.00,0.24,insn per cycle
 1.000982778,,15.01,stalled cycles per insn
 1.000982778,86548409,,branches,12006758420,100.00,7.208,M/sec
 1.000982778,4933638,,branch-misses,12006648104,100.00,5.70,of all branches

Now includes metrics

Metric only mode:

Concicse information if you only care about computed metrics, not raw values

% perf stat --metric-only  -a -I 1000
 1.001452803 frontend cycles idle insn per cycle   stalled cycles 
per insn branch-misses of all branches
 1.001452803  158.91%   0.662.39
2.92%
 2.002192321  180.63%   0.762.08
2.96%
 3.003088282  150.59%   0.622.57
2.84%
 4.004369835  196.20%   0.981.62
3.79%
 5.005227314  231.98%   0.841.90
4.71%


Metric only mode in CSV (flat format, easy to plot and analyze in statistical 
tools like JMP, R, pandas, gnuplot):

% perf stat -x, --metric-only  -a -I 1000
 1.001381652,frontend cycles idle,insn per cycle,stalled cycles per 
insn,branch-misses of all branches,
 1.001381652,173.32,0.83,2.09,1.73,
 2.002073343,199.47,1.07,1.60,2.14,
 3.002875524,109.52,0.22,7.83,1.63,
 4.003970059,132.10,0.17,10.85,1.51,
 5.004818754,181.60,0.22,8.87,2.22,


Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
perf/stat-metrics-17


perf, tools: Refactor and support interval and CSV metrics

2016-02-26 Thread Andi Kleen
[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]
[v6: Fix running/noise printing patch.]
[v7: Reorder and merge two patches to avoid a bisect hole where unsupported was
printed as 0]
[v8: Minor fixes for review feedback. See changelog in patches.]
[v9: Fix newline bug. Add support for -A for --metric-only]
[v10: Remove extra "noise" printing (Jiri)
  Fix fields in documentation (Jiri)]
[v11: Fix manpage again. Avoid extra metric output in CSV mode.]
[v12: Move CSV metrics fields to after running/enabled/variance.
  Minor fixes.]
[v13: Address review comments. Now probe for stalled events 
  in advance to avoid empty columns or lines. Fix -A shadowing.
  Various minor changes. Drop merged patches.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode,
and finally a --metric-only mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode:

% perf stat  -x, -I1000 -a sleep 1
 1.000982778,12006.549977,,task-clock,12006547787,100.00
 1.000982778,12822,,context-switches,12007100604,100.00,0.001,M/sec
 1.000982778,175,,cpu-migrations,12007180306,100.00,0.015,K/sec
 1.000982778,3404,,page-faults,12007185482,100.00,0.284,K/sec
 1.000982778,1930307489,,cycles,12007018233,100.00,0.161,GHz
 
1.000982778,6971803638,,stalled-cycles-frontend,12006902870,100.00,361.18,frontend
 cycles idle
 1.000982778,464493941,,instructions,12006873327,100.00,0.24,insn per cycle
 1.000982778,,15.01,stalled cycles per insn
 1.000982778,86548409,,branches,12006758420,100.00,7.208,M/sec
 1.000982778,4933638,,branch-misses,12006648104,100.00,5.70,of all branches

Now includes metrics

Metric only mode:

Concicse information if you only care about computed metrics, not raw values

% perf stat --metric-only  -a -I 1000
 1.001452803 frontend cycles idle insn per cycle   stalled cycles 
per insn branch-misses of all branches
 1.001452803  158.91%   0.662.39
2.92%
 2.002192321  180.63%   0.762.08
2.96%
 3.003088282  150.59%   0.622.57
2.84%
 4.004369835  196.20%   0.981.62
3.79%
 5.005227314  231.98%   0.841.90
4.71%


Metric only mode in CSV (flat format, easy to plot and analyze in statistical 
tools like JMP, R, pandas, gnuplot):

% perf stat -x, --metric-only  -a -I 1000
 1.001381652,frontend cycles idle,insn per cycle,stalled cycles per 
insn,branch-misses of all branches,
 1.001381652,173.32,0.83,2.09,1.73,
 2.002073343,199.47,1.07,1.60,2.14,
 3.002875524,109.52,0.22,7.83,1.63,
 4.003970059,132.10,0.17,10.85,1.51,
 5.004818754,181.60,0.22,8.87,2.22,


Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
perf/stat-metrics-17


perf, tools: Refactor and support interval and CSV metrics

2016-02-17 Thread Andi Kleen
Rebased tree and fixed Jiri's last feedback.

[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]
[v6: Fix running/noise printing patch.]
[v7: Reorder and merge two patches to avoid a bisect hole where unsupported was
printed as 0]
[v8: Minor fixes for review feedback. See changelog in patches.]
[v9: Fix newline bug. Add support for -A for --metric-only]
[v10: Remove extra "noise" printing (Jiri)
  Fix fields in documentation (Jiri)]
[v11: Fix manpage again. Avoid extra metric output in CSV mode.]
[v12: Move CSV metrics fields to after running/enabled/variance.
  Fix regression with not counted counters.
  Minor fixes.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode,
and finally a --metric-only mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode:

% perf stat  -x, -I1000 -a sleep 1
 1.000982778,12006.549977,,task-clock,12006547787,100.00
 1.000982778,12822,,context-switches,12007100604,100.00,0.001,M/sec
 1.000982778,175,,cpu-migrations,12007180306,100.00,0.015,K/sec
 1.000982778,3404,,page-faults,12007185482,100.00,0.284,K/sec
 1.000982778,1930307489,,cycles,12007018233,100.00,0.161,GHz
 
1.000982778,6971803638,,stalled-cycles-frontend,12006902870,100.00,361.18,frontend
 cycles idle
 1.000982778,,,stalled-cycles-backend,0,100.00
 1.000982778,464493941,,instructions,12006873327,100.00,0.24,insn per cycle
 1.000982778,,15.01,stalled cycles per insn
 1.000982778,86548409,,branches,12006758420,100.00,7.208,M/sec
 1.000982778,4933638,,branch-misses,12006648104,100.00,5.70,of all branches

Now includes metrics

Metric only mode:

Concicse information if you only care about computed metrics, not raw values

% perf stat --metric-only  -a -I 1000
 1.001750901 frontend cycles idle backend cycles idle  insn per cycle   
stalled cycles per insn branch-misses of all branches 
 1.001750901  188.78%   0.53
3.564.19%  
 2.002625926  233.68%   0.86
2.302.84%  
 3.003296456  236.16%   1.18
1.582.87%  
 4.004095913  129.87%   0.24
7.822.08%  
 5.004964861  116.26%   0.17   
11.351.43%  
 6.005802242  148.16%   0.19   
10.051.54%  
 7.006485273  151.76%   0.18   
11.251.88% 

Metric only mode in CSV (flat format, easy to plot and analyze in statistical 
tools like JMP, R, pandas, gnuplot):

% perf stat -x, --metric-only  -a -I 1000
 1.001381652,frontend cycles idle,backend cycles idle,insn per 
cycle,stalled 

perf, tools: Refactor and support interval and CSV metrics

2016-02-17 Thread Andi Kleen
Rebased tree and fixed Jiri's last feedback.

[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]
[v6: Fix running/noise printing patch.]
[v7: Reorder and merge two patches to avoid a bisect hole where unsupported was
printed as 0]
[v8: Minor fixes for review feedback. See changelog in patches.]
[v9: Fix newline bug. Add support for -A for --metric-only]
[v10: Remove extra "noise" printing (Jiri)
  Fix fields in documentation (Jiri)]
[v11: Fix manpage again. Avoid extra metric output in CSV mode.]
[v12: Move CSV metrics fields to after running/enabled/variance.
  Fix regression with not counted counters.
  Minor fixes.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode,
and finally a --metric-only mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode:

% perf stat  -x, -I1000 -a sleep 1
 1.000982778,12006.549977,,task-clock,12006547787,100.00
 1.000982778,12822,,context-switches,12007100604,100.00,0.001,M/sec
 1.000982778,175,,cpu-migrations,12007180306,100.00,0.015,K/sec
 1.000982778,3404,,page-faults,12007185482,100.00,0.284,K/sec
 1.000982778,1930307489,,cycles,12007018233,100.00,0.161,GHz
 
1.000982778,6971803638,,stalled-cycles-frontend,12006902870,100.00,361.18,frontend
 cycles idle
 1.000982778,,,stalled-cycles-backend,0,100.00
 1.000982778,464493941,,instructions,12006873327,100.00,0.24,insn per cycle
 1.000982778,,15.01,stalled cycles per insn
 1.000982778,86548409,,branches,12006758420,100.00,7.208,M/sec
 1.000982778,4933638,,branch-misses,12006648104,100.00,5.70,of all branches

Now includes metrics

Metric only mode:

Concicse information if you only care about computed metrics, not raw values

% perf stat --metric-only  -a -I 1000
 1.001750901 frontend cycles idle backend cycles idle  insn per cycle   
stalled cycles per insn branch-misses of all branches 
 1.001750901  188.78%   0.53
3.564.19%  
 2.002625926  233.68%   0.86
2.302.84%  
 3.003296456  236.16%   1.18
1.582.87%  
 4.004095913  129.87%   0.24
7.822.08%  
 5.004964861  116.26%   0.17   
11.351.43%  
 6.005802242  148.16%   0.19   
10.051.54%  
 7.006485273  151.76%   0.18   
11.251.88% 

Metric only mode in CSV (flat format, easy to plot and analyze in statistical 
tools like JMP, R, pandas, gnuplot):

% perf stat -x, --metric-only  -a -I 1000
 1.001381652,frontend cycles idle,backend cycles idle,insn per 
cycle,stalled 

perf, tools: Refactor and support interval and CSV metrics

2016-01-30 Thread Andi Kleen
Rebased tree and fixed Jiri's last feedback.

[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]
[v6: Fix running/noise printing patch.]
[v7: Reorder and merge two patches to avoid a bisect hole where unsupported was
printed as 0]
[v8: Minor fixes for review feedback. See changelog in patches.]
[v9: Fix newline bug. Add support for -A for --metric-only]
[v10: Remove extra "noise" printing (Jiri)
  Fix fields in documentation (Jiri)]
[v11: Fix manpage again. Avoid extra metric output in CSV mode.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode,
and finally a --metric-only mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode:

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches

Now includes metrics

Metric only mode:

Concicse information if you only care about computed metrics, not raw values

% perf stat --metric-only  -a -I 1000
 1.001750901 frontend cycles idle backend cycles idle  insn per cycle   
stalled cycles per insn branch-misses of all branches 
 1.001750901  188.78%   0.53
3.564.19%  
 2.002625926  233.68%   0.86
2.302.84%  
 3.003296456  236.16%   1.18
1.582.87%  
 4.004095913  129.87%   0.24
7.822.08%  
 5.004964861  116.26%   0.17   
11.351.43%  
 6.005802242  148.16%   0.19   
10.051.54%  
 7.006485273  151.76%   0.18   
11.251.88% 

Metric only mode in CSV (flat format, easy to plot and analyze in statistical 
tools like JMP, R, pandas, gnuplot):

% perf stat -x, --metric-only  -a -I 1000
 1.001381652,frontend cycles idle,backend cycles idle,insn per 
cycle,stalled cycles per insn,branch-misses of all branches,
 1.001381652,173.32,,0.83,2.09,1.73,
 2.002073343,199.47,,1.07,1.60,2.14,
 

perf, tools: Refactor and support interval and CSV metrics

2016-01-30 Thread Andi Kleen
Rebased tree and fixed Jiri's last feedback.

[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]
[v6: Fix running/noise printing patch.]
[v7: Reorder and merge two patches to avoid a bisect hole where unsupported was
printed as 0]
[v8: Minor fixes for review feedback. See changelog in patches.]
[v9: Fix newline bug. Add support for -A for --metric-only]
[v10: Remove extra "noise" printing (Jiri)
  Fix fields in documentation (Jiri)]
[v11: Fix manpage again. Avoid extra metric output in CSV mode.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode,
and finally a --metric-only mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode:

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches

Now includes metrics

Metric only mode:

Concicse information if you only care about computed metrics, not raw values

% perf stat --metric-only  -a -I 1000
 1.001750901 frontend cycles idle backend cycles idle  insn per cycle   
stalled cycles per insn branch-misses of all branches 
 1.001750901  188.78%   0.53
3.564.19%  
 2.002625926  233.68%   0.86
2.302.84%  
 3.003296456  236.16%   1.18
1.582.87%  
 4.004095913  129.87%   0.24
7.822.08%  
 5.004964861  116.26%   0.17   
11.351.43%  
 6.005802242  148.16%   0.19   
10.051.54%  
 7.006485273  151.76%   0.18   
11.251.88% 

Metric only mode in CSV (flat format, easy to plot and analyze in statistical 
tools like JMP, R, pandas, gnuplot):

% perf stat -x, --metric-only  -a -I 1000
 1.001381652,frontend cycles idle,backend cycles idle,insn per 
cycle,stalled cycles per insn,branch-misses of all branches,
 1.001381652,173.32,,0.83,2.09,1.73,
 2.002073343,199.47,,1.07,1.60,2.14,
 

perf, tools: Refactor and support interval and CSV metrics

2016-01-26 Thread Andi Kleen
Rebased tree and fixed Jiri's last feedback.

[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]
[v6: Fix running/noise printing patch.]
[v7: Reorder and merge two patches to avoid a bisect hole where unsupported was
printed as 0]
[v8: Minor fixes for review feedback. See changelog in patches.]
[v9: Fix newline bug. Add support for -A for --metric-only]
[v10: Remove extra "noise" printing (Jiri)
  Fix fields in documentation (Jiri)]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode,
and finally a --metric-only mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches

Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
perf/stat-metrics-14


perf, tools: Refactor and support interval and CSV metrics

2016-01-26 Thread Andi Kleen
Rebased tree and fixed Jiri's last feedback.

[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]
[v6: Fix running/noise printing patch.]
[v7: Reorder and merge two patches to avoid a bisect hole where unsupported was
printed as 0]
[v8: Minor fixes for review feedback. See changelog in patches.]
[v9: Fix newline bug. Add support for -A for --metric-only]
[v10: Remove extra "noise" printing (Jiri)
  Fix fields in documentation (Jiri)]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode,
and finally a --metric-only mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches

Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
perf/stat-metrics-14


Re: perf, tools: Refactor and support interval and CSV metrics

2016-01-22 Thread Jiri Olsa
On Tue, Jan 19, 2016 at 06:26:43PM -0800, Andi Kleen wrote:
> [v5: Fix mainly bisect problems. No regressions introduced by one
> patch and fixed again later. Some minor fixes in addition]
> [v6: Fix running/noise printing patch.]
> [v7: Reorder and merge two patches to avoid a bisect hole where unsupported 
> was
> printed as 0]
> [v8: Minor fixes for review feedback. See changelog in patches.]
> [v9: Fix newline bug. Add support for -A for --metric-only]
> 
> Currently perf stat does not support printing computed metrics for interval 
> (-I xxx)
> or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful 
> to know.
> 
> This patch implements them. The main obstacle was that the
> metrics printing was all open coded all over the metrics computation code.
> The second patch refactors the metrics printing to work through call backs 
> that
> can be more easily changed. This also cleans up the metrics printing 
> significantly.
> The indentation is now handled through printf, no more need to manually count 
> spaces.
> 
> Then based on that it implements metrics printing for CSV and interval mode,
> and finally a --metric-only mode.
> 
> Example output:
> 
> % perf stat  -I1000 -a sleep 1
> #  time  counts unit eventsmetric 
>  multiplex
>  1.001301370   12020.049593  task-clock (msec)
>  (100.00%)
>  1.001301370  3,952  context-switches  #0.329 
> K/sec(100.00%)
>  1.001301370 69  cpu-migrations#0.006 
> K/sec(100.00%)
>  1.001301370 76  page-faults   #0.006 
> K/sec  
>  1.001301370386,582,789  cycles#0.032 
> GHz  (100.00%)
>  1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
> frontend cycles idle (100.00%)
>  1.001301370  stalled-cycles-backend   
>  1.001301370101,751,678  instructions  #0.26  
> insn per cycle 
>  1.001301370   #7.04  
> stalled cycles per insn  (100.00%)
>  1.001301370 20,914,692  branches  #1.740 
> M/sec(100.00%)
>  1.001301370  1,943,630  branch-misses #9.29% 
> of all branches
> 
> CSV mode
> 
> % perf stat  -x, -I1000 -a sleep 1
>  1.000852081,12016.143006,,task-clock
>  1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
>  1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
>  1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
>  1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
>  
> 1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
>  cycles idle
>  1.000852081,,,stalled-cycles-backend,0,100.00
>  1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per 
> cycle
>  1.00085208112011130729,100.00,8.83,stalled cycles per insn
>  1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
>  1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all 
> branches
> 
> Available in
> git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
> perf/stat-metrics-13

this looks like great test candidate for the testing
suite Michael is working on.. CC-ed

thanks,
jirka


Re: perf, tools: Refactor and support interval and CSV metrics

2016-01-22 Thread Jiri Olsa
On Tue, Jan 19, 2016 at 06:26:43PM -0800, Andi Kleen wrote:
> [v5: Fix mainly bisect problems. No regressions introduced by one
> patch and fixed again later. Some minor fixes in addition]
> [v6: Fix running/noise printing patch.]
> [v7: Reorder and merge two patches to avoid a bisect hole where unsupported 
> was
> printed as 0]
> [v8: Minor fixes for review feedback. See changelog in patches.]
> [v9: Fix newline bug. Add support for -A for --metric-only]
> 
> Currently perf stat does not support printing computed metrics for interval 
> (-I xxx)
> or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful 
> to know.
> 
> This patch implements them. The main obstacle was that the
> metrics printing was all open coded all over the metrics computation code.
> The second patch refactors the metrics printing to work through call backs 
> that
> can be more easily changed. This also cleans up the metrics printing 
> significantly.
> The indentation is now handled through printf, no more need to manually count 
> spaces.
> 
> Then based on that it implements metrics printing for CSV and interval mode,
> and finally a --metric-only mode.
> 
> Example output:
> 
> % perf stat  -I1000 -a sleep 1
> #  time  counts unit eventsmetric 
>  multiplex
>  1.001301370   12020.049593  task-clock (msec)
>  (100.00%)
>  1.001301370  3,952  context-switches  #0.329 
> K/sec(100.00%)
>  1.001301370 69  cpu-migrations#0.006 
> K/sec(100.00%)
>  1.001301370 76  page-faults   #0.006 
> K/sec  
>  1.001301370386,582,789  cycles#0.032 
> GHz  (100.00%)
>  1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
> frontend cycles idle (100.00%)
>  1.001301370  stalled-cycles-backend   
>  1.001301370101,751,678  instructions  #0.26  
> insn per cycle 
>  1.001301370   #7.04  
> stalled cycles per insn  (100.00%)
>  1.001301370 20,914,692  branches  #1.740 
> M/sec(100.00%)
>  1.001301370  1,943,630  branch-misses #9.29% 
> of all branches
> 
> CSV mode
> 
> % perf stat  -x, -I1000 -a sleep 1
>  1.000852081,12016.143006,,task-clock
>  1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
>  1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
>  1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
>  1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
>  
> 1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
>  cycles idle
>  1.000852081,,,stalled-cycles-backend,0,100.00
>  1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per 
> cycle
>  1.00085208112011130729,100.00,8.83,stalled cycles per insn
>  1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
>  1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all 
> branches
> 
> Available in
> git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
> perf/stat-metrics-13

this looks like great test candidate for the testing
suite Michael is working on.. CC-ed

thanks,
jirka


perf, tools: Refactor and support interval and CSV metrics v7

2015-12-14 Thread Andi Kleen
Rebased tree and fixed Jiri's last feedback.

[v4: Addressed all review feedback.]
[v3: Addressed all review feedback. Update manpage for CSV. Various changes
 (see individual patches). Remove some more redundant code 
 in printout callers.]
[v2: Addressed (near) all review feedback. No manpage updates so far.
 Add support for --per-core metrics. Various cleanups.]
[v3: Everything compiles again. Some more cleanups.]
[v4: Split up abstract metrics patch into two. Fix bug with earlier
patch already enabling metrics for CSV/interval. Minor cleanups.
Man page is included]
[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]
[v6: Fix running/noise printing patch.]
[v7: Reorder and merge two patches to avoid a bisect hole where unsupported was
printed as 0]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches

Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
perf/stat-metrics-11
--
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/


perf, tools: Refactor and support interval and CSV metrics v7

2015-12-14 Thread Andi Kleen
Rebased tree and fixed Jiri's last feedback.

[v4: Addressed all review feedback.]
[v3: Addressed all review feedback. Update manpage for CSV. Various changes
 (see individual patches). Remove some more redundant code 
 in printout callers.]
[v2: Addressed (near) all review feedback. No manpage updates so far.
 Add support for --per-core metrics. Various cleanups.]
[v3: Everything compiles again. Some more cleanups.]
[v4: Split up abstract metrics patch into two. Fix bug with earlier
patch already enabling metrics for CSV/interval. Minor cleanups.
Man page is included]
[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]
[v6: Fix running/noise printing patch.]
[v7: Reorder and merge two patches to avoid a bisect hole where unsupported was
printed as 0]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches

Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
perf/stat-metrics-11
--
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: perf, tools: Refactor and support interval and CSV metrics v6

2015-11-04 Thread Andi Kleen
On Tue, Nov 03, 2015 at 08:46:16AM +0100, Jiri Olsa wrote:
> On Mon, Nov 02, 2015 at 05:50:19PM -0800, Andi Kleen wrote:
> > [v4: Addressed all review feedback.]
> > [v3: Addressed all review feedback. Update manpage for CSV. Various changes
> >  (see individual patches). Remove some more redundant code 
> >  in printout callers.]
> > [v2: Addressed (near) all review feedback. No manpage updates so far.
> >  Add support for --per-core metrics. Various cleanups.]
> > [v3: Everything compiles again. Some more cleanups.]
> > [v4: Split up abstract metrics patch into two. Fix bug with earlier
> > patch already enabling metrics for CSV/interval. Minor cleanups.
> > Man page is included]
> > [v5: Fix mainly bisect problems. No regressions introduced by one
> > patch and fixed again later. Some minor fixes in addition]
> > [v6: Fix running/noise printing patch.]
> 
> I like the list.. starting with v4 goes down to v2 and raise again to v6 ;-)

Oops. I switched order at some point. Will fix.

-Andi
> 
> I'll try to check it this week
> 
> thanks,
> jirka
> 

-- 
a...@linux.intel.com -- Speaking for myself only.
--
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: perf, tools: Refactor and support interval and CSV metrics v6

2015-11-04 Thread Andi Kleen
On Tue, Nov 03, 2015 at 08:46:16AM +0100, Jiri Olsa wrote:
> On Mon, Nov 02, 2015 at 05:50:19PM -0800, Andi Kleen wrote:
> > [v4: Addressed all review feedback.]
> > [v3: Addressed all review feedback. Update manpage for CSV. Various changes
> >  (see individual patches). Remove some more redundant code 
> >  in printout callers.]
> > [v2: Addressed (near) all review feedback. No manpage updates so far.
> >  Add support for --per-core metrics. Various cleanups.]
> > [v3: Everything compiles again. Some more cleanups.]
> > [v4: Split up abstract metrics patch into two. Fix bug with earlier
> > patch already enabling metrics for CSV/interval. Minor cleanups.
> > Man page is included]
> > [v5: Fix mainly bisect problems. No regressions introduced by one
> > patch and fixed again later. Some minor fixes in addition]
> > [v6: Fix running/noise printing patch.]
> 
> I like the list.. starting with v4 goes down to v2 and raise again to v6 ;-)

Oops. I switched order at some point. Will fix.

-Andi
> 
> I'll try to check it this week
> 
> thanks,
> jirka
> 

-- 
a...@linux.intel.com -- Speaking for myself only.
--
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: perf, tools: Refactor and support interval and CSV metrics v6

2015-11-02 Thread Jiri Olsa
On Mon, Nov 02, 2015 at 05:50:19PM -0800, Andi Kleen wrote:
> [v4: Addressed all review feedback.]
> [v3: Addressed all review feedback. Update manpage for CSV. Various changes
>  (see individual patches). Remove some more redundant code 
>  in printout callers.]
> [v2: Addressed (near) all review feedback. No manpage updates so far.
>  Add support for --per-core metrics. Various cleanups.]
> [v3: Everything compiles again. Some more cleanups.]
> [v4: Split up abstract metrics patch into two. Fix bug with earlier
> patch already enabling metrics for CSV/interval. Minor cleanups.
> Man page is included]
> [v5: Fix mainly bisect problems. No regressions introduced by one
> patch and fixed again later. Some minor fixes in addition]
> [v6: Fix running/noise printing patch.]

I like the list.. starting with v4 goes down to v2 and raise again to v6 ;-)

I'll try to check it this week

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/


perf, tools: Refactor and support interval and CSV metrics v6

2015-11-02 Thread Andi Kleen
[v4: Addressed all review feedback.]
[v3: Addressed all review feedback. Update manpage for CSV. Various changes
 (see individual patches). Remove some more redundant code 
 in printout callers.]
[v2: Addressed (near) all review feedback. No manpage updates so far.
 Add support for --per-core metrics. Various cleanups.]
[v3: Everything compiles again. Some more cleanups.]
[v4: Split up abstract metrics patch into two. Fix bug with earlier
patch already enabling metrics for CSV/interval. Minor cleanups.
Man page is included]
[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]
[v6: Fix running/noise printing patch.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches

Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
perf/stat-metrics-10
--
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: perf, tools: Refactor and support interval and CSV metrics v6

2015-11-02 Thread Jiri Olsa
On Mon, Nov 02, 2015 at 05:50:19PM -0800, Andi Kleen wrote:
> [v4: Addressed all review feedback.]
> [v3: Addressed all review feedback. Update manpage for CSV. Various changes
>  (see individual patches). Remove some more redundant code 
>  in printout callers.]
> [v2: Addressed (near) all review feedback. No manpage updates so far.
>  Add support for --per-core metrics. Various cleanups.]
> [v3: Everything compiles again. Some more cleanups.]
> [v4: Split up abstract metrics patch into two. Fix bug with earlier
> patch already enabling metrics for CSV/interval. Minor cleanups.
> Man page is included]
> [v5: Fix mainly bisect problems. No regressions introduced by one
> patch and fixed again later. Some minor fixes in addition]
> [v6: Fix running/noise printing patch.]

I like the list.. starting with v4 goes down to v2 and raise again to v6 ;-)

I'll try to check it this week

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/


perf, tools: Refactor and support interval and CSV metrics v6

2015-11-02 Thread Andi Kleen
[v4: Addressed all review feedback.]
[v3: Addressed all review feedback. Update manpage for CSV. Various changes
 (see individual patches). Remove some more redundant code 
 in printout callers.]
[v2: Addressed (near) all review feedback. No manpage updates so far.
 Add support for --per-core metrics. Various cleanups.]
[v3: Everything compiles again. Some more cleanups.]
[v4: Split up abstract metrics patch into two. Fix bug with earlier
patch already enabling metrics for CSV/interval. Minor cleanups.
Man page is included]
[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]
[v6: Fix running/noise printing patch.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches

Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
perf/stat-metrics-10
--
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/


perf, tools: Refactor and support interval and CSV metrics v5

2015-10-23 Thread Andi Kleen
I hope this version is acceptable now.

[v4: Addressed all review feedback.]
[v3: Addressed all review feedback. Update manpage for CSV. Various changes
 (see individual patches). Remove some more redundant code 
 in printout callers.]
[v2: Addressed (near) all review feedback. No manpage updates so far.
 Add support for --per-core metrics. Various cleanups.]
[v3: Everything compiles again. Some more cleanups.]
[v4: Split up abstract metrics patch into two. Fix bug with earlier
patch already enabling metrics for CSV/interval. Minor cleanups.
Man page is included]
[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.

Then based on that it implements metrics printing for CSV and interval mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches

Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
perf/stat-metrics-9
--
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/


perf, tools: Refactor and support interval and CSV metrics v5

2015-10-23 Thread Andi Kleen
I hope this version is acceptable now.

[v4: Addressed all review feedback.]
[v3: Addressed all review feedback. Update manpage for CSV. Various changes
 (see individual patches). Remove some more redundant code 
 in printout callers.]
[v2: Addressed (near) all review feedback. No manpage updates so far.
 Add support for --per-core metrics. Various cleanups.]
[v3: Everything compiles again. Some more cleanups.]
[v4: Split up abstract metrics patch into two. Fix bug with earlier
patch already enabling metrics for CSV/interval. Minor cleanups.
Man page is included]
[v5: Fix mainly bisect problems. No regressions introduced by one
patch and fixed again later. Some minor fixes in addition]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.

Then based on that it implements metrics printing for CSV and interval mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches

Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
perf/stat-metrics-9
--
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/


perf, tools: Refactor and support interval and CSV metrics v4

2015-09-21 Thread Andi Kleen
[v4: Addressed all review feedback.]
[v3: Addressed all review feedback. Update manpage for CSV. Various changes
 (see individual patches). Remove some more redundant code 
 in printout callers.]
[v2: Addressed (near) all review feedback. No manpage updates so far.
 Add support for --per-core metrics. Various cleanups.]
[v3: Everything compiles again. Some more cleanups.]
[v4: Split up abstract metrics patch into two. Fix bug with earlier
patch already enabling metrics for CSV/interval. Minor cleanups.
Man page is included]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches

Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
perf/stat-metrics-8
--
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/


perf, tools: Refactor and support interval and CSV metrics v4

2015-09-21 Thread Andi Kleen
[v4: Addressed all review feedback.]
[v3: Addressed all review feedback. Update manpage for CSV. Various changes
 (see individual patches). Remove some more redundant code 
 in printout callers.]
[v2: Addressed (near) all review feedback. No manpage updates so far.
 Add support for --per-core metrics. Various cleanups.]
[v3: Everything compiles again. Some more cleanups.]
[v4: Split up abstract metrics patch into two. Fix bug with earlier
patch already enabling metrics for CSV/interval. Minor cleanups.
Man page is included]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches

Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
perf/stat-metrics-8
--
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/


perf, tools: Refactor and support interval and CSV metrics v4

2015-09-04 Thread Andi Kleen
[v4: Addressed all review feedback.]
[v3: Addressed all review feedback. Update manpage for CSV. Various changes
 (see individual patches). Remove some more redundant code 
 in printout callers.]
[v2: Addressed (near) all review feedback. No manpage updates so far.
 Add support for --per-core metrics. Various cleanups.]
[v3: Everything compiles again. Some more cleanups.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches

Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
perf/stat-metrics-6
--
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/


perf, tools: Refactor and support interval and CSV metrics v4

2015-09-04 Thread Andi Kleen
[v4: Addressed all review feedback.]
[v3: Addressed all review feedback. Update manpage for CSV. Various changes
 (see individual patches). Remove some more redundant code 
 in printout callers.]
[v2: Addressed (near) all review feedback. No manpage updates so far.
 Add support for --per-core metrics. Various cleanups.]
[v3: Everything compiles again. Some more cleanups.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches

Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
perf/stat-metrics-6
--
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: perf, tools: Refactor and support interval and CSV metrics v3

2015-09-03 Thread Andi Kleen
> can't see perf/stat-metrics-5 branch
> 
> [jolsa@krava perf]$ git remote update ak
> Fetching ak
> [jolsa@krava perf]$ git branch -r | grep perf/stat-metrics-
>   ak/perf/stat-metrics-3
>   ak/perf/stat-metrics-4
>   ak/perf/stat-metrics-refactor-2
> [jolsa@krava perf]$ 

Try again.  I pushed now.

-Andi
--
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: perf, tools: Refactor and support interval and CSV metrics v3

2015-09-03 Thread Jiri Olsa
On Wed, Sep 02, 2015 at 04:35:45PM -0700, Andi Kleen wrote:
> [v3: Addressed all review feedback. Update manpage for CSV. Various changes
>  (see individual patches). Remove some more redundant code 
>  in printout callers.]
> [v2: Addressed (near) all review feedback. No manpage updates so far.
>  Add support for --per-core metrics. Various cleanups.]
> [v3: Everything compiles again. Some more cleanups.]
> 
> Currently perf stat does not support printing computed metrics for interval 
> (-I xxx)
> or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful 
> to know.
> 
> This patch implements them. The main obstacle was that the
> metrics printing was all open coded all over the metrics computation code.
> The second patch refactors the metrics printing to work through call backs 
> that
> can be more easily changed. This also cleans up the metrics printing 
> significantly.
> The indentation is now handled through printf, no more need to manually count 
> spaces.
> 
> Then based on that it implements metrics printing for CSV and interval mode.
> 
> Example output:
> 
> % perf stat  -I1000 -a sleep 1
> #  time  counts unit eventsmetric 
>  multiplex
>  1.001301370   12020.049593  task-clock (msec)
>  (100.00%)
>  1.001301370  3,952  context-switches  #0.329 
> K/sec(100.00%)
>  1.001301370 69  cpu-migrations#0.006 
> K/sec(100.00%)
>  1.001301370 76  page-faults   #0.006 
> K/sec  
>  1.001301370386,582,789  cycles#0.032 
> GHz  (100.00%)
>  1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
> frontend cycles idle (100.00%)
>  1.001301370  stalled-cycles-backend   
>  1.001301370101,751,678  instructions  #0.26  
> insn per cycle 
>  1.001301370   #7.04  
> stalled cycles per insn  (100.00%)
>  1.001301370 20,914,692  branches  #1.740 
> M/sec(100.00%)
>  1.001301370  1,943,630  branch-misses #9.29% 
> of all branches
> 
> CSV mode
> 
> % perf stat  -x, -I1000 -a sleep 1
>  1.000852081,12016.143006,,task-clock
>  1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
>  1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
>  1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
>  1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
>  
> 1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
>  cycles idle
>  1.000852081,,,stalled-cycles-backend,0,100.00
>  1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per 
> cycle
>  1.00085208112011130729,100.00,8.83,stalled cycles per insn
>  1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
>  1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all 
> branches
> 
> Available in
> git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
> perf/stat-metrics-5

can't see perf/stat-metrics-5 branch

[jolsa@krava perf]$ git remote update ak
Fetching ak
[jolsa@krava perf]$ git branch -r | grep perf/stat-metrics-
  ak/perf/stat-metrics-3
  ak/perf/stat-metrics-4
  ak/perf/stat-metrics-refactor-2
[jolsa@krava perf]$ 


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: perf, tools: Refactor and support interval and CSV metrics v3

2015-09-03 Thread Jiri Olsa
On Wed, Sep 02, 2015 at 04:35:45PM -0700, Andi Kleen wrote:
> [v3: Addressed all review feedback. Update manpage for CSV. Various changes
>  (see individual patches). Remove some more redundant code 
>  in printout callers.]
> [v2: Addressed (near) all review feedback. No manpage updates so far.
>  Add support for --per-core metrics. Various cleanups.]
> [v3: Everything compiles again. Some more cleanups.]
> 
> Currently perf stat does not support printing computed metrics for interval 
> (-I xxx)
> or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful 
> to know.
> 
> This patch implements them. The main obstacle was that the
> metrics printing was all open coded all over the metrics computation code.
> The second patch refactors the metrics printing to work through call backs 
> that
> can be more easily changed. This also cleans up the metrics printing 
> significantly.
> The indentation is now handled through printf, no more need to manually count 
> spaces.
> 
> Then based on that it implements metrics printing for CSV and interval mode.
> 
> Example output:
> 
> % perf stat  -I1000 -a sleep 1
> #  time  counts unit eventsmetric 
>  multiplex
>  1.001301370   12020.049593  task-clock (msec)
>  (100.00%)
>  1.001301370  3,952  context-switches  #0.329 
> K/sec(100.00%)
>  1.001301370 69  cpu-migrations#0.006 
> K/sec(100.00%)
>  1.001301370 76  page-faults   #0.006 
> K/sec  
>  1.001301370386,582,789  cycles#0.032 
> GHz  (100.00%)
>  1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
> frontend cycles idle (100.00%)
>  1.001301370  stalled-cycles-backend   
>  1.001301370101,751,678  instructions  #0.26  
> insn per cycle 
>  1.001301370   #7.04  
> stalled cycles per insn  (100.00%)
>  1.001301370 20,914,692  branches  #1.740 
> M/sec(100.00%)
>  1.001301370  1,943,630  branch-misses #9.29% 
> of all branches
> 
> CSV mode
> 
> % perf stat  -x, -I1000 -a sleep 1
>  1.000852081,12016.143006,,task-clock
>  1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
>  1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
>  1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
>  1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
>  
> 1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
>  cycles idle
>  1.000852081,,,stalled-cycles-backend,0,100.00
>  1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per 
> cycle
>  1.00085208112011130729,100.00,8.83,stalled cycles per insn
>  1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
>  1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all 
> branches
> 
> Available in
> git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
> perf/stat-metrics-5

can't see perf/stat-metrics-5 branch

[jolsa@krava perf]$ git remote update ak
Fetching ak
[jolsa@krava perf]$ git branch -r | grep perf/stat-metrics-
  ak/perf/stat-metrics-3
  ak/perf/stat-metrics-4
  ak/perf/stat-metrics-refactor-2
[jolsa@krava perf]$ 


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: perf, tools: Refactor and support interval and CSV metrics v3

2015-09-03 Thread Andi Kleen
> can't see perf/stat-metrics-5 branch
> 
> [jolsa@krava perf]$ git remote update ak
> Fetching ak
> [jolsa@krava perf]$ git branch -r | grep perf/stat-metrics-
>   ak/perf/stat-metrics-3
>   ak/perf/stat-metrics-4
>   ak/perf/stat-metrics-refactor-2
> [jolsa@krava perf]$ 

Try again.  I pushed now.

-Andi
--
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/


perf, tools: Refactor and support interval and CSV metrics v3

2015-09-02 Thread Andi Kleen
[v3: Addressed all review feedback. Update manpage for CSV. Various changes
 (see individual patches). Remove some more redundant code 
 in printout callers.]
[v2: Addressed (near) all review feedback. No manpage updates so far.
 Add support for --per-core metrics. Various cleanups.]
[v3: Everything compiles again. Some more cleanups.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches

Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
perf/stat-metrics-5
--
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/


perf, tools: Refactor and support interval and CSV metrics v3

2015-09-02 Thread Andi Kleen
[v3: Addressed all review feedback. Update manpage for CSV. Various changes
 (see individual patches). Remove some more redundant code 
 in printout callers.]
[v2: Addressed (near) all review feedback. No manpage updates so far.
 Add support for --per-core metrics. Various cleanups.]
[v3: Everything compiles again. Some more cleanups.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches

Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
perf/stat-metrics-5
--
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/


perf, tools: Refactor and support interval and CSV metrics v3

2015-08-07 Thread Andi Kleen

[v2: Addressed (near) all review feedback. No manpage updates so far.
 Add support for --per-core metrics. Various cleanups.]
[v3: Everything compiles again. Some more cleanups. Updated to latest tip tree.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches

Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
perf/stat-metrics-3

--
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/


perf, tools: Refactor and support interval and CSV metrics v3

2015-08-07 Thread Andi Kleen

[v2: Addressed (near) all review feedback. No manpage updates so far.
 Add support for --per-core metrics. Various cleanups.]
[v3: Everything compiles again. Some more cleanups. Updated to latest tip tree.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370not supported  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,not supported,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches

Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc-2.6 
perf/stat-metrics-3

--
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: perf, tools: Refactor and support interval and CSV metrics v2

2015-08-05 Thread Andi Kleen
> ^
> cc1: all warnings being treated as errors

Sorry mistake in refactoring. I also forgot to include one patch.

I'll fix this and repost (and also add the man page)

-Andi
--
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: perf, tools: Refactor and support interval and CSV metrics v2

2015-08-05 Thread Jiri Olsa
On Mon, Aug 03, 2015 at 05:50:00PM -0700, Andi Kleen wrote:
> [v2: Addressed (near) all review feedback. No manpage updates so far.
>  Add support for --per-core metrics. Various cleanups.]
> 
> Currently perf stat does not support printing computed metrics for interval 
> (-I xxx)
> or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful 
> to know.
> 
> This patch implements them. The main obstacle was that the
> metrics printing was all open coded all over the metrics computation code.
> The second patch refactors the metrics printing to work through call backs 
> that
> can be more easily changed. This also cleans up the metrics printing 
> significantly.
> The indentation is now handled through printf, no more need to manually count 
> spaces.
> 
> Then based on that it implements metrics printing for CSV and interval mode.
> 
> Example output:
> 
> % perf stat  -I1000 -a sleep 1
> #  time  counts unit eventsmetric 
>  multiplex
>  1.001301370   12020.049593  task-clock (msec)
>  (100.00%)
>  1.001301370  3,952  context-switches  #0.329 
> K/sec(100.00%)
>  1.001301370 69  cpu-migrations#0.006 
> K/sec(100.00%)
>  1.001301370 76  page-faults   #0.006 
> K/sec  
>  1.001301370386,582,789  cycles#0.032 
> GHz  (100.00%)
>  1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
> frontend cycles idle (100.00%)
>  1.001301370  stalled-cycles-backend   
>  1.001301370101,751,678  instructions  #0.26  
> insn per cycle 
>  1.001301370   #7.04  
> stalled cycles per insn  (100.00%)
>  1.001301370 20,914,692  branches  #1.740 
> M/sec(100.00%)
>  1.001301370  1,943,630  branch-misses #9.29% 
> of all branches
> 
> CSV mode
> 
> % perf stat  -x, -I1000 -a sleep 1
>  1.000852081,12016.143006,,task-clock
>  1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
>  1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
>  1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
>  1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
>  
> 1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
>  cycles idle
>  1.000852081,,,stalled-cycles-backend,0,100.00
>  1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per 
> cycle
>  1.00085208112011130729,100.00,8.83,stalled cycles per insn
>  1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
>  1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all 
> branches
> 
> 
> Available in
> git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc 
> perf/stat-metrics-2

got build failure:

  CC   builtin-stat.o
builtin-stat.c: In function ‘aggr_update_shadow’:
builtin-stat.c:848:10: error: implicit declaration of function ‘scale_val’ 
[-Werror=implicit-function-declaration]
val = scale_val(counter, val);
  ^
builtin-stat.c:848:4: error: nested extern declaration of ‘scale_val’ 
[-Werror=nested-externs]
val = scale_val(counter, val);
^
cc1: all warnings being treated as errors
/home/jolsa/kernel/linux-perf/tools/build/Makefile.build:68: recipe for target 
'builtin-stat.o' failed
make[2]: *** [builtin-stat.o] Error 1
Makefile.perf:296: recipe for target 'perf-in.o' failed
make[1]: *** [perf-in.o] Error 2
Makefile:68: recipe for target 'all' failed
make: *** [all] Error 2


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: perf, tools: Refactor and support interval and CSV metrics v2

2015-08-05 Thread Jiri Olsa
On Mon, Aug 03, 2015 at 05:50:00PM -0700, Andi Kleen wrote:
 [v2: Addressed (near) all review feedback. No manpage updates so far.
  Add support for --per-core metrics. Various cleanups.]
 
 Currently perf stat does not support printing computed metrics for interval 
 (-I xxx)
 or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful 
 to know.
 
 This patch implements them. The main obstacle was that the
 metrics printing was all open coded all over the metrics computation code.
 The second patch refactors the metrics printing to work through call backs 
 that
 can be more easily changed. This also cleans up the metrics printing 
 significantly.
 The indentation is now handled through printf, no more need to manually count 
 spaces.
 
 Then based on that it implements metrics printing for CSV and interval mode.
 
 Example output:
 
 % perf stat  -I1000 -a sleep 1
 #  time  counts unit eventsmetric 
  multiplex
  1.001301370   12020.049593  task-clock (msec)
  (100.00%)
  1.001301370  3,952  context-switches  #0.329 
 K/sec(100.00%)
  1.001301370 69  cpu-migrations#0.006 
 K/sec(100.00%)
  1.001301370 76  page-faults   #0.006 
 K/sec  
  1.001301370386,582,789  cycles#0.032 
 GHz  (100.00%)
  1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
 frontend cycles idle (100.00%)
  1.001301370not supported  stalled-cycles-backend   
  1.001301370101,751,678  instructions  #0.26  
 insn per cycle 
  1.001301370   #7.04  
 stalled cycles per insn  (100.00%)
  1.001301370 20,914,692  branches  #1.740 
 M/sec(100.00%)
  1.001301370  1,943,630  branch-misses #9.29% 
 of all branches
 
 CSV mode
 
 % perf stat  -x, -I1000 -a sleep 1
  1.000852081,12016.143006,,task-clock
  1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
  1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
  1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
  1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
  
 1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
  cycles idle
  1.000852081,not supported,,stalled-cycles-backend,0,100.00
  1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per 
 cycle
  1.00085208112011130729,100.00,8.83,stalled cycles per insn
  1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
  1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all 
 branches
 
 
 Available in
 git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc 
 perf/stat-metrics-2

got build failure:

  CC   builtin-stat.o
builtin-stat.c: In function ‘aggr_update_shadow’:
builtin-stat.c:848:10: error: implicit declaration of function ‘scale_val’ 
[-Werror=implicit-function-declaration]
val = scale_val(counter, val);
  ^
builtin-stat.c:848:4: error: nested extern declaration of ‘scale_val’ 
[-Werror=nested-externs]
val = scale_val(counter, val);
^
cc1: all warnings being treated as errors
/home/jolsa/kernel/linux-perf/tools/build/Makefile.build:68: recipe for target 
'builtin-stat.o' failed
make[2]: *** [builtin-stat.o] Error 1
Makefile.perf:296: recipe for target 'perf-in.o' failed
make[1]: *** [perf-in.o] Error 2
Makefile:68: recipe for target 'all' failed
make: *** [all] Error 2


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: perf, tools: Refactor and support interval and CSV metrics v2

2015-08-05 Thread Andi Kleen
 ^
 cc1: all warnings being treated as errors

Sorry mistake in refactoring. I also forgot to include one patch.

I'll fix this and repost (and also add the man page)

-Andi
--
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/


perf, tools: Refactor and support interval and CSV metrics v2

2015-08-03 Thread Andi Kleen
[v2: Addressed (near) all review feedback. No manpage updates so far.
 Add support for --per-core metrics. Various cleanups.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches


Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc perf/stat-metrics-2
--
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/


perf, tools: Refactor and support interval and CSV metrics v2

2015-08-03 Thread Andi Kleen
[v2: Addressed (near) all review feedback. No manpage updates so far.
 Add support for --per-core metrics. Various cleanups.]

Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370not supported  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,not supported,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches


Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc perf/stat-metrics-2
--
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/


perf, tools: Refactor and support interval and CSV metrics

2015-07-29 Thread Andi Kleen
Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches

Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc perf/stat-metrics

Note: for some of the --per-*/-A modes metrics are not printed correctly. That
was already the case before, so I didn't change it. I think some of it
may be related to Jiri's earlier stat changes.

--
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/


perf, tools: Refactor and support interval and CSV metrics

2015-07-29 Thread Andi Kleen
Currently perf stat does not support printing computed metrics for interval (-I 
xxx)
or CSV (-x,) mode. For example IPC or TSX metrics over time are quite useful to 
know.

This patch implements them. The main obstacle was that the
metrics printing was all open coded all over the metrics computation code.
The second patch refactors the metrics printing to work through call backs that
can be more easily changed. This also cleans up the metrics printing 
significantly.
The indentation is now handled through printf, no more need to manually count 
spaces.

Then based on that it implements metrics printing for CSV and interval mode.

Example output:

% perf stat  -I1000 -a sleep 1
#  time  counts unit eventsmetric   
   multiplex
 1.001301370   12020.049593  task-clock (msec)  
   (100.00%)
 1.001301370  3,952  context-switches  #0.329 
K/sec(100.00%)
 1.001301370 69  cpu-migrations#0.006 
K/sec(100.00%)
 1.001301370 76  page-faults   #0.006 
K/sec  
 1.001301370386,582,789  cycles#0.032 
GHz  (100.00%)
 1.001301370716,441,544  stalled-cycles-frontend   #  185.33% 
frontend cycles idle (100.00%)
 1.001301370not supported  stalled-cycles-backend   
 1.001301370101,751,678  instructions  #0.26  
insn per cycle 
 1.001301370   #7.04  
stalled cycles per insn  (100.00%)
 1.001301370 20,914,692  branches  #1.740 
M/sec(100.00%)
 1.001301370  1,943,630  branch-misses #9.29% 
of all branches

CSV mode

% perf stat  -x, -I1000 -a sleep 1
 1.000852081,12016.143006,,task-clock
 1.000852081,4457,,context-switches,12015168277,100.00,0.371,K/sec
 1.000852081,50,,cpu-migrations,12014024424,100.00,0.004,K/sec
 1.000852081,76,,page-faults,12013076716,100.00,0.006,K/sec
 1.000852081,515854373,,cycles,12011235336,100.00,0.043,GHz
 
1.000852081,1030742150,,stalled-cycles-frontend,12010984057,100.00,199.81,frontend
 cycles idle
 1.000852081,not supported,,stalled-cycles-backend,0,100.00
 1.000852081,116782495,,instructions,12011130729,100.00,0.23,insn per cycle
 1.00085208112011130729,100.00,8.83,stalled cycles per insn
 1.000852081,23748237,,branches,12010745125,100.00,1.976,M/sec
 1.000852081,1976560,,branch-misses,12010501884,100.00,8.32,of all branches

Available in
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc perf/stat-metrics

Note: for some of the --per-*/-A modes metrics are not printed correctly. That
was already the case before, so I didn't change it. I think some of it
may be related to Jiri's earlier stat changes.

--
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/