1. 03 8月, 2010 3 次提交
    • A
      perf tools: Don't keep unreferenced maps when unmaps are detected · 0a1eae39
      Arnaldo Carvalho de Melo 提交于
      For a file with:
      
      [root@emilia linux-2.6-tip]# perf report -D -fi allmodconfig-j32.perf.data | grep events:
           TOTAL events:      36933
            MMAP events:       9056
            LOST events:          0
            COMM events:       1702
            EXIT events:       1887
        THROTTLE events:          8
      UNTHROTTLE events:          8
            FORK events:       1894
            READ events:          0
          SAMPLE events:      22378
            ATTR events:          0
      EVENT_TYPE events:          0
      TRACING_DATA events:          0
        BUILD_ID events:          0
      [root@emilia linux-2.6-tip]#
      
      Testing with valgrind and making perf_session__delete() a nop, so that
      we can notice how many maps were actually deleted due to not having any
      samples on it:
      
      ==== HEAP SUMMARY:
      
      Before:
      
      ==10339==     in use at exit: 8,909,997 bytes in 68,690 blocks
      ==10339==   total heap usage: 78,696 allocs, 10,007 frees, 11,925,853 bytes allocated
      
      After:
      
      ==10506==     in use at exit: 8,902,605 bytes in 68,606 blocks
      ==10506==   total heap usage: 78,696 allocs, 10,091 frees, 11,925,853 bytes allocated
      
      I.e. just 84 detected unmaps with no hits out of 9056 for this workload,
      not much, but in some other long running workload this may save more
      bytes.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0a1eae39
    • A
      perf session: Invalidate last_match when removing threads from rb_tree · 70597f21
      Arnaldo Carvalho de Melo 提交于
      If we receive two PERF_RECORD_EXIT for the same thread, we can end up
      reusing session->last_match and trying to remove the thread twice from
      the rb_tree, causing a segfault, so invalidade last_match in
      perf_session__remove_thread.
      
      Receiving two PERF_RECORD_EXIT for the same thread is a bug, but its a
      harmless one if we make the tool more robust, like this patch does.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      70597f21
    • A
      perf session: Free the ref_reloc_sym memory at the right place · 076c6e45
      Arnaldo Carvalho de Melo 提交于
      Which is at perf_session__destroy_kernel_maps, counterpart to the
      perf_session__create_kernel_maps where the kmap structure is located, just
      after the vmlinux_maps.
      
      Make it also check if the kernel maps were actually created, which may not
      be the case if, for instance, perf_session__new can't complete due to
      permission problems in, for instance, a 'perf report' case, when a
      segfault will take place, that is how this was noticed.
      
      The problem was introduced in d65a458b, thus post .35.
      
      This also adds code to release guest machines as them are also created
      in perf_session__create_kernel_maps, so should be deleted on this newly
      introduced counterpart, perf_session__destroy_kernel_maps.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      076c6e45
  2. 31 7月, 2010 2 次提交
    • A
      perf tools: Release session and symbol resources on exit · d65a458b
      Arnaldo Carvalho de Melo 提交于
      So that we reduce the noise when looking for leaks using tools such as
      valgrind.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d65a458b
    • A
      perf tools: Release thread resources on PERF_RECORD_EXIT · 591765fd
      Arnaldo Carvalho de Melo 提交于
      For long running sessions with many threads with short lifetimes the
      amount of memory that the buildid process takes is too much.
      
      Since we don't have hist_entries that may be pointing to them, we can
      just release the resources associated with each thread when the exit
      (PERF_RECORD_EXIT) event is received.
      
      For normal processing we need to annotate maps with hits, and thus
      hist_entries pointing to it and drop the ones that had none. Will be
      done in a followup patch.
      
      Cc: David S. Miller <davem@davemloft.net>
      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>
      591765fd
  3. 30 7月, 2010 6 次提交
  4. 27 7月, 2010 7 次提交
    • D
      perf tools: Remove unneeded code for tracking the cwd in perf sessions · 88ca895d
      Dave Martin 提交于
      Tidy-up patch to remove some code and struct perf_session data members
      which are no longer needed due to the previous patch: "perf tools: Don't
      abbreviate file paths relative to the cwd".
      
      LKML-Reference: <new-submission>
      Signed-off-by: NDave Martin <dave.martin@linaro.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      88ca895d
    • D
      perf report: Don't abbreviate file paths relative to the cwd · 361d1346
      Dave Martin 提交于
      This avoids around some problems where the full path is executables and DSOs it
      needed for finding debug symbols on platforms with separated debug symbol files
      such as Ubuntu.  This is simpler than tracking an extra name for each image.
      
      The only impact should be that paths in verbose output from the perf tools
      become absolute, instead of relative to .
      
      LKML-Reference: <new-submission>
      Signed-off-by: NDave Martin <dave.martin@linaro.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      361d1346
    • A
      perf ui: New hists tree widget · 0f0cbf7a
      Arnaldo Carvalho de Melo 提交于
      The stock newt checkbox tree widget we were using was not really
      suitable for hist entry + callchain browsing.
      
      The problems with it were manifold:
      
      - We needed to traverse the whole hist_entry rb_tree to add each entry +
        callchains beforehand.
      
      - No control over the colors used for each row
      
      So a new tree widget, based mostly on slang, was written.
      
      It extends the ui_browser class already used for annotate to allow the
      user to fold/unfold branches in the callchains tree, using extra fields
      in the symbol_map class that is embedded in hist_entry and
      callchain_node instances to store the folding state and when changing
      this state calculates the number of rows that are produced when showing
      a particular hist_entry instance.
      
      This greatly speeds up browsing as we don't have to upfront touch all
      the entries and only calculate callchain related operations when some
      callchain branch is actually unfolded.
      
      The memory footprint is also reduced as the data structure is not
      duplicated, just some extra fields for controling callchain state and to
      simplify the process of seeking thru entries (nr_rows, row_offset) were
      added.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0f0cbf7a
    • A
      perf ui: Show the scroll bar over the left window frame · 8d8c369f
      Arnaldo Carvalho de Melo 提交于
      So that we gain two columns and look more like classical (at least in
      TUIs) scroll bars bars.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8d8c369f
    • A
      perf ui: Consider the refreshed dimensions in ui_browser__show · 63160f73
      Arnaldo Carvalho de Melo 提交于
      When we call ui_browser__show we may have called
      ui_browser__refresh_dimensions to check if the maximum lenght for the
      contained entries changed, such as when zooming in and out DSOs or
      threads in the hist browser.
      
      For that to happen we must delete the old form, that will take care of
      deleting the vertical scrollbar, etc, and then recreate them, with the
      new dimensions.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      63160f73
    • A
      perf hist: Introduce routine to measure lenght of formatted entry · 06daaaba
      Arnaldo Carvalho de Melo 提交于
      Will be used to figure out the window width needed in the new tree
      widget.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      06daaaba
    • A
      perf ui: Restore SPACE as an alias to PGDN in annotate · b61b55ed
      Arnaldo Carvalho de Melo 提交于
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b61b55ed
  5. 23 7月, 2010 3 次提交
    • A
      perf sort: Make column width code per hists instance · 8a6c5b26
      Arnaldo Carvalho de Melo 提交于
      They were globals, and since we support multiple hists and sessions
      at the same time, it doesn't make sense to calculate those values
      considereing all symbols in all sessions.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8a6c5b26
    • A
      perf hists: Mark entries filtered by parent · 7a007ca9
      Arnaldo Carvalho de Melo 提交于
      And don't consider them in hists__inc_nr_entries.
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7a007ca9
    • A
      perf annotate: Fix handling of goto labels that are valid hex numbers · 70a7cb3b
      Arnaldo Carvalho de Melo 提交于
      When parsing the objdump disassembly output we can have goto labels that
      are valid hex numbers and thus get confused with lines with machine
      code.
      
      Handle the common case of a label that has nothing after it and other
      cases where there is just source code by validating the resulting "ip".
      
      It is still possible that we find goto labels that are in the function
      address range, but only if they are located before the real address we
      should be OK.
      
      A change in the objdump output to have a clear marker separating
      addresses from the disassembly would come handy, but we would still have
      to deal with older versions.
      Reported-by: NGleb Natapov <gleb@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Gleb Natapov <gleb@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      LKML-Reference: <20100722170541.GF17631@ghostprotocols.net>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      70a7cb3b
  6. 18 7月, 2010 3 次提交
  7. 17 7月, 2010 1 次提交
    • G
      perf symbols: Fix directory descriptor leaking · 74534341
      Gui Jianfeng 提交于
      When I ran "perf kvm ... top", I encountered the following error output.
      
        Error: perfcounter syscall returned with -1 (Too many open files)
      
        Fatal: No CONFIG_PERF_EVENTS=y kernel support configured?
      
      Looking into perf, I found perf opens too many directories at
      initialization time, but forgets to close them. Here is the fix.
      
      LKML-Reference: <4C230362.5080704@cn.fujitsu.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Signed-off-by: NGui Jianfeng <guijianfeng@cn.fujitsu.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      74534341
  8. 16 7月, 2010 4 次提交
  9. 08 7月, 2010 2 次提交
    • F
      perf: Sync callchains with period based hits · 108553e1
      Frederic Weisbecker 提交于
      Hists have their hits increased by the event period. And this
      period based counting is the foundation of all the stats in
      perf report.
      
      But callchains still use the raw number of hits, without taking
      the period into account. So when we compute the percentage,
      absolute based percentages are totally broken, and relative ones
      too in the first parent level. Because we pass the number of events
      muliplied by their period as the total number of hits to the
      callchain filtering, while callchains expect this number to be
      the number of raw hits.
      
      perf report -g graph was simply not working, showing no graph unless
      the min percent was zero. And even there the percentage of the
      branches was always 0. And may be fractal filtering was broken on
      the first branch level too.
      
      flat also was broken, but it was hidden because of other breakages.
      
      Anyway fix this by counting using periods on callchains.
      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>
      108553e1
    • F
      perf: Resurrect flat callchains · 97aa1052
      Frederic Weisbecker 提交于
      Initialize the callchain radix tree root correctly.
      
      When we walk through the parents, we must stop after the root, but
      since it wasn't well initialized, its parent pointer was random.
      
      Also the number of hits was random because uninitialized, hence it
      was part of the callchain while the root doesn't contain anything.
      
      This fixes segfaults and percentages followed by empty callchains
      while running:
      
      	perf report -g flat
      Reported-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: 2.6.31.x-2.6.34.x <stable@kernel.org>
      97aa1052
  10. 06 7月, 2010 3 次提交
    • M
      perf probe: Support static and global variables · b7dcb857
      Masami Hiramatsu 提交于
      Add static and global variables support to perf probe.
      This allows user to trace non-local variables (and
      structure members) at probe points.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20100519195749.2885.17451.stgit@localhost6.localdomain6>
      Signed-off-by: NMasami Hiramatsu <mhiramat@redhat.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b7dcb857
    • M
      perf probe: Support tracing an entry of array · b2a3c12b
      Masami Hiramatsu 提交于
      Add array-entry tracing support to perf probe. This enables to trace an entry
      of array which is indexed by constant value, e.g. array[0].
      
      For example:
      
        $ perf probe -a 'bio_split bi->bi_io_vec[0]'
      
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20100519195742.2885.5344.stgit@localhost6.localdomain6>
      Signed-off-by: NMasami Hiramatsu <mhiramat@redhat.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b2a3c12b
    • M
      perf probe: Support "string" type · 73317b95
      Masami Hiramatsu 提交于
      Support string type casting to event argument. If perf-probe finds an argument
      casted as string, it ensures the target variable is "(unsigned/signed) char
      *(or []). perf-probe also adds dereference if the target is a pointer.
      
      So, both of 'char buf[10];' and 'char *buf;' can be accessed by 'buf:string'
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20100519195734.2885.1666.stgit@localhost6.localdomain6>
      Signed-off-by: NMasami Hiramatsu <mhiramat@redhat.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      73317b95
  11. 05 7月, 2010 2 次提交
  12. 02 7月, 2010 1 次提交
  13. 30 6月, 2010 1 次提交
  14. 25 6月, 2010 1 次提交
    • F
      perf: Don't use 4 bytes as a default instruction breakpoint length · aa59a485
      Frederic Weisbecker 提交于
      4 bytes is fine as a default access for data breakpoints. But
      instruction breakpoints should take the native pointer length,
      otherwise we get a -EINVAL in x86-64.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Prasad <prasad@linux.vnet.ibm.com>
      Cc: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.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: Jason Wessel <jason.wessel@windriver.com>
      aa59a485
  15. 22 6月, 2010 1 次提交