1. 23 8月, 2014 1 次提交
  2. 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
  3. 05 12月, 2013 2 次提交
  4. 09 10月, 2013 1 次提交
  5. 22 7月, 2013 1 次提交
  6. 13 7月, 2013 4 次提交
  7. 22 3月, 2013 1 次提交
  8. 16 3月, 2013 1 次提交
  9. 12 8月, 2012 1 次提交
    • J
      perf tools: Support for DWARF CFI unwinding on post processing · 71ad0f5e
      Jiri Olsa 提交于
      This brings the support for DWARF cfi unwinding on perf post
      processing. Call frame informations are retrieved and then passed
      to libunwind that requests memory and register content from the
      applications.
      
      Adding unwind object to handle the user stack backtrace based
      on the user register values and user stack dump.
      
      The unwind object access the libunwind via remote interface
      and provides to it all the necessary data to unwind the stack.
      
      The unwind interface provides following function:
      	unwind__get_entries
      
      And callback (specified in above function) to retrieve
      the backtrace entries:
      	typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry,
      					 void *arg);
      Signed-off-by: NJiri Olsa <jolsa@redhat.com>
      Original-patch-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: "Frank Ch. Eigler" <fche@redhat.com>
      Cc: Arun Sharma <asharma@fb.com>
      Cc: Benjamin Redelings <benjamin.redelings@nescent.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Cyrill Gorcunov <gorcunov@openvz.org>
      Cc: Frank Ch. Eigler <fche@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Robert Richter <robert.richter@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Ulrich Drepper <drepper@gmail.com>
      Link: http://lkml.kernel.org/r/1344345647-11536-12-git-send-email-jolsa@redhat.com
      [ Replaced use of perf_session by usage of perf_evsel ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      71ad0f5e
  10. 08 8月, 2012 3 次提交
  11. 28 6月, 2012 1 次提交
    • A
      perf tools: Stop using a global trace events description list · da378962
      Arnaldo Carvalho de Melo 提交于
      The pevent thing is per perf.data file, so I made it stop being static
      and become a perf_session member, so tools processing perf.data files
      use perf_session and _there_ we read the trace events description into
      session->pevent and then change everywhere to stop using that single
      global pevent variable and use the per session one.
      
      Note that it _doesn't_ fall backs to trace__event_id, as we're not
      interested at all in what is present in the
      /sys/kernel/debug/tracing/events in the workstation doing the analysis,
      just in what is in the perf.data file.
      
      This patch also introduces perf_session__set_tracepoints_handlers that
      is the perf perf.data/session way to associate handlers to tracepoint
      events by resolving their IDs using the events descriptions stored in a
      perf.data file. Make 'perf sched' use it.
      Reported-by: NDmitry Antipov <dmitry.antipov@linaro.org>
      Tested-by: NDmitry Antipov <dmitry.antipov@linaro.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linaro-dev@lists.linaro.org
      Cc: patches@linaro.org
      Link: http://lkml.kernel.org/r/20120625232016.GA28525@infradead.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      da378962
  12. 25 4月, 2012 3 次提交
    • S
      parse-events: Rename struct record to struct pevent_record · 1c698186
      Steven Rostedt 提交于
      As libtraceevent will be a library, having struct record is far
      too generic of a name to use. Renaming it to be consistent with the
      rest of the functions will be a better long term solution.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Arun Sharma <asharma@fb.com>
      Cc: Namhyung Kim <namhyung.kim@lge.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      1c698186
    • S
      perf: Have perf use the new libtraceevent.a library · aaf045f7
      Steven Rostedt 提交于
      The event parsing code in perf was originally copied from trace-cmd
      but never was kept up-to-date with the changes that was done there.
      The trace-cmd libtraceevent.a code is much more mature than what is
      currently in perf.
      
      This updates the code to use wrappers to handle the calls to the
      new event parsing code. The new code requires a handle to be pass
      around, which removes the global event variables and allows
      more than one event structure to be read from different files
      (and different machines).
      
      But perf still has the old global events and the code throughout
      perf does not yet have a nice way to pass around a handle.
      A global 'pevent' has been made for perf and the old calls have
      been created as wrappers to the new event parsing code that uses
      the global pevent.
      
      With this change, perf can later incorporate the pevent handle into
      the perf structures and allow more than one file to be read and
      compared, that contains different events.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Arun Sharma <asharma@fb.com>
      Cc: Namhyung Kim <namhyung.kim@lge.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      aaf045f7
    • S
      perf: Separate out trace-cmd parse-events from perf files · 4ace73ee
      Steven Rostedt 提交于
      Move the trace-event-parse.c code that originally came from trace-cmd into
      their own files. The new file will be called trace-parse-events.c, as
      the name of trace-cmd's file was parse-events.c too, but it conflicted
      with the parse-events.c file in perf that parses the command line.
      
      This tries to update the code with mimimal changes.
      
      Perf specific code stays in the trace-event-parse.[ch] files and
      the common parsing code is now in trace-parse-events.c and
      trace-parse-events.h.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Arun Sharma <asharma@fb.com>
      Cc: Namhyung Kim <namhyung.kim@lge.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      4ace73ee
  13. 28 11月, 2011 1 次提交
  14. 20 10月, 2011 1 次提交
    • J
      perf tools: Fix tracing info recording · 29208e57
      Jiri Olsa 提交于
      Fixing the way the tracing information is stored within record command.
      The current implementation is causing issues for pipe output.
      
      Following commands fail currently:
      	perf script syscall-counts ls
      	perf record -e syscalls:sys_exit_read ls | ./perf report -i -
      
      The tracing information is part of the perf data file. It contains
      several files from within the tracing debugfs and procs directories.
      
      Beside some static header files, for each tracing event the format
      file is added. The /proc/kallsyms file is also added.
      
      The tracing data are stored with preceeding size. This is causing some
      dificulties for pipe output, since there's no way to tell debugfs/proc
      file size before reading it. So, for pipe output, all the debugfs files
      were read twice. Once to get the overall size and once to store the
      content itself. This can cause problem in case any of these file
      changed, within the storage time.
      
      To fix this behaviour and ensure the integrity of the tracing data, we:
          - read debugfs/proc file into the temp file
          - get temp file size and dump it to the pipe
          - dump the temp file contents to the pipe
      
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Neil Horman <nhorman@tuxdriver.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Link: http://lkml.kernel.org/r/20111020135943.GD2092@jolsa.brq.redhat.comSigned-off-by: NJiri Olsa <jolsa@redhat.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      29208e57
  15. 24 3月, 2011 1 次提交
    • A
      perf session: Pass evsel in event_ops->sample() · 9e69c210
      Arnaldo Carvalho de Melo 提交于
      Resolving the sample->id to an evsel since the most advanced tools,
      report and annotate, and the others will too when they evolve to
      properly support multi-event perf.data files.
      
      Good also because it does an extra validation, checking that the ID is
      valid when present. When that is not the case, the overhead is just a
      branch + function call (perf_evlist__id2evsel).
      
      Cc: Frederic 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: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9e69c210
  16. 15 3月, 2011 2 次提交
  17. 04 1月, 2011 1 次提交
    • A
      perf tools: Introduce event selectors · 69aad6f1
      Arnaldo Carvalho de Melo 提交于
      Out of ad-hoc code and global arrays with hard coded sizes.
      
      This is the first step on having a library that will be first
      used on regression tests in the 'perf test' tool.
      
      [acme@felicio linux]$ size /tmp/perf.before
         text	   data	    bss	    dec	    hex	filename
      1273776	  97384	5104416	6475576	 62cf38	/tmp/perf.before
      [acme@felicio linux]$ size /tmp/perf.new
         text	   data	    bss	    dec	    hex	filename
      1275422	  97416	1392416	2765254	 2a31c6	/tmp/perf.new
      
      Cc: Frederic 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: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      69aad6f1
  18. 20 5月, 2010 1 次提交
    • F
      perf: Fix unaligned accesses while fetching trace values · 85cb68b2
      Frederic Weisbecker 提交于
      Accessing trace values of an 8 size may end up in a segfault
      on archs that can't deal with misaligned access, which is the
      case for sparc 64. This is because PERF_SAMPLE_RAW are aligned
      to 4 and not to 8.
      
      Fix this on the macros that get the values of 8 size.
      
      This fixes segfaults on perf tools in sparc 64.
      Signed-off-by: NFrederic Weisbecker <fweisbec@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: Paul Mackerras <paulus@samba.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: David Miller <davem@davemloft.net>
      85cb68b2
  19. 03 5月, 2010 1 次提交
    • T
      perf: add perf-inject builtin · 454c407e
      Tom Zanussi 提交于
      Currently, perf 'live mode' writes build-ids at the end of the
      session, which isn't actually useful for processing live mode events.
      
      What would be better would be to have the build-ids sent before any of
      the samples that reference them, which can be done by processing the
      event stream and retrieving the build-ids on the first hit.  Doing
      that in perf-record itself, however, is off-limits.
      
      This patch introduces perf-inject, which does the same job while
      leaving perf-record untouched.  Normal mode perf still records the
      build-ids at the end of the session as it should, but for live mode,
      perf-inject can be injected in between the record and report steps
      e.g.:
      
      perf record -o - ./hackbench 10 | perf inject -v -b | perf report -v -i -
      
      perf-inject reads a perf-record event stream and repipes it to stdout.
      At any point the processing code can inject other events into the
      event stream - in this case build-ids (-b option) are read and
      injected as needed into the event stream.
      
      Build-ids are just the first user of perf-inject - potentially
      anything that needs userspace processing to augment the trace stream
      with additional information could make use of this facility.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1272696080-16435-3-git-send-email-tzanussi@gmail.com>
      Signed-off-by: NTom Zanussi <tzanussi@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      454c407e
  20. 01 5月, 2010 1 次提交
    • F
      perf: Fix warning while reading ring buffer headers · d00a47cc
      Frederic Weisbecker 提交于
      commit e9e94e3b
      "perf trace: Ignore "overwrite" field if present in
      /events/header_page" makes perf trace launching spurious warnings
      about unexpected tokens read:
      
      	Warning: Error: expected type 6 but read 4
      
      This change tries to handle the overcommit field in the header_page
      file whenever this field is present or not.
      
      The problem is that if this field is not present, we try to find it
      and give up in the middle of the line when we realize we are actually
      dealing with another field, which is the "data" one. And this failure
      abandons the file pointer in the middle of the "data" description
      line:
      
      	field: u64 timestamp;	offset:0;	size:8;	signed:0;
      	field: local_t commit;	offset:8;	size:8;	signed:1;
      	field: char data;	offset:16;	size:4080;	signed:1;
                            ^^^
                            Here
      
      What happens next is that we want to read this line to parse the data
      field, but we fail because the pointer is not in the beginning of the
      line.
      
      We could probably fix that by rewinding the pointer. But in fact we
      don't care much about these headers that only concern the ftrace
      ring-buffer. We don't use them from perf.
      
      Just skip this part of perf.data, but don't remove it from recording
      to stay compatible with olders perf.data
      Signed-off-by: NFrederic Weisbecker <fweisbec@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: Paul Mackerras <paulus@samba.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      d00a47cc
  21. 14 4月, 2010 2 次提交
    • T
      perf: Convert perf tracing data into a tracing_data event · 9215545e
      Tom Zanussi 提交于
      Bypasses the tracing_data perf header code and replaces it with
      a synthesized event and processing function that accomplishes
      the same thing, used when reading/writing perf data to/from a
      pipe.
      
      The tracing data is pretty large, and this patch doesn't attempt
      to break it down into component events.  The tracing_data event
      itself doesn't actually contain the tracing data, rather it
      arranges for the event processing code to skip over it after
      it's read, using the skip return value added to the event
      processing loop in a previous patch.
      Signed-off-by: NTom Zanussi <tzanussi@gmail.com>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: fweisbec@gmail.com
      Cc: rostedt@goodmis.org
      Cc: k-keiichi@bx.jp.nec.com
      Cc: acme@ghostprotocols.net
      LKML-Reference: <1270184365-8281-8-git-send-email-tzanussi@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      9215545e
    • I
      perf: Fix endianness argument compatibility with OPT_BOOLEAN() and introduce OPT_INCR() · c0555642
      Ian Munsie 提交于
      Parsing an option from the command line with OPT_BOOLEAN on a
      bool data type would not work on a big-endian machine due to the
      manner in which the boolean was being cast into an int and
      incremented. For example, running 'perf probe --list' on a
      PowerPC machine would fail to properly set the list_events bool
      and would therefore print out the usage information and
      terminate.
      
      This patch makes OPT_BOOLEAN work as expected with a bool
      datatype. For cases where the original OPT_BOOLEAN was
      intentionally being used to increment an int each time it was
      passed in on the command line, this patch introduces OPT_INCR
      with the old behaviour of OPT_BOOLEAN (the verbose variable is
      currently the only such example of this).
      
      I have reviewed every use of OPT_BOOLEAN to verify that a true
      C99 bool was passed. Where integers were used, I verified that
      they were only being used for boolean logic and changed them to
      bools to ensure that they would not be mistakenly used as ints.
      The major exception was the verbose variable which now uses
      OPT_INCR instead of OPT_BOOLEAN.
      Signed-off-by: NIan Munsie <imunsie@au.ibm.com>
      Acked-by: NDavid S. Miller <davem@davemloft.net>
      Cc: <stable@kernel.org> # NOTE: wont apply to .3[34].x cleanly, please backport
      Cc: Git development list <git@vger.kernel.org>
      Cc: Ian Munsie <imunsie@au1.ibm.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Eric B Munson <ebmunson@us.ibm.com>
      Cc: Valdis.Kletnieks@vt.edu
      Cc: WANG Cong <amwang@redhat.com>
      Cc: Thiago Farina <tfransosi@gmail.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      Cc: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Anton Blanchard <anton@samba.org>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1271147857-11604-1-git-send-email-imunsie@au.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c0555642
  22. 25 2月, 2010 1 次提交
  23. 24 2月, 2010 1 次提交
  24. 15 12月, 2009 1 次提交
    • T
      perf trace/scripting: Add support for script args · 586bc5cc
      Tom Zanussi 提交于
      One oversight of the original scripting_ops patch was a lack of
      support for passing args to handler scripts.  This adds
      argc/argv to the start_script() scripting_op, and changes the
      rw-by-file script to take 'comm' arg rather than the 'perf'
      value currently hard-coded.  It also takes the opportunity to do
      some related minor cleanup.
      Signed-off-by: NTom Zanussi <tzanussi@gmail.com>
      Cc: fweisbec@gmail.com
      Cc: rostedt@goodmis.org
      LKML-Reference: <1260867220-15699-2-git-send-email-tzanussi@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      586bc5cc
  25. 28 11月, 2009 4 次提交
    • T
      perf trace: Add interface to access perf data from Perl handlers · d1b93772
      Tom Zanussi 提交于
      The Perl scripting support for perf trace allows most of a trace
      event's data to be accessed directly as handler arguments, but
      not all of it e.g. the less common fields aren't passed in.  To
      give scripts access to the other fields and/or any other data or
      metadata in the main perf executable that might be useful, a way
      to access the C data in perf from Perl is needed; this patch
      uses the Perl XS facility to do it for the common_xxx event
      fields not passed to handler functions.
      
      Context.pm exports three functions to Perl scripts that access
      fields for the current event by calling back into perf:
      common_pc(), common_flags() and common_lock_depth().  Support
      for common_flags() field values was added to Core.pm and a
      script used to sanity check these and other basic scripting
      features, check-perf-trace.pl, was also added.
      Signed-off-by: NTom Zanussi <tzanussi@gmail.com>
      Cc: fweisbec@gmail.com
      Cc: rostedt@goodmis.org
      Cc: anton@samba.org
      Cc: hch@infradead.org
      LKML-Reference: <1259133352-23685-6-git-send-email-tzanussi@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      d1b93772
    • T
      perf trace: Add Perl scripting support · 16c632de
      Tom Zanussi 提交于
      Implement trace_scripting_ops to make Perl a supported perf
      trace scripting language.
      
      Additionally adds code that allows Perl trace scripts to access
      the 'flag' and 'symbolic' (__print_flags(), __print_symbolic())
      field information parsed from the trace format files.
      
      Also adds the Perl implementation of the generate_script()
      trace_scripting_op, which creates a ready-to-run perf trace Perl
      script based on existing trace data.  Scripts generated by this
      implementation print out all the fields for each event mentioned
      in perf.data (and will detect and generate the proper scripting
      code for 'flag' and 'symbolic' fields), and will additionally
      generate handlers for the special 'trace_unhandled',
      'trace_begin' and 'trace_end' handlers.  Script authors can
      simply remove the printing code to implement their own custom
      event handling.
      Signed-off-by: NTom Zanussi <tzanussi@gmail.com>
      Cc: fweisbec@gmail.com
      Cc: rostedt@goodmis.org
      Cc: anton@samba.org
      Cc: hch@infradead.org
      LKML-Reference: <1259133352-23685-4-git-send-email-tzanussi@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      16c632de
    • T
      perf trace: Add flag/symbolic format_flags · eb9a42ca
      Tom Zanussi 提交于
      It's useful to know whether a field is a flag or symbolic field
      for e.g. when generating scripts - it allows us to translate
      those fields specially rather than literally as plain numeric
      values.
      Signed-off-by: NTom Zanussi <tzanussi@gmail.com>
      Cc: fweisbec@gmail.com
      Cc: rostedt@goodmis.org
      Cc: anton@samba.org
      Cc: hch@infradead.org
      LKML-Reference: <1259133352-23685-3-git-send-email-tzanussi@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      eb9a42ca
    • T
      perf trace: Add scripting ops · 956ffd02
      Tom Zanussi 提交于
      Adds an interface, scripting_ops, that when implemented for a
      particular scripting language enables built-in support for trace
      stream processing using that language.
      
      The interface is designed to enable full-fledged language
      interpreters to be embedded inside the perf executable and
      thereby make the full capabilities of the supported languages
      available for trace processing.
      
      See below for details on the interface.
      
      This patch also adds a couple command-line options to 'perf
      trace':
      
      The -s option option is used to specify the script to be run.
      Script names that can be used with -s take the form:
      
      [language spec:]scriptname[.ext]
      
      Scripting languages register a set of 'language specs' that can
      be used to specify scripts for the registered languages.  The
      specs can be used either as prefixes or extensions.
      
      If [language spec:] is used, the script is taken as a script of
      the matching language regardless of any extension it might have.
       If [language spec:] is not used, [.ext] is used to look up the
      language it corresponds to.  Language specs are case
      insensitive.
      
      e.g. Perl scripts can be specified in the following ways:
      
      Perl:scriptname
      pl:scriptname.py # extension ignored
      PL:scriptname
      scriptname.pl
      scriptname.perl
      
      The -g [language spec] option gives users an easy starting point
      for writing scripts in the specified language.  Scripting
      support for a particular language can implement a
      generate_script() scripting op that outputs an empty (or
      near-empty) set of handlers for all the events contained in a
      given perf.data trace file - this option gives users a direct
      way to access that.
      
      Adding support for a scripting language
      ---------------------------------------
      
      The main thing that needs to be done do add support for a new
      language is to implement the scripting_ops interface:
      
      It consists of the following four functions:
      
          start_script()
          stop_script()
          process_event()
          generate_script()
      
      start_script() is called before any events are processed, and is
      meant to give the scripting language support an opportunity to
      set things up to receive events e.g. create and initialize an
      instance of a language interpreter.
      
      stop_script() is called after all events are processed, and is
      meant to give the scripting language support an opportunity to
      clean up e.g. destroy the interpreter instance, etc.
      
      process_event() is called once for each event and takes as its
      main parameter a pointer to the binary trace event record to be
      processed. The implementation is responsible for picking out the
      binary fields from the event record and sending them to the
      script handler function associated with that event e.g. a
      function derived from the event name it's meant to handle e.g.
      'sched::sched_switch()'.  The 'format' information for trace
      events can be used to parse the binary data and map it into a
      form usable by a given scripting language; see the Perl
      implemention in subsequent patches for one possible way to
      leverage the existing trace format parsing code in perf and map
      that info into specific scripting language types.
      
      generate_script() should generate a ready-to-run script for the
      current set of events in the trace, preferably with bodies that
      print out every field for each event.  Again, look at the Perl
      implementation for clues as to how that can be done.  This is an
      optional, but very useful op.
      
      Support for a given language should also add a language-specific
      setup function and call it from setup_scripting().  The
      language-specific setup function associates the the scripting
      ops for that language with one or more 'language specifiers'
      (see below) using script_spec_register().  When a script name is
      specified on the command line, the scripting ops associated with
      the specified language are used to instantiate and use the
      appropriate interpreter to process the trace stream.
      
      In general, it should be relatively easy to add support for a
      new language, especially if the language implementation supports
      an interface allowing an interpreter to be 'embedded' inside
      another program (in this case the containing program will be
      'perf trace'). If so, it should be relatively straightforward to
      translate trace events into invocations of user-defined script
      functions where e.g. the function name corresponds to the event
      type and the function parameters correspond to the event fields.
       The event and field type information exported by the event
      tracing infrastructure (via the event 'format' files) should be
      enough to parse and send any piece of trace data to the user
      script.  The easiest way to see how this can be done would be to
      look at the Perl implementation contained in
      perf/util/trace-event-perl.c/.h.
      
      There are a couple of other things that aren't covered by the
      scripting_ops or setup interface and are technically optional,
      but should be implemented if possible.  One of these is support
      for 'flag' and 'symbolic' fields e.g. being able to use more
      human-readable values such as 'GFP_KERNEL' or
      HI/BLOCK_IOPOLL/TASKLET in place of raw flag values.  See the
      Perl implementation to see how this can be done. The other thing
      is support for 'calling back' into the perf executable to access
      e.g. uncommon fields not passed by default into handler
      functions, or any metadata the implementation might want to make
      available to users via the language interface.  Again, see the
      Perl implementation for examples.
      Signed-off-by: NTom Zanussi <tzanussi@gmail.com>
      Cc: fweisbec@gmail.com
      Cc: rostedt@goodmis.org
      Cc: anton@samba.org
      Cc: hch@infradead.org
      LKML-Reference: <1259133352-23685-2-git-send-email-tzanussi@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      956ffd02
  26. 22 11月, 2009 1 次提交
    • A
      perf trace: Read_tracing_data should die() another day · e2561368
      Arnaldo Carvalho de Melo 提交于
      It better propagate errors, also if we do a simple:
      
      [root@doppio linux-2.6-tip]# perf record -R -a -f sleep 3s ;
      perf trace [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.182 MB perf.data (~7972 samples) ]
      Fatal: not an trace data file
      [root@doppio linux-2.6-tip]#
      
      That is what is expected, right? I.e. as we didn't specify any
      tracepoint event via -e, it should gracefully bail out and not
      SEGFAULT.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1258821086-11521-3-git-send-email-acme@infradead.org>
      [ Fixed the error messages some more ]
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      e2561368
  27. 15 10月, 2009 1 次提交
    • S
      perf tools: Add latency format to trace output · cda48461
      Steven Rostedt 提交于
      Add the irqs disabled, preemption count, need resched, and other
      info that is shown in the latency format of ftrace.
      
       # perf trace -l
          perf-16457   2..s2. 53636.260344: kmem_cache_free: call_site=ffffffff811198f
          perf-16457   2..s2. 53636.264330: kmem_cache_free: call_site=ffffffff811198f
          perf-16457   2d.s4. 53636.300006: kmem_cache_free: call_site=ffffffff810d889
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <20091014194400.076588953@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      cda48461