1. 29 4月, 2015 2 次提交
    • A
      perf script: Add field option 'flags' to print sample flags · 400ea6d3
      Adrian Hunter 提交于
      Instruction tracing will typically have access to information about the
      instruction being executed for a particular ip sample.  Some of that
      information will be available in the 'flags' member of struct
      perf_sample.
      
      With the addition of transactions events synthesis to Instruction
      Tracing options, there is a need to be able easily to see the flags
      because they show whether the ip is at the start, commit or abort of a
      tranasaction.
      
      Consequently add an option to display the flags.
      
      The flags are "bcrosyiABEx" which stand for branch, call, return,
      conditional, system, asynchronous, interrupt, transaction abort, trace
      begin, trace end, and in transaction, respectively.
      
      Example using Intel PT:
      
      perf script -fip,time,event,sym,addr,flags
      
      ...
       1288.721584105: branches:u:   bo              401146 main =>           401152 main
       1288.721584105: transactions:   x                   0           401164 main
       1288.721584105: branches:u:   bx              40117c main =>           40119b main
       1288.721584105: branches:u:   box             4011a4 main =>           40117e main
       1288.721584105: branches:u:   bcx             401187 main =>           401094 g
      ...
       1288.721591645: branches:u:   bx              4010c4 g =>           4010cb g
       1288.721591645: branches:u:   brx             4010cc g =>           401189 main
       1288.721591645: transactions:                       0           4011a6 main
       1288.721593199: branches:u:   b               4011a9 main =>           4011af main
       1288.721593199: branches:u:   bo              4011bc main =>           40113e main
       1288.721593199: branches:u:   b               401150 main =>           40115a main
       1288.721593199: transactions:   x                   0           401164 main
       1288.721593199: branches:u:   bx              40117c main =>           40119b main
       1288.721593199: branches:u:   box             4011a4 main =>           40117e main
       1288.721593199: branches:u:   bcx             401187 main =>           40105e f
      ...
       1288.722284747: branches:u:   brx             401093 f =>           401189 main
       1288.722284747: branches:u:   box             4011a4 main =>           40117e main
       1288.722284747: branches:u:   bcx             401187 main =>           40105e f
       1288.722285883: transactions:   bA                  0           401071 f
       1288.722285883: branches:u:   bA              401071 f =>           40116a main
       1288.722285883: branches:u:   bE              40116a main =>                0 [unknown]
       1288.722297174: branches:u:   bB                   0 [unknown] =>           40116a main
      ...
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1428594864-29309-26-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      400ea6d3
    • A
      perf script: Add Instruction Tracing support · 7a680eb9
      Adrian Hunter 提交于
      Add support for decoding an AUX area assuming it contains instruction
      tracing data.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1428594864-29309-17-git-send-email-adrian.hunter@intel.com
      [ Do not use -Z as an alternative to --itrace ]
      [ Fixed initialization of itrace_synth_opts struct fields on older gcc versions ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7a680eb9
  2. 03 4月, 2015 3 次提交
    • Y
      perf script: Support using -f to override perf.data file ownership · 06af0f2c
      Yunlong Song 提交于
      Enable perf script to use perf.data when it is not owned by current user
      or root. Change the short option name of --fields to -F to avoid confusion
      with --force.
      
      Example:
      
       # perf record ls
       # chown Yunlong.Song:Yunlong.Song perf.data
       # ls -al perf.data
       -rw------- 1 Yunlong.Song Yunlong.Song 28360 Apr  2 14:53 perf.data
       # id
       uid=0(root) gid=0(root) groups=0(root),64(pkcs11)
      
      Before this patch:
      
       # perf script
       File perf.data not owned by current user or root (use -f to override)
       # perf script -f
         Error: switch `f' requires a value
      
        usage: perf script [<options>]
           or: perf script [<options>] record <script> [<record-options>] <command>
           or: perf script [<options>] report <script> [script-args]
           or: perf script [<options>] <script> [<record-options>] <command>
           or: perf script [<options>] <top-script> [script-args]
      
           -f, --fields <str>    comma separated output fields prepend with
           'type:'. Valid types: hw,sw,trace,raw. Fields:
           comm,tid,pid,time,cpu,event,trace,ip,sym,dso,addr,symoff,period
      
      As shown above, the -f option does not work at all. And -f is already
      taken up by --fields, which makes --force confused, so change the short
      option name of --fields to -F like what other perf commands do (e.g.
      perf report -F) and use -f as the short option name of --force.
      
      After this patch:
      
       # perf script
       File perf.data not owned by current user or root (use -f to override)
       # perf script -f
       :41298 41298 2590086.564226:          1 cycles:  ffffffff8103efc6
       native_write_msr_safe ([kernel.kallsyms])
       :41298 41298 2590086.564244:          1 cycles:  ffffffff8103efc6
       native_write_msr_safe ([kernel.kallsyms])
       :41298 41298 2590086.564249:          7 cycles:  ffffffff8103efc6
       native_write_msr_safe ([kernel.kallsyms])
       :41298 41298 2590086.564255:        176 cycles:  ffffffff8103efc6
       native_write_msr_safe ([kernel.kallsyms])
           ls 41298 2590086.567346:       4059 cycles:  ffffffff8105a592
           raise_softirq ([kernel.kallsyms])
           ls 41298 2590086.567353:       3717 cycles:  ffffffff8105a592
           raise_softirq ([kernel.kallsyms])
           ls 41298 2590086.567358:      63058 cycles:  ffffffff8105a592
           raise_softirq ([kernel.kallsyms])
           ls 41298 2590086.567448:    1706255 cycles:            406ae0
           [unknown] (/usr/bin/ls)
      
      As shown above, the -f option really works now.
      Signed-off-by: NYunlong Song <yunlong.song@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1427982439-27388-8-git-send-email-yunlong.song@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      06af0f2c
    • A
      perf scripting: No need to pass thread twice to the scripting callbacks · f9d5d549
      Arnaldo Carvalho de Melo 提交于
      It is already in the addr_location, so remove the redundant 'thread'
      parameter from the callback signatures.
      Acked-by: NJiri Olsa <jolsa@redhat.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1427906210-10519-3-git-send-email-acme@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f9d5d549
    • A
      perf script: No need to lookup thread twice · 79628f2c
      Arnaldo Carvalho de Melo 提交于
      We get the thread when we call perf_event__preprocess_sample(), no need
      to do it before that.
      Acked-by: NJiri Olsa <jolsa@redhat.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1427906210-10519-2-git-send-email-acme@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      79628f2c
  3. 25 3月, 2015 1 次提交
  4. 20 3月, 2015 1 次提交
  5. 11 3月, 2015 1 次提交
  6. 29 10月, 2014 2 次提交
  7. 18 10月, 2014 2 次提交
    • J
      perf script: Add period as a default output column · e8564b71
      Jiri Olsa 提交于
      Adding period as a default output column in script command fo hardware,
      software and raw events.
      
      If PERF_SAMPLE_PERIOD sample type is defined in perf.data, following
      will be displayed in perf script output:
      
        $ perf script
                    ls  8034 57477.887209:     250000 task-clock:  ffffffff81361d72 memset ([kernel.kallsyms])
                    ls  8034 57477.887464:     250000 task-clock:  ffffffff816f6d92 _raw_spin_unlock_irqrestore ([kernel.kallsyms])
                    ls  8034 57477.887708:     250000 task-clock:  ffffffff811a94f0 do_munmap ([kernel.kallsyms])
                    ls  8034 57477.887959:     250000 task-clock:        34080916c6 get_next_seq (/usr/lib64/libc-2.17.so)
                    ls  8034 57477.888208:     250000 task-clock:        3408079230 _IO_doallocbuf (/usr/lib64/libc-2.17.so)
                    ls  8034 57477.888717:     250000 task-clock:  ffffffff814242c8 n_tty_write ([kernel.kallsyms])
                    ls  8034 57477.889285:     250000 task-clock:        3408076402 fwrite_unlocked (/usr/lib64/libc-2.17.so)
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: "Jen-Cheng(Tommy) Huang" <tommy24@gatech.edu>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jen-Cheng(Tommy) Huang <tommy24@gatech.edu>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1408977943-16594-10-git-send-email-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e8564b71
    • J
      perf script: Add period data column · 535aeaae
      Jiri Olsa 提交于
      Adding period data column to be displayed in perf script.  It's possible
      to get period values using -f option, like:
      
        $ perf script -f comm,tid,time,period,ip,sym,dso
                :26019 26019 52414.329088:       3707  ffffffff8105443a native_write_msr_safe ([kernel.kallsyms])
                :26019 26019 52414.329088:         44  ffffffff8105443a native_write_msr_safe ([kernel.kallsyms])
                :26019 26019 52414.329093:       1987  ffffffff8105443a native_write_msr_safe ([kernel.kallsyms])
                :26019 26019 52414.329093:          6  ffffffff8105443a native_write_msr_safe ([kernel.kallsyms])
                    ls 26019 52414.329442:     537558        3407c0639c _dl_map_object_from_fd (/usr/lib64/ld-2.17.so)
                    ls 26019 52414.329442:       2099        3407c0639c _dl_map_object_from_fd (/usr/lib64/ld-2.17.so)
                    ls 26019 52414.330181:    1242100        34080917bb get_next_seq (/usr/lib64/libc-2.17.so)
                    ls 26019 52414.330181:       3774        34080917bb get_next_seq (/usr/lib64/libc-2.17.so)
                    ls 26019 52414.331427:    1083662  ffffffff810c7dc2 update_curr ([kernel.kallsyms])
                    ls 26019 52414.331427:        360  ffffffff810c7dc2 update_curr ([kernel.kallsyms])
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Cc: "Jen-Cheng(Tommy) Huang" <tommy24@gatech.edu>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jen-Cheng(Tommy) Huang <tommy24@gatech.edu>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1408977943-16594-9-git-send-email-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      535aeaae
  8. 09 10月, 2014 1 次提交
  9. 26 9月, 2014 1 次提交
  10. 23 8月, 2014 1 次提交
  11. 14 8月, 2014 4 次提交
  12. 12 8月, 2014 1 次提交
  13. 25 7月, 2014 1 次提交
  14. 23 7月, 2014 2 次提交
  15. 13 1月, 2014 1 次提交
  16. 28 12月, 2013 1 次提交
  17. 20 12月, 2013 1 次提交
    • A
      perf symbols: Add 'machine' member to struct addr_location · cc22e575
      Arnaldo Carvalho de Melo 提交于
      The addr_location struct should fully qualify an address, and to do that
      it should have in it the machine where the thread was found.
      
      Thus all functions that receive an addr_location now don't need to also
      receive a 'machine', those functions just need to access al->machine
      instead, just like it does with the other parts of an address location:
      al->thread, al->map, etc.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-o51iiee7vyq4r3k362uvuylg@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cc22e575
  18. 11 12月, 2013 1 次提交
  19. 10 12月, 2013 1 次提交
    • A
      perf script: Add an option to print the source line number · cc8fae1d
      Adrian Hunter 提交于
      Add field 'srcline' that displays the source file name and line number
      associated with the sample ip.  The information displayed is the same as
      from addr2line.
      
       $ perf script -f comm,tid,pid,time,ip,sym,dso,symoff,srcline
                  grep 10701/10701 2497321.421013:  ffffffff81043ffa native_write_msr_safe+0xa ([kernel.kallsyms])
        /usr/src/debug/kernel-3.9.fc17/linux-3.9.10-100.fc17.x86_64/arch/x86/include/asm/msr.h:95
                  grep 10701/10701 2497321.421984:  ffffffff8165b6b3 _raw_spin_lock+0x13 ([kernel.kallsyms])
        /usr/src/debug/kernel-3.9.fc17/linux-3.9.10-100.fc17.x86_64/arch/x86/include/asm/spinlock.h:54
                  grep 10701/10701 2497321.421990:  ffffffff810b64b3 tick_sched_timer+0x53 ([kernel.kallsyms])
        /usr/src/debug/kernel-3.9.fc17/linux-3.9.10-100.fc17.x86_64/kernel/time/tick-sched.c:840
                  grep 10701/10701 2497321.421992:  ffffffff8106f63f run_timer_softirq+0x2f ([kernel.kallsyms])
        /usr/src/debug/kernel-3.9.fc17/linux-3.9.10-100.fc17.x86_64/kernel/timer.c:1372
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1386315778-11633-3-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cc8fae1d
  20. 05 12月, 2013 2 次提交
  21. 28 11月, 2013 4 次提交
  22. 04 11月, 2013 2 次提交
    • A
      perf script: Set up output options for in-stream attributes · 7ea95727
      Adrian Hunter 提交于
      Attributes (struct perf_event_attr) are recorded separately in the
      perf.data file.  perf script uses them to set up output options.
      However attributes can also be in the event stream, for example when the
      input is a pipe (i.e. live mode).  This patch makes perf script process
      in-stream attributes in the same way as on-file attributes.
      
      Here is an example:
      
      Before this patch:
      
      $ perf record uname | perf script
      Linux
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.015 MB (null) (~655 samples) ]
      :4220  4220 [-01] 2933367.838906: cycles:
      
      :4220  4220 [-01] 2933367.838910: cycles:
      
      :4220  4220 [-01] 2933367.838912: cycles:
      
      :4220  4220 [-01] 2933367.838914: cycles:
      
      :4220  4220 [-01] 2933367.838916: cycles:
      
      :4220  4220 [-01] 2933367.838918: cycles:
      
      uname  4220 [-01] 2933367.838938: cycles:
      
      uname  4220 [-01] 2933367.839207: cycles:
      
      After this patch:
      
      $ perf record uname | perf script
      Linux
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.015 MB (null) (~655 samples) ]
                 :4582  4582 2933425.707724: cycles:  ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
                 :4582  4582 2933425.707728: cycles:  ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
                 :4582  4582 2933425.707730: cycles:  ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
                 :4582  4582 2933425.707732: cycles:  ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
                 :4582  4582 2933425.707734: cycles:  ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
                 :4582  4582 2933425.707736: cycles:  ffffffff81309a24 memcpy ([kernel.kallsyms])
                 uname  4582 2933425.707760: cycles:  ffffffff8109c1c7 enqueue_task_fair ([kernel.kallsyms])
                 uname  4582 2933425.707978: cycles:  ffffffff81308457 clear_page_c ([kernel.kallsyms])
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1383313899-15987-3-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7ea95727
    • F
      perf tools: Use an accessor to read thread comm · b9c5143a
      Frederic Weisbecker 提交于
      As the thread comm is going to be implemented by way of a more
      complicated data structure than just a pointer to a string from the
      thread struct, convert the readers of comm to use an accessor instead of
      accessing it directly.
      
      The accessor will be later overriden to support an enhanced comm
      implementation.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Tested-by: NJiri Olsa <jolsa@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-wr683zwy94hmj4ibogmnv9ce@git.kernel.org
      [ Rename thread__comm_curr() to thread__comm_str() ]
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      [ Fixed up some minor const pointer issues ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b9c5143a
  23. 23 10月, 2013 1 次提交
  24. 22 10月, 2013 3 次提交