1. 16 1月, 2010 1 次提交
    • A
      perf record: Encode the domain while synthesizing MMAP events · 18c3daa4
      Arnaldo Carvalho de Melo 提交于
      In the past 'perf record' had to process only userspace MMAP
      events, the ones generated in the kernel, but after we reused
      the MMAP events to encode the module mapings we ended up adding
      them first to the list of userspace DSOs (dsos__user) and to the
      kernel one (dsos__kernel).
      
      Fix this by encoding the header.misc field and then using it,
      like other parts to decide the right DSOs list to insert/find.
      
      The gotcha here is that since the kernel puts zero in .misc,
      which isn't PERF_RECORD_MISC_KERNEL (1 << 1), to differentiate,
      we put 1 in .misc.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      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: <1263519930-22803-2-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      18c3daa4
  2. 14 1月, 2010 1 次提交
    • A
      perf tools: Encode kernel module mappings in perf.data · b7cece76
      Arnaldo Carvalho de Melo 提交于
      We were always looking at the running machine /proc/modules,
      even when processing a perf.data file, which only makes sense
      when we're doing 'perf record' and 'perf report' on the same
      machine, and in close sucession, or if we don't use modules at
      all, right Peter? ;-)
      
      Now, at 'perf record' time we read /proc/modules, find the long
      path for modules, and put them as PERF_MMAP events, just like we
      did to encode the reloc reference symbol for vmlinux. Talking
      about that now it is encoded in .pgoff, so that we can use
      .{start,len} to store the address boundaries for the kernel so
      that when we reconstruct the kmaps tree we can do lookups right
      away, without having to fixup the end of the kernel maps like we
      did in the past (and now only in perf record).
      
      One more step in the 'perf archive' direction when we'll finally
      be able to collect data in one machine and analyse in another.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      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: <1263396139-4798-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      b7cece76
  3. 13 1月, 2010 1 次提交
    • A
      perf tools: Handle relocatable kernels · 56b03f3c
      Arnaldo Carvalho de Melo 提交于
      DSOs don't have this problem because the kernel emits a
      PERF_MMAP for each new executable mapping it performs on
      monitored threads.
      
      To fix the kernel case we simulate the same behaviour, by having
      'perf record' to synthesize a PERF_MMAP for the kernel, encoded
      like this:
      
      [root@doppio ~]# perf record -a -f sleep 1
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.344 MB perf.data (~15038 samples) ]
      [root@doppio ~]# perf report -D | head -10
      
      0xd0 [0x40]: event: 1
      .
      . ... raw event: size 64 bytes
      .  0000:  01 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 ......@........
      .  0010:  00 00 00 81 ff ff ff ff 00 00 00 00 00 00 00 00 ...............
      .  0020:  00 00 00 00 00 00 00 00 5b 6b 65 72 6e 65 6c 2e ........  [kernel
      .  0030:  6b 61 6c 6c 73 79 6d 73 2e 5f 74 65 78 74 5d 00  kallsyms._text]
      .  0xd0
      [0x40]: PERF_RECORD_MMAP 0/0: [0xffffffff81000000((nil)) @ (nil)]: [kernel.kallsyms._text]
      
      I.e. we identify such event as having:
      
       .pid      = 0
       .filename = [kernel.kallsyms.REFNAME]
       .start    = REFNAME addr in /proc/kallsyms at 'perf record' time
      
      and use now a hardcoded value of '.text' for REFNAME.
      
      Then, later, in 'perf report', if there are any kernel hits and
      thus we need to resolve kernel symbols, we search for REFNAME
      and if its address changed, relocation happened and we thus must
      change the kernel mapping routines to one that uses .pgoff as
      the relocation to apply.
      
      This way we use the same mechanism used for the other DSOs and
      don't have to do a two pass in all the kernel symbols.
      Reported-by: NXiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      LKML-Reference: <1262717431-1246-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      56b03f3c
  4. 28 12月, 2009 1 次提交
  5. 17 12月, 2009 2 次提交
  6. 16 12月, 2009 2 次提交
  7. 15 12月, 2009 1 次提交
  8. 14 12月, 2009 2 次提交
    • A
      perf session: Move kmaps to perf_session · 4aa65636
      Arnaldo Carvalho de Melo 提交于
      There is still some more work to do to disentangle map creation
      from DSO loading, but this happens only for the kernel, and for
      the early adopters of perf diff, where this disentanglement
      matters most, we'll be testing different kernels, so no problem
      here.
      
      Further clarification: right now we create the kernel maps for
      the various modules and discontiguous kernel text maps when
      loading the DSO, we should do it as a two step process, first
      creating the maps, for multiple mappings with the same DSO
      store, then doing the dso load just once, for the first hit on
      one of the maps sharing this DSO backing store.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      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: <1260741029-4430-6-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      4aa65636
    • A
      perf session: Pass the perf_session to the event handling operations · d8f66248
      Arnaldo Carvalho de Melo 提交于
      They will need it to get the right threads list, etc.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      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: <1260741029-4430-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      d8f66248
  9. 12 12月, 2009 1 次提交
    • A
      perf tools: Introduce perf_session class · 94c744b6
      Arnaldo Carvalho de Melo 提交于
      That does all the initialization boilerplate, opening the file,
      reading the header, checking if it is valid, etc.
      
      And that will as well have the threads list, kmap (now) global
      variable, etc, so that we can handle two (or more) perf.data files
      describing sessions to compare.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      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: <1260573842-19720-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      94c744b6
  10. 23 11月, 2009 1 次提交
  11. 20 11月, 2009 2 次提交
  12. 17 11月, 2009 4 次提交
  13. 11 11月, 2009 3 次提交
  14. 09 11月, 2009 1 次提交
    • P
      perf tools: Fix permission checks · c10edee2
      Pekka Enberg 提交于
      The perf_event_open() system call returns EACCES if the user is
      not root which results in a very confusing error message:
      
        $ perf record -A -a -f
      
          Error: perfcounter syscall returned with -1 (Permission denied)
      
          Fatal: No CONFIG_PERF_EVENTS=y kernel support configured?
      
      It turns out that's because perf tools are checking only for
      EPERM. Fix that up to get a much better error message:
      
        $ perf record -A -a -f
          Fatal: Permission error - are you root?
      Signed-off-by: NPekka Enberg <penberg@cs.helsinki.fi>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1257696066-4046-1-git-send-email-penberg@cs.helsinki.fi>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c10edee2
  15. 08 11月, 2009 1 次提交
    • A
      perf symbols: Use the buildids if present · 8d06367f
      Arnaldo Carvalho de Melo 提交于
      With this change 'perf record' will intercept PERF_RECORD_MMAP
      calls, creating a linked list of DSOs, then when the session
      finishes, it will traverse this list and read the buildids,
      stashing them at the end of the file and will set up a new
      feature bit in the header bitmask.
      
      'perf report' will then notice this feature and populate the
      'dsos' list and set the build ids.
      
      When reading the symtabs it will refuse to load from a file that
      doesn't have the same build id. This improves the
      reliability of the profiler output, as symbols and profiling
      data is more guaranteed to match.
      
      Example:
      
       [root@doppio ~]# perf report | head
       /home/acme/bin/perf with build id b1ea544ac3746e7538972548a09aadecc5753868 not found, continuing without symbols
        # Samples: 2621434559
        #
        # Overhead          Command                  Shared Object  Symbol
        # ........  ...............  .............................  ......
        #
             7.91%             init  [kernel]        [k] read_hpet
             7.64%             init  [kernel]        [k] mwait_idle_with_hints
             7.60%          swapper  [kernel]        [k] read_hpet
             7.60%          swapper  [kernel]        [k] mwait_idle_with_hints
             3.65%             init  [kernel]        [k] 0xffffffffa02339d9
      [root@doppio ~]#
      
      In this case the 'perf' binary was an older one, vanished,
      so its symbols probably wouldn't match or would cause subtly
      different (and misleading) output.
      
      Next patches will support the kernel as well, reading the build
      id notes for it and the modules from /sys.
      
      Another patch should also introduce a new plumbing command:
      
      'perf list-buildids'
      
      that will then be used in porcelain that is distro specific to
      fetch -debuginfo packages where such buildids are present. This
      will in turn allow for one to run 'perf record' in one machine
      and 'perf report' in another.
      
      Future work on having the buildid sent directly from the kernel
      in the PERF_RECORD_MMAP event is needed to close races, as the
      DSO can be changed during a 'perf record' session, but this
      patch at least helps with non-corner cases and current/older
      kernels.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Frank Ch. Eigler <fche@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Jim Keniston <jkenisto@us.ibm.com>
      Cc: K. Prasad <prasad@linux.vnet.ibm.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Roland McGrath <roland@redhat.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1257367843-26224-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      8d06367f
  16. 27 10月, 2009 2 次提交
  17. 23 10月, 2009 1 次提交
    • A
      perf tools: Unify debug messages mechanisms · 6beba7ad
      Arnaldo Carvalho de Melo 提交于
      We were using eprintf in some places, that looks at a global
      'verbose' level, and at other places passing a 'v' parameter to
      specify the verbosity level, unify it by introducing
      pr_{err,warning,debug,etc}, just like in the kernel.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <1256153646-10097-1-git-send-email-acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      6beba7ad
  18. 19 10月, 2009 2 次提交
    • F
      perf tools: Introduce bitmask'ed additional headers · 2ba08250
      Frederic Weisbecker 提交于
      This provides a new set of bitmasked headers. A new field is
      added in the perf headers that implements a bitmap storing
      optional features present in the perf.data file.
      
      The layout can be pictured like this:
      
      (Usual perf headers)(Features bitmap)[Feature 0][Feature
      n][Feature 255]
      
      If the bit n is set, then the feature n is used in this file.
      They are all set in order. This brings a backward and forward
      compatibility.
      
      The trace_info section has moved into such optional features,
      this is the first and only one for now.
      
      This is backward compatible with the .32 file version although
      it doesn't support the previous separate trace.info file.
      
      And finally it doesn't support the current interim development
      version.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1255792354-11304-2-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      2ba08250
    • F
      perf tools: Use kernel bitmap library · 5a116dd2
      Frederic Weisbecker 提交于
      Use the kernel bitmap library for internal perf tools uses.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1255792354-11304-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      5a116dd2
  19. 15 10月, 2009 1 次提交
    • L
      perf trace: Add filter Suppport · c171b552
      Li Zefan 提交于
      Add a new option "--filter <filter_str>" to perf record, and
      it should be right after "-e trace_point":
      
       #./perf record -R -f -e irq:irq_handler_entry --filter irq==18
       ^C
       # ./perf trace
                  perf-4303  ... irq_handler_entry: irq=18 handler=eth0
                  init-0     ... irq_handler_entry: irq=18 handler=eth0
                  init-0     ... irq_handler_entry: irq=18 handler=eth0
                  init-0     ... irq_handler_entry: irq=18 handler=eth0
                  init-0     ... irq_handler_entry: irq=18 handler=eth0
      
      See Documentation/trace/events.txt for the syntax of filter
      expressions.
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <4AD6955F.90602@cn.fujitsu.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c171b552
  20. 12 10月, 2009 1 次提交
    • M
      perf tools: Fix counter sample frequency breakage · 7e4ff9e3
      Mike Galbraith 提交于
      Commit 42e59d7d switched to a default sample frequency of
      1KHz, which overrides any user supplied count, causing sched, top
      and timechart to miss events due to their discrete events
      being flagged PERF_SAMPLE_PERIOD.
      
      Override default sample frequency when the user profides a
      period count, and make both record and top honor that user
      supplied option.
      Signed-off-by: NMike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arjan van de Ven <arjan@infradead.org>
      LKML-Reference: <1255326963.15107.2.camel@marge.simson.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      7e4ff9e3
  21. 07 10月, 2009 1 次提交
    • F
      perf tools: Merge trace.info content into perf.data · 03456a15
      Frederic Weisbecker 提交于
      This drops the trace.info file and move its contents into the
      common perf.data file.
      
      This is done by creating a new trace_info section into this file. A
      user of perf headers needs to call perf_header__set_trace_info() to
      save the trace meta informations into the perf.data file.
      
      A file created by perf after his patch is unsupported by previous
      version because the size of the headers have increased.
      
      That said, it's two new fields that have been added in the end of
      the headers, and those could be ignored by previous versions if
      they just handled the dynamic header size and then ignore the
      unknow part. The offsets guarantee the compatibility. We'll do a
      -stable fix for that.
      
      But current previous versions handle the header size using its
      static size, not dynamic, then it's not backward compatible with
      trace records.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <20091006213643.GA5343@nowhere>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      03456a15
  22. 06 10月, 2009 1 次提交
    • I
      perf tools: Default to 1 KHz auto-sampling freq events · 42e59d7d
      Ingo Molnar 提交于
      Use auto-freq events by default in perf record and
      perf top.
      
      This allows more consistent hardware event sampling,
      regardless of the intensity of the underlying event.
      
      It also keeps us from over-sampling on larger/busier
      systems.
      
      (also make surrounding initializations more consistent)
      
      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>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      42e59d7d
  23. 05 10月, 2009 1 次提交
  24. 21 9月, 2009 1 次提交
    • I
      perf: Do the big rename: Performance Counters -> Performance Events · cdd6c482
      Ingo Molnar 提交于
      Bye-bye Performance Counters, welcome Performance Events!
      
      In the past few months the perfcounters subsystem has grown out its
      initial role of counting hardware events, and has become (and is
      becoming) a much broader generic event enumeration, reporting, logging,
      monitoring, analysis facility.
      
      Naming its core object 'perf_counter' and naming the subsystem
      'perfcounters' has become more and more of a misnomer. With pending
      code like hw-breakpoints support the 'counter' name is less and
      less appropriate.
      
      All in one, we've decided to rename the subsystem to 'performance
      events' and to propagate this rename through all fields, variables
      and API names. (in an ABI compatible fashion)
      
      The word 'event' is also a bit shorter than 'counter' - which makes
      it slightly more convenient to write/handle as well.
      
      Thanks goes to Stephane Eranian who first observed this misnomer and
      suggested a rename.
      
      User-space tooling and ABI compatibility is not affected - this patch
      should be function-invariant. (Also, defconfigs were not touched to
      keep the size down.)
      
      This patch has been generated via the following script:
      
        FILES=$(find * -type f | grep -vE 'oprofile|[^K]config')
      
        sed -i \
          -e 's/PERF_EVENT_/PERF_RECORD_/g' \
          -e 's/PERF_COUNTER/PERF_EVENT/g' \
          -e 's/perf_counter/perf_event/g' \
          -e 's/nb_counters/nb_events/g' \
          -e 's/swcounter/swevent/g' \
          -e 's/tpcounter_event/tp_event/g' \
          $FILES
      
        for N in $(find . -name perf_counter.[ch]); do
          M=$(echo $N | sed 's/perf_counter/perf_event/g')
          mv $N $M
        done
      
        FILES=$(find . -name perf_event.*)
      
        sed -i \
          -e 's/COUNTER_MASK/REG_MASK/g' \
          -e 's/COUNTER/EVENT/g' \
          -e 's/\<event\>/event_id/g' \
          -e 's/counter/event/g' \
          -e 's/Counter/Event/g' \
          $FILES
      
      ... to keep it as correct as possible. This script can also be
      used by anyone who has pending perfcounters patches - it converts
      a Linux kernel tree over to the new naming. We tried to time this
      change to the point in time where the amount of pending patches
      is the smallest: the end of the merge window.
      
      Namespace clashes were fixed up in a preparatory patch - and some
      stylistic fallout will be fixed up in a subsequent patch.
      
      ( NOTE: 'counters' are still the proper terminology when we deal
        with hardware registers - and these sed scripts are a bit
        over-eager in renaming them. I've undone some of that, but
        in case there's something left where 'counter' would be
        better than 'event' we can undo that on an individual basis
        instead of touching an otherwise nicely automated patch. )
      Suggested-by: NStephane Eranian <eranian@google.com>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Acked-by: NPaul Mackerras <paulus@samba.org>
      Reviewed-by: NArjan van de Ven <arjan@linux.intel.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Kyle McMartin <kyle@mcmartin.ca>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: <linux-arch@vger.kernel.org>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      cdd6c482
  25. 18 9月, 2009 1 次提交
  26. 14 9月, 2009 2 次提交
    • I
      perf tools: Implement counter output multiplexing · ea57c4f5
      Ingo Molnar 提交于
      Finish the -M/--multiplex option implementation:
      
       - separate it out from group_fd
      
       - correctly set it via the ioctl and dont mmap counters that
         are multiplexed
      
       - modify the perf record event loop to deal with buffer-less
         counters.
      
       - remove the -g option from perf sched record
      
       - account for unordered events in perf sched latency
      
       - (add -f to perf sched record to ease measurements)
      
       - skip idle threads (pid==0) in latency output
      
      The result is better latency output by 'perf sched latency':
      
       -----------------------------------------------------------------------------------
        Task              |  Runtime ms | Switches | Average delay ms | Maximum delay ms |
       -----------------------------------------------------------------------------------
        ksoftirqd/8       |    0.071 ms |        2 | avg:    0.458 ms | max:    0.913 ms |
        at-spi-registry   |    0.609 ms |       19 | avg:    0.013 ms | max:    0.023 ms |
        perf              |    3.316 ms |       16 | avg:    0.013 ms | max:    0.054 ms |
        Xorg              |    0.392 ms |       19 | avg:    0.011 ms | max:    0.018 ms |
        sleep             |    0.537 ms |        2 | avg:    0.009 ms | max:    0.009 ms |
       -----------------------------------------------------------------------------------
        TOTAL:            |    4.925 ms |       58 |
       ---------------------------------------------
      
      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>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ea57c4f5
    • F
      perf tools: Add an option to multiplex counters in a single channel · d1302522
      Frederic Weisbecker 提交于
      Add an option to multiplex counters output in the channel of
      the group leader, ie: the first counter opened:
      
      	-M --multiplex
      
      The effect is better serialized samples. This is especially
      useful for tracepoint samples that need to be well serialized
      for their post-processing.
      
      Also make use of this option in 'perf sched'.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      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>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      d1302522
  27. 03 9月, 2009 2 次提交
    • I
      perf trace: Sample timestamps as well · 6ddf259d
      Ingo Molnar 提交于
      Before:
      
                  perf-21082 [013]     0.000000: sched_wakeup_new: task perf:21083 [120] success=1 [015]
                  perf-21082 [013]     0.000000: sched_migrate_task: task perf:21082 [120] from: 13  to: 15
                  perf-21082 [013]     0.000000: sched_process_fork: parent perf:21082  child perf:21083
                  true-21083 [015]     0.000000: sched_wakeup: task migration/15:33 [0] success=1 [015]
                  perf-21082 [013]     0.000000: sched_switch: task perf:21082 [120] (S) ==> swapper:0 [140]
                  true-21083 [015]     0.000000: sched_switch: task perf:21083 [120] (R) ==> migration/15:33 [0]
                  true-21083 [011]     0.000000: sched_process_exit: task true:21083 [120]
      
      After:
      
                  perf-21082 [013] 14674.797613: sched_wakeup_new: task perf:21083 [120] success=1 [015]
                  perf-21082 [013] 14674.797506: sched_migrate_task: task perf:21082 [120] from: 13  to: 15
                  perf-21082 [013] 14674.797610: sched_process_fork: parent perf:21082  child perf:21083
                  true-21083 [015] 14674.797725: sched_wakeup: task migration/15:33 [0] success=1 [015]
                  perf-21082 [013] 14674.797722: sched_switch: task perf:21082 [120] (S) ==> swapper:0 [140]
                  true-21083 [015] 14674.797729: sched_switch: task perf:21083 [120] (R) ==> migration/15:33 [0]
                  true-21083 [011] 14674.798159: sched_process_exit: task true:21083 [120]
      
      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>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      6ddf259d
    • I
      perf trace: Sample the CPU too · cd6feeea
      Ingo Molnar 提交于
      Sample, record, parse and print the CPU field - it had all zeroes before.
      
      Before (watch the second column, the CPU values):
      
                  perf-32685 [000]     0.000000: sched_wakeup_new: task perf:32686 [120] success=1 [011]
                  perf-32685 [000]     0.000000: sched_migrate_task: task perf:32685 [120] from: 1  to: 11
                  perf-32685 [000]     0.000000: sched_process_fork: parent perf:32685  child perf:32686
                  true-32686 [000]     0.000000: sched_wakeup: task migration/11:25 [0] success=1 [011]
                  true-32686 [000]     0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
                  true-32686 [000]     0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
                  perf-32685 [000]     0.000000: sched_switch: task perf:32685 [120] (S) ==> swapper:0 [140]
                  true-32686 [000]     0.000000: sched_switch: task perf:32686 [120] (R) ==> migration/11:25 [0]
                  true-32686 [000]     0.000000: sched_switch: task perf:32686 [120] (R) ==> distccd:12793 [125]
                  true-32686 [000]     0.000000: sched_switch: task true:32686 [120] (R) ==> distccd:12793 [125]
                  true-32686 [000]     0.000000: sched_process_exit: task true:32686 [120]
                  true-32686 [000]     0.000000: sched_stat_wait: task: distccd:12793 wait: 6767985949080 [ns]
                  true-32686 [000]     0.000000: sched_stat_wait: task: distccd:12793 wait: 6767986139446 [ns]
                  true-32686 [000]     0.000000: sched_stat_sleep: task: distccd:12793 sleep: 132844 [ns]
                  true-32686 [000]     0.000000: sched_stat_sleep: task: distccd:12793 sleep: 131724 [ns]
      
      After:
      
                  perf-32685 [001]     0.000000: sched_wakeup_new: task perf:32686 [120] success=1 [011]
                  perf-32685 [001]     0.000000: sched_migrate_task: task perf:32685 [120] from: 1  to: 11
                  perf-32685 [001]     0.000000: sched_process_fork: parent perf:32685  child perf:32686
                  true-32686 [011]     0.000000: sched_wakeup: task migration/11:25 [0] success=1 [011]
                  true-32686 [015]     0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
                  true-32686 [015]     0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
                  perf-32685 [001]     0.000000: sched_switch: task perf:32685 [120] (S) ==> swapper:0 [140]
                  true-32686 [011]     0.000000: sched_switch: task perf:32686 [120] (R) ==> migration/11:25 [0]
                  true-32686 [015]     0.000000: sched_switch: task perf:32686 [120] (R) ==> distccd:12793 [125]
                  true-32686 [015]     0.000000: sched_switch: task true:32686 [120] (R) ==> distccd:12793 [125]
                  true-32686 [015]     0.000000: sched_process_exit: task true:32686 [120]
                  true-32686 [015]     0.000000: sched_stat_wait: task: distccd:12793 wait: 6767985949080 [ns]
                  true-32686 [015]     0.000000: sched_stat_wait: task: distccd:12793 wait: 6767986139446 [ns]
                  true-32686 [015]     0.000000: sched_stat_sleep: task: distccd:12793 sleep: 132844 [ns]
                  true-32686 [015]     0.000000: sched_stat_sleep: task: distccd:12793 sleep: 131724 [ns]
      
      So we can now see how this workload migrated between CPUs.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      cd6feeea