linux/tools/perf/Documentation
Jiri Olsa 32b8af82e3 perf stat: Introduce --per-thread option
Currently all the -p option PID arguments tasks values get aggregated
and printed as single values.

Adding --per-tasks option to print values per task.

  $ perf stat  -e cycles,instructions --per-thread -p 30190,30242
  ^C
   Performance counter stats for process id '30190,30242':

               cat-30190                     0      cycles
               yes-30242         3,842,525,421      cycles
               cat-30190                     0      instructions
               yes-30242        10,370,817,010      instructions

         1.143155657 seconds time elapsed

Also works under interval mode:

  $ perf stat  -e cycles,instructions --per-thread -p 30190,30242 -I 1000
  #           time             comm-pid                  counts unit events
       1.000073435              cat-30190                89,058      cycles
       1.000073435              yes-30242         3,360,786,902      cycles                     (100.00%)
       1.000073435              cat-30190                14,066      instructions
       1.000073435              yes-30242         9,069,937,462      instructions
       2.000204830              cat-30190                     0      cycles
       2.000204830              yes-30242         3,351,667,626      cycles
       2.000204830              cat-30190                     0      instructions
       2.000204830              yes-30242         9,045,796,885      instructions
  ^C     2.771286639              cat-30190                     0      cycles
       2.771286639              yes-30242         2,593,884,166      cycles
       2.771286639              cat-30190                     0      instructions
       2.771286639              yes-30242         7,001,171,191      instructions

It works only with -t and -p options, otherwise following error is
printed:

  $ perf stat  -e cycles --per-thread  -I 1000 ls
  The --per-thread option is only available when monitoring via -p -t options.
      -p, --pid <pid>       stat events on existing process id
      -t, --tid <tid>       stat events on existing thread id

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1435310967-14570-23-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-06-26 12:05:04 -03:00
..
android.txt perf tools: Add info about cross compiling for Android ARM 2012-10-31 12:17:49 -02:00
asciidoc.conf perf_counter tools: Move from Documentation/perf_counter/ to tools/perf/ 2009-06-06 20:33:43 +02:00
Build.txt perf build: Add build documentation 2015-02-12 17:53:00 -03:00
callchain-overhead-calculation.txt perf tools: Document --children option in more detail 2015-04-29 10:38:06 -03:00
examples.txt perf record: Remove -f/--force option 2013-07-08 17:37:25 -03:00
jit-interface.txt perf symbols: Add description of JIT interface 2012-08-13 14:55:02 -03:00
Makefile perf tools: Implement summary output for 'make install' 2013-10-11 12:18:11 -03:00
manpage-1.72.xsl perf_counter tools: Move from Documentation/perf_counter/ to tools/perf/ 2009-06-06 20:33:43 +02:00
manpage-base.xsl perf_counter tools: Move from Documentation/perf_counter/ to tools/perf/ 2009-06-06 20:33:43 +02:00
manpage-bold-literal.xsl perf_counter tools: Move from Documentation/perf_counter/ to tools/perf/ 2009-06-06 20:33:43 +02:00
manpage-normal.xsl perf_counter tools: Move from Documentation/perf_counter/ to tools/perf/ 2009-06-06 20:33:43 +02:00
manpage-suppress-sp.xsl perf_counter tools: Move from Documentation/perf_counter/ to tools/perf/ 2009-06-06 20:33:43 +02:00
perf-annotate.txt perf annotate: Add basic support to event group view 2013-03-15 13:06:05 -03:00
perf-archive.txt perf archive: Remove duplicated 'runs' in man page 2013-12-09 15:21:45 -03:00
perf-bench.txt perf bench futex: Support parallel waker threads 2015-05-08 16:23:50 -03:00
perf-buildid-cache.txt perf buildid-cache: Add --purge FILE to remove all caches of FILE 2015-02-27 15:52:33 -03:00
perf-buildid-list.txt perf report: Accept fifos as input file 2011-12-23 17:01:03 -02:00
perf-data.txt perf data: Add perf data to CTF conversion support 2015-02-25 16:13:12 -03:00
perf-diff.txt perf diff: Add kallsyms option 2015-03-24 13:01:54 -03:00
perf-evlist.txt perf evlist: Add --group option 2013-01-31 13:07:49 -03:00
perf-help.txt perf_counter tools: Move from Documentation/perf_counter/ to tools/perf/ 2009-06-06 20:33:43 +02:00
perf-inject.txt perf auxtrace: Add option to synthesize events for transactions 2015-05-05 18:12:55 -03:00
perf-kmem.txt perf kmem: Add --live option for current allocation stat 2015-05-04 13:34:47 -03:00
perf-kvm.txt perf tools: Configurable per thread proc map processing time out 2015-06-19 18:27:13 -03:00
perf-list.txt perf tools: Add 'I' event modifier for exclude_idle bit 2015-04-08 11:00:16 -03:00
perf-lock.txt perf lock: Account for lock average wait time 2013-10-09 11:24:01 -03:00
perf-mem.txt perf mem: Enable sampling loads and stores simultaneously 2015-01-21 13:24:31 -03:00
perf-probe.txt perf probe: Add --no-inlines option to avoid searching inline functions 2015-05-08 16:26:44 -03:00
perf-record.txt perf tools: Configurable per thread proc map processing time out 2015-06-19 18:27:13 -03:00
perf-report.txt perf tools: Document relation of per-thread event count feature 2015-05-12 09:59:48 -03:00
perf-sched.txt perf report: Accept fifos as input file 2011-12-23 17:01:03 -02:00
perf-script-perl.txt perf Documentation: Fix typos in perf/Documentation 2014-10-15 17:39:02 -03:00
perf-script-python.txt perf Documentation: Fix typos in perf/Documentation 2014-10-15 17:39:02 -03:00
perf-script.txt perf auxtrace: Add option to synthesize events for transactions 2015-05-05 18:12:55 -03:00
perf-stat.txt perf stat: Introduce --per-thread option 2015-06-26 12:05:04 -03:00
perf-test.txt perf Documentation: Fix typos in perf/Documentation 2014-10-15 17:39:02 -03:00
perf-timechart.txt perf timechart: Add more options to IO mode 2014-07-10 00:22:54 +02:00
perf-top.txt perf tools: Configurable per thread proc map processing time out 2015-06-19 18:27:13 -03:00
perf-trace.txt perf tools: Configurable per thread proc map processing time out 2015-06-19 18:27:13 -03:00
perf.txt perf data: Add perf data to CTF conversion support 2015-02-25 16:13:12 -03:00
perfconfig.example perf annotate browser: Read perf config file for settings 2012-05-29 22:06:30 -03:00