1. 18 8月, 2011 1 次提交
    • S
      perf stat: Add -o and --append options · 4aa9015f
      Stephane Eranian 提交于
      This patch adds an option (-o) to save the output of perf stat into a
      file. You could do this with perf record but not with perf stat.
      Instead, you had to fiddle with stderr to save the counts into a
      separate file.
      
      The patch also adds the --append option so that results can be
      concatenated into a single file across runs. Each run of the tool is
      clearly separated by a comment line starting with a hash mark. The -A
      option of perf record is already used by perf stat, so we only add a
      long option.
      
      $ perf stat -o res.txt date
      $ cat res.txt
      
       Performance counter stats for 'date':
      
                0.791306 task-clock                #    0.668 CPUs utilized
                       2 context-switches          #    0.003 M/sec
                       0 CPU-migrations            #    0.000 M/sec
                     197 page-faults               #    0.249 M/sec
                 1878143 cycles                    #    2.373 GHz
         <not supported> stalled-cycles-frontend
         <not supported> stalled-cycles-backend
                 1083367 instructions              #    0.58  insns per cycle
                  193027 branches                  #  243.935 M/sec
                    9014 branch-misses             #    4.67% of all branches
      
             0.001184746 seconds time elapsed
      
      The option can be combined with -x to make the output file much easier
      to parse.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20110815202233.GA18535@quadSigned-off-by: NStephane Eranian <eranian@google.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4aa9015f
  2. 16 2月, 2011 1 次提交
    • S
      perf tool: Add cgroup support · 023695d9
      Stephane Eranian 提交于
      This patch adds the ability to filter monitoring based on container groups
      (cgroups) for both perf stat and perf record. It is possible to monitor
      multiple cgroup in parallel. There is one cgroup per event. The cgroups to
      monitor are passed via a new -G option followed by a comma separated list of
      cgroup names.
      
      The cgroup filesystem has to be mounted. Given a cgroup name, the perf tool
      finds the corresponding directory in the cgroup filesystem and opens it. It
      then passes that file descriptor to the kernel.
      
      Example:
      
      $ perf stat -B -a -e cycles:u,cycles:u,cycles:u -G test1,,test2 -- sleep 1
       Performance counter stats for 'sleep 1':
      
            2,368,667,414  cycles                   test1
            2,369,661,459  cycles
            <not counted>  cycles                   test2
      
              1.001856890  seconds time elapsed
      Signed-off-by: NStephane Eranian <eranian@google.com>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <4d590290.825bdf0a.7d0a.4890@mx.google.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      023695d9
  3. 02 12月, 2010 2 次提交
    • S
      perf stat: Add csv-style output · d7470b6a
      Stephane Eranian 提交于
      This patch adds an option (-x/--field-separator) to print counts using a
      CSV-style output. The user can pass a custom separator. This makes it very easy
      to import counts directly into your favorite spreadsheet without having to
      write scripts.
      
      Example:
      $ perf stat --field-separator=,  -a -- sleep 1
      4009.961740,task-clock-msecs
      13,context-switches
      2,CPU-migrations
      189,page-faults
      9596385684,cycles
      3493659441,instructions
      872897069,branches
      41562,branch-misses
      22424,cache-references
      1289,cache-misses
      
      Works also in non-aggregated mode:
      
      $ perf stat -x ,  -a -A -- sleep 1
      CPU0,1002.526168,task-clock-msecs
      CPU1,1002.528365,task-clock-msecs
      CPU2,1002.523360,task-clock-msecs
      CPU3,1002.519878,task-clock-msecs
      CPU0,1,context-switches
      CPU1,5,context-switches
      CPU2,5,context-switches
      CPU3,6,context-switches
      CPU0,0,CPU-migrations
      CPU1,1,CPU-migrations
      CPU2,0,CPU-migrations
      CPU3,1,CPU-migrations
      CPU0,2,page-faults
      CPU1,6,page-faults
      CPU2,9,page-faults
      CPU3,174,page-faults
      CPU0,2399439771,cycles
      CPU1,2380369063,cycles
      CPU2,2399142710,cycles
      CPU3,2373161192,cycles
      CPU0,872900618,instructions
      CPU1,873030960,instructions
      CPU2,872714525,instructions
      CPU3,874460580,instructions
      CPU0,221556839,branches
      CPU1,218134342,branches
      CPU2,218161730,branches
      CPU3,218284093,branches
      CPU0,18556,branch-misses
      CPU1,1449,branch-misses
      CPU2,3447,branch-misses
      CPU3,12714,branch-misses
      CPU0,8330,cache-references
      CPU1,313844,cache-references
      CPU2,47993728,cache-references
      CPU3,826481,cache-references
      CPU0,272,cache-misses
      CPU1,5360,cache-misses
      CPU2,1342193,cache-misses
      CPU3,13992,cache-misses
      
      This second version adds the ability to name a separator and uses
      field-separator as the long option to be consistent with perf report.
      
      Commiter note: Since we enabled --big-num by default in 201e0b06 and -x can't be
      used with it, we need to notice if the user explicitely enabled or disabled -B,
      add code to disable big_num if the user didn't explicitely set --big_num when
      -x is used.
      
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Frederik Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: paulus@samba.org
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Richter <robert.richter@amd.com>
      LKML-Reference: <4cf68aa7.0fedd80a.5294.1203@mx.google.com>
      Signed-off-by: NStephane Eranian <eranian@google.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d7470b6a
    • S
      perf stat: Document missing options · 8c207692
      Shawn Bohrer 提交于
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <1291168642-11402-12-git-send-email-shawn.bohrer@gmail.com>
      Signed-off-by: NShawn Bohrer <shawn.bohrer@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8c207692
  4. 20 11月, 2010 1 次提交
    • S
      perf stat: Add no-aggregation mode to -a · f5b4a9c3
      Stephane Eranian 提交于
      This patch adds a new -A option to perf stat. If specified then perf stat does
      not aggregate counts across all monitored CPUs in system-wide mode, i.e., when
      using -a. This option is not supported in per-thread mode.
      
      Being able to get a per-cpu breakdown is useful to detect imbalances between
      CPUs when running a uniform workload than spans all monitored CPUs.
      
      The second version corrects the missing cpumap[] support, so that it works when
      the -C option is used.
      
      The third version fixes a missing cpumap[] in print_counter() and removes a
      stray patch in builtin-trace.c.
      
      Examples on a 4-way system:
      
      # perf stat -a   -e cycles,instructions -- sleep 1
       Performance counter stats for 'sleep 1':
               9592808135  cycles
               3490380006  instructions             #      0.364 IPC
              1.001584632  seconds time elapsed
      
      # perf stat -a -A -e cycles,instructions -- sleep 1
       Performance counter stats for 'sleep 1':
      CPU0            2398163767  cycles
      CPU1            2398180817  cycles
      CPU2            2398217115  cycles
      CPU3            2398247483  cycles
      CPU0             872282046  instructions             #      0.364 IPC
      CPU1             873481776  instructions             #      0.364 IPC
      CPU2             872638127  instructions             #      0.364 IPC
      CPU3             872437789  instructions             #      0.364 IPC
              1.001556052  seconds time elapsed
      
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Richter <robert.richter@amd.com>
      LKML-Reference: <4ce257b5.1e07e30a.7b6b.3aa9@mx.google.com>
      Signed-off-by: NStephane Eranian <eranian@google.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f5b4a9c3
  5. 05 6月, 2010 1 次提交
    • S
      perf tools: Add the ability to specify list of cpus to monitor · c45c6ea2
      Stephane Eranian 提交于
      This patch adds a -C option to stat, record, top to designate a list of CPUs to
      monitor. CPUs can be specified as a comma-separated list or ranges, no space
      allowed.
      
      Examples:
      $ perf record -a -C0-1,4-7 sleep 1
      $ perf top -C0-4
      $ perf stat -a -C1,2,3,4 sleep 1
      
      With perf record in per-thread mode with inherit mode on, samples are collected
      only when the thread runs on the designated CPUs.
      
      The -C option does not turn on system-wide mode automatically.
      
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <4bff9496.d345d80a.41fe.7b00@mx.google.com>
      Signed-off-by: NStephane Eranian <eranian@google.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c45c6ea2
  6. 19 5月, 2010 1 次提交
    • S
      perf stat: add perf stat -B to pretty print large numbers · 5af52b51
      Stephane Eranian 提交于
      It is hard to read very large numbers so provide an option to perf stat
      to separate thousands using a separator. The patch leverages the locale
      support of stdio. You need to set your LC_NUMERIC appropriately, for
      instance LC_NUMERIC=en_US.UTF8. You need to pass -B to activate this
      feature. This way existing scripts parsing the output do not need to be
      changed. Here is an example.
      
      $ perf stat noploop 2
      noploop for 2 seconds
      
       Performance counter stats for 'noploop 2':
      
              1998.347031  task-clock-msecs         #      0.998 CPUs
                       61  context-switches         #      0.000 M/sec
                        0  CPU-migrations           #      0.000 M/sec
                      118  page-faults              #      0.000 M/sec
            4,138,410,900  cycles                   #   2070.917 M/sec  (scaled from 70.01%)
            2,062,650,268  instructions             #      0.498 IPC    (scaled from 70.01%)
            2,057,653,466  branches                 #   1029.678 M/sec  (scaled from 70.01%)
                   40,267  branch-misses            #      0.002 %      (scaled from 30.04%)
            2,055,961,348  cache-references         #   1028.831 M/sec  (scaled from 30.03%)
                   53,725  cache-misses             #      0.027 M/sec  (scaled from 30.02%)
      
              2.001393933  seconds time elapsed
      
      $ perf stat -B  noploop 2
      noploop for 2 seconds
      
       Performance counter stats for 'noploop 2':
      
              1998.297883  task-clock-msecs         #      0.998 CPUs
                       59  context-switches         #      0.000 M/sec
                        0  CPU-migrations           #      0.000 M/sec
                      119  page-faults              #      0.000 M/sec
            4,131,380,160  cycles                   #   2067.450 M/sec  (scaled from 70.01%)
            2,059,096,507  instructions             #      0.498 IPC    (scaled from 70.01%)
            2,054,681,303  branches                 #   1028.216 M/sec  (scaled from 70.01%)
                   25,650  branch-misses            #      0.001 %      (scaled from 30.05%)
            2,056,283,014  cache-references         #   1029.017 M/sec  (scaled from 30.03%)
                   47,097  cache-misses             #      0.024 M/sec  (scaled from 30.02%)
      
              2.001391016  seconds time elapsed
      
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <4bf28fe8.914ed80a.01ca.fffff5f5@mx.google.com>
      Signed-off-by: NStephane Eranian <eranian@google.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5af52b51
  7. 14 5月, 2010 1 次提交
    • S
      perf tools: change event inheritance logic in stat and record · 2e6cdf99
      Stephane Eranian 提交于
      By default, event inheritance across fork and pthread_create was on but the -i
      option of stat and record, which enabled inheritance, led to believe it was off
      by default.
      
      This patch fixes this logic by inverting the meaning of the -i option.  By
      default inheritance is on whether you attach to a process (-p), a thread (-t)
      or start a process. If you pass -i, then you turn off inheritance. Turning off
      inheritance if you don't need it, helps limit perf resource usage as well.
      
      The patch also fixes perf stat -t xxxx and perf record -t xxxx which did not
      start the counters.
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      LKML-Reference: <4bea9d2f.d60ce30a.0b5b.08e1@mx.google.com>
      Signed-off-by: NStephane Eranian <eranian@google.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2e6cdf99
  8. 09 8月, 2009 1 次提交
  9. 23 6月, 2009 1 次提交
  10. 07 6月, 2009 1 次提交
  11. 06 6月, 2009 2 次提交
  12. 04 6月, 2009 1 次提交
    • I
      perf stat: Update help text · 20c84e95
      Ingo Molnar 提交于
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      20c84e95
  13. 30 5月, 2009 1 次提交
    • I
      perf_counter tools: Generate per command manpages (and pdf/html, etc.) · c1c2365a
      Ingo Molnar 提交于
      Import Git's nice .txt => {man/html/pdf} generation machinery.
      
      Fix various errors in the Documentation/perf*.txt description as well.
      
      Also fix a bug in builtin-help: we'd map 'perf help top' to 'perftop'
      if only the 'perf' binary is in the default PATH - confusing the manpage
      logic. I dont fully understand why Git did it this way - but i suppose
      it's a migration artifact from their migration from standalone git-xyz
      commands to 'git xyz' commands. The perf tools were always using the
      modern form so it's not an issue there.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c1c2365a
  14. 29 5月, 2009 1 次提交
  15. 20 4月, 2009 1 次提交
    • I
      perf_counter tools: add help texts · 1d8c8b20
      Ingo Molnar 提交于
      Add Documentation/perf-stat.txt and Documentation/perf-top.txt.
      
      The template that was used for it: Documentation/git-add.txt from Git.
      
      Fix up small bugs to make these help texts show up both in the 'perf'
      common-command summary output screen, and on the individual help screens.
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1d8c8b20