aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util (follow)
AgeCommit message (Collapse)AuthorFilesLines
2010-07-23perf sort: Make column width code per hists instanceArnaldo Carvalho de Melo8-79/+140
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: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-07-23perf hists: Mark entries filtered by parentArnaldo Carvalho de Melo1-5/+16
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: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-07-22perf annotate: Fix handling of goto labels that are valid hex numbersArnaldo Carvalho de Melo1-2/+6
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: Gleb 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: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-07-21Merge branch 'linus' into perf/coreIngo Molnar3-26/+31
Merge reason: Pick up the latest perf fixes. Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-07-17perf hists: Factor out duplicated codeArnaldo Carvalho de Melo1-18/+18
Introducing hists__remove_entry_filter. 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> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-07-17perf ui: Make ui_browser__run exit on unhandled hot keysArnaldo Carvalho de Melo1-5/+1
Right now ENTER doesn't always exits the newt tree widget, as it is used for expanding/collapsing branches, but with the new tree widget being developed we need to regain control to handle it, expanding/collapsing branches. In fact its really up to the ui_browser user to state what extra keys should stop ui_browser__run, and it should handle just the ones needed for basic browsing. 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: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-07-17perf ui: Make END go to the last entry, not the top of the last pageArnaldo Carvalho de Melo1-4/+4
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: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-07-16perf symbols: Fix directory descriptor leakingGui Jianfeng1-7/+10
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: Gui Jianfeng <guijianfeng@cn.fujitsu.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-07-16perf probe: Fix the logic of die_compare_nameMasami Hiramatsu1-7/+7
Invert the return value of die_compare_name(), because it returns a 'bool' result which should be expeced true if the die's name is same as compared string. LKML-Reference: <4C36EBED.1000006@hitachi.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-07-16perf probe: Support comp_dir to find an absolute source pathMasami Hiramatsu3-12/+44
Gcc generates DW_AT_comp_dir and stores relative source path if building kernel without O= option. In that case, perf probe --line sometimes doesn't work without --source option, because it tries to access relative source path. This adds DW_AT_comp_dir support to perf probe for finding an absolute source path when no --source option. LKML-Reference: <4C36EBE7.3060802@hitachi.com> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-07-16perf probe: Fix error message if get_real_path() failedMasami Hiramatsu2-56/+64
Perf probe -L shows incorrect error message (Dwarf error) if it fails to find source file. This can confuse users. # ./perf probe -s /nowhere -L vfs_read Debuginfo analysis failed. (-2) Error: Failed to show lines. (-2) With this patch, it shows correct message. # ./perf probe -s /nowhere -L vfs_read Failed to find source file. (-2) Error: Failed to show lines. (-2) LKML-Reference: <4C36EBDB.4020308@hitachi.com> Cc: Chase Douglas <chase.douglas@canonical.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Ingo Molnar <mingo@elte.hu> Acked-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-07-16perf: Fix various display bugs with parent filteringFrederic Weisbecker1-5/+16
Hists that have been filtered, because they don't have callchains matching the parent filter, won't be printed. As such, hist_entry__snprintf() returns 0 for them, but we don't control this value and we always print the buffer, which might be untouched and then only made of random stack garbage. Not only does it paint the screen with barf, it also prints the callchains for these hists, even though they have been filtered, since the hist has been filtered as well. We need to check the return value of hist_entry__snprintf() and ignore the hist if it is 0, which means it didn't get any callchain matching the parent filter. This fixes the barf and the undesired callchains. Reported-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Frederic 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>
2010-07-08perf: Sync callchains with period based hitsFrederic Weisbecker2-18/+19
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: Frederic 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>
2010-07-08perf: Resurrect flat callchainsFrederic Weisbecker1-0/+3
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: Ingo Molnar <mingo@elte.hu> Signed-off-by: Frederic 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>
2010-07-06Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 into perf/coreIngo Molnar3-61/+203
2010-07-05perf probe: Support static and global variablesMasami Hiramatsu2-27/+73
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: Masami Hiramatsu <mhiramat@redhat.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-07-05perf probe: Support tracing an entry of arrayMasami Hiramatsu3-23/+82
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: Masami Hiramatsu <mhiramat@redhat.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-07-05perf probe: Support "string" typeMasami Hiramatsu1-11/+48
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: Masami Hiramatsu <mhiramat@redhat.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-07-05perf: Version String fix, for fallback if not from gitThavidu Ranatunga1-8/+9
This gets rid of the default version fallback for Perf and changes it so that it returns the version of the kernel from it's Makefile (if sources were not from git, ie. if it was downloaded from a tarball) Signed-off-by: Thavidu Ranatunga <tharan@au1.ibm.com> Acked-by: Ian Munsie <imunsie@au1.ibm.com> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <1278316815-6099-2-git-send-email-tharan@au1.ibm.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-07-05perf: Version String fix, using kernel versionThavidu Ranatunga1-1/+1
Changes the Perf --version string such that it shows the kernel version as suggested by Ingo as follows: That way the perf that comes with v2.6.34 will be: perf version v2.6.34 while interim versions will have the version of the interim kernel - for example: perf version v2.6.35-rc4-70-g39ef13a This functionality was already in the perf version generator file except that it was looking for a .git in the perf directory instead of the kernel directory. Signed-off-by: Thavidu Ranatunga <tharan@au1.ibm.com> Acked-by: Ian Munsie <imunsie@au1.ibm.com> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <1278316815-6099-1-git-send-email-tharan@au1.ibm.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-07-05Merge commit 'v2.6.35-rc4' into perf/coreIngo Molnar1-1/+10
Merge reason: Pick up the latest perf fixes Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-07-01perf tools: Fix find tids routine by excluding "." and ".."Gui Jianfeng1-1/+10
Introduce a filter function to skip "." and ".." directories when calculating tid number, otherwise tid 0 will be included in the all_tid result array. Cc: Ingo Molnar <mingo@elte.hu> LKML-Reference: <4C185F68.1020505@cn.fujitsu.com> Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-29perf: Fix hist_entry__tui_annotate() build failureSrikar Dronamraju1-1/+1
When compiling perf on latest tip/master I see the following error: cc1: warnings being treated as errors util/newt.c: In function 'hist_entry__tui_annotate': util/newt.c:764: warning: 'ret' is used uninitialized in this function make: *** [util/newt.o] Error 1 I think the problem was introduced by commit 13f499f076c67675e6e3022973729b5d906a84e9 Below is a patch that fixes the problem. Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <20100629173226.GC23231@linux.vnet.ibm.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-06-28Merge branch 'linus' into perf/coreThomas Gleixner5-4/+33
Reason: Further changes conflict with upstream fixes Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2010-06-25Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 into perf/coreIngo Molnar1-77/+108
2010-06-24perf: Don't use 4 bytes as a default instruction breakpoint lengthFrederic Weisbecker1-2/+9
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: Frederic 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>
2010-06-21perf ui: Move objdump_line specific stuff out of ui_browserArnaldo Carvalho de Melo1-19/+30
By adding a ui_browser->refresh_entries() pure virtual member. Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-21perf ui: Separate showing the entries from running the browserArnaldo Carvalho de Melo1-31/+29
Another patch eroding the changes I had to move to a tree widget that doesn't requires adding all entries in an existing list/tree structure to a generic tree widget, but instead allows traversing just the entries that should appear on the screen on a given moment. Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-21perf ui: Introduce ui_browser->seek to support multiple list structuresArnaldo Carvalho de Melo1-26/+43
So that we can use the ui_browser on things like an rb_tree, etc. Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-21perf ui: Introduce routine ui_browser__is_current_entryArnaldo Carvalho de Melo1-3/+8
Will be used in more places in the new tree widget. Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-17perf session: fix error message on failure to open perf.dataAndy Isaacson1-2/+4
If we cannot open our data file, print strerror(errno) for a more comprehensible error message; and only suggest 'perf record' on ENOENT. In particular, this fixes the nonsensical advice when: % sudo perf record sleep 1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.009 MB perf.data (~381 samples) ] % perf trace failed to open file: perf.data (try 'perf record' first) % Cc: Ingo Molnar <mingo@elte.hu> LPU-Reference: <20100612033615.GA24731@hexapodia.org> Signed-off-by: Andy Isaacson <adi@hexapodia.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-17perf debug: fix hex dump partial final lineAndy Isaacson1-6/+4
The loop counter math in trace_event was much more complicated than necessary, resulting in incorrectly decoding the human-readable portion of the partial last line of hexdump in "perf trace -D" output: . 0020: 00 00 00 00 00 00 00 00 2f 73 62 69 6e 2f 69 6e ......../sbin/i . 0030: 69 74 00 00 00 00 00 00 /sbin/i With this fixed (and simpler!) code, we get the correct output: . 0020: 00 00 00 00 00 00 00 00 2f 73 62 69 6e 2f 69 6e ......../sbin/in . 0030: 69 74 00 00 00 00 00 00 it...... Cc: Ingo Molnar <mingo@elte.hu> LPU-Reference: <20100612024404.GA24469@hexapodia.org> Signed-off-by: Andy Isaacson <adi@hexapodia.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-17perf probe: Add kernel source path optionChase Douglas2-3/+56
The probe plugin requires access to the source code for some operations. The source code must be in the exact same location as specified by the DWARF tags, but sometimes the location is an absolute path that cannot be replicated by a normal user. This change adds the -s|--source option to allow the user to specify the root of the kernel source tree. Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Masami Hiramatsu <mhiramat@redhat.com> LKML-Reference: <1276543590-10486-1-git-send-email-chase.douglas@canonical.com> Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-17perf record: Add option to avoid updating buildid cacheStephane Eranian2-1/+10
There are situations where there is enough information in the perf.data to process the samples. Updating the buildid cache may add unecessary overhead in terms of disk space and time (copying large elf images). A persistent option to do this already exists via the perfconfig file, simply do: [buildid] dir = /dev/null This patch provides a way to suppress builid cache updates on a per-run basis. It addds a new option, -N, to perf record. Buildids are still generated in the perf.data file. Cc: David S. Miller <davem@davemloft.net> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> LKML-Reference: <4c19ef89.93ecd80a.40dc.fffff8e9@mx.google.com> Signed-off-by: Stephane Eranian <eranian@google.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-17perf symbols: Function descriptor symbol lookupEric B Munson1-3/+34
Currently symbol resolution does not work for 64-bit programs on architectures that use function descriptors such as ppc64. The problem is that a symbol doesn't point to a text address, it points to a data area that contains (amongst other things) a pointer to the text address. We look for a section called ".opd" which is the function descriptor area. To create the full symbol table, when we see a symbol in the function descriptor section we load the first pointer and use that as the text address. Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> LKML-Reference: <1276523793-15422-1-git-send-email-ebmunson@us.ibm.com> Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Eric B Munson <ebmunson@us.ibm.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-17perf session: Remove threads from tree on PERF_RECORD_EXITArnaldo Carvalho de Melo4-2/+20
Move them to a session->dead_threads list just like we do with maps that are replaced, because we may have hist_entries pointing to them. This fixes a bug when inserting maps for a new thread that reused the TID, mixing maps for two different threads, causing an endless loop. The code for insering maps should be made more robust but for .35 this is the minimalistic patch. Reported-by: Ingo Molnar <mingo@elte.hu> Cc: David S. Miller <davem@davemloft.net> Cc: Frédéric Weisbecker <fweisbec@gmail.com> 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: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-10perf record: Don't call newt functions when not initializedArnaldo Carvalho de Melo1-2/+13
When processing events we want to give visual feedback to the user when using the newt browser, so there are ui_progress calls in __perf_session__process_events, but those should check if newt is being used. Reported-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Tested-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>, Cc: Peter Zijlstra <peterz@infradead.org> Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <20100609123530.GB9471@ghostprotocols.net> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-05perf report: Implement --sort cpuArun Sharma5-2/+36
In a shared multi-core environment, users want to analyze why their program was slow. In particular, if the code ran slower only on certain CPUs due to interference from other programs or kernel threads, the user should be able to notice that. Sample usage: perf record -f -a -- sleep 3 perf report --sort cpu,comm Workload: program is running on 16 CPUs Experiencing interference from an antagonist only on 4 CPUs. Samples: 106218177676 cycles Overhead CPU Command ........ ... ............... 6.25% 2 program 6.24% 6 program 6.24% 11 program 6.24% 5 program 6.24% 9 program 6.24% 10 program 6.23% 15 program 6.23% 7 program 6.23% 3 program 6.23% 14 program 6.22% 1 program 6.20% 13 program 3.17% 12 program 3.15% 8 program 3.14% 0 program 3.13% 4 program 3.11% 4 antagonist 3.11% 0 antagonist 3.10% 8 antagonist 3.07% 12 antagonist Cc: David S. Miller <davem@davemloft.net> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <20100505181612.GA5091@sharma-home.net> Signed-off-by: Arun Sharma <aruns@google.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-05perf tools: Make event__preprocess_sample parse the sampleArnaldo Carvalho de Melo4-8/+34
Simplifying the tools that were using both in sequence and allowing upcoming simplifications, such as Arun's patch to sort by cpus. Cc: David S. Miller <davem@davemloft.net> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-05perf annotate: Ask objdump to demangle symbolsStephane Eranian1-1/+1
Perf report is demangling symbols but not annotate. The former uses internal demangling via libbdf or libiberty. The latter executes objdump which by default does not demangle symbols. This patch adds the -C option to the objdump cmdline to enable symbol demangling. Cc: David S. Miller <davem@davemloft.net> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <4c07b323.2126e30a.6245.0e1e@mx.google.com> Signed-off-by: Stephane Eranian <eranian@google.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-05perf buildid: add perfconfig option to specify buildid cache dirStephane Eranian6-11/+71
This patch adds the ability to specify an alternate directory to store the buildid cache (buildids, copy of binaries). By default, it is hardcoded to $HOME/.debug. This directory contains immutable data. The layout of the directory is such that no conflicts in filenames are possible. A modification in a file, yields a different buildid and thus a different location in the subdir hierarchy. You may want to put the buildid cache elsewhere because of disk space limitation or simply to share the cache between users. It is also useful for remote collect vs. local analysis of profiles. This patch adds a new config option to the perfconfig file. Under the tag 'buildid', there is a dir option. For instance, if you have: $ cat /etc/perfconfig [buildid] dir = /var/cache/perf-buildid All buildids and binaries are be saved in the directory specified. The perf record, buildid-list, buildid-cache, report, annotate, and archive commands will it to pull information out. The option can be set in the system-wide perfconfig file or in the $HOME/.perfconfig file. Cc: David S. Miller <davem@davemloft.net> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <4c055fb7.df0ce30a.5f0d.ffffae52@mx.google.com> Signed-off-by: Stephane Eranian <eranian@google.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-05perf tools: Add the ability to specify list of cpus to monitorStephane Eranian2-2/+57
This patch adds a -C option to stat, record, top to designate a list of CPUs to monitor. CPUs can be specified as a comma-separated list or ranges, no space allowed. Examples: $ perf record -a -C0-1,4-7 sleep 1 $ perf top -C0-4 $ perf stat -a -C1,2,3,4 sleep 1 With perf record in per-thread mode with inherit mode on, samples are collected only when the thread runs on the designated CPUs. The -C option does not turn on system-wide mode automatically. Cc: David S. Miller <davem@davemloft.net> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <4bff9496.d345d80a.41fe.7b00@mx.google.com> Signed-off-by: Stephane Eranian <eranian@google.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-05perf report: Make -D print sampled CPUStephane Eranian1-1/+2
It is useful to know on which CPU a sample was captured on. The information is captured with perf record -R but it was not printed out by perf report -D. This patch adds this. When -R is not used, cpu is set to -1to indicate that the CPU is unknown (it is not captured). Cc: David S. Miller <davem@davemloft.net> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <4bff964c.e88cd80a.3106.7d31@mx.google.com> Signed-off-by: Stephane Eranian <eranian@google.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-04perf symbols: Set the DSO long name when using symbol_conf.vmlinux_nameArnaldo Carvalho de Melo1-2/+6
We need to set the long name to the name specified via, for instance, 'perf annotate --vmlinux /path/to/vmlinux', if not it will remain as '[kernel.kallsyms]' and that will make annotate fail when passing this as the vmlinux name in the call to objdump. The way this is setup grew unwieldly and dso__load_vmlinux is the function that should allocate space for the long name, with callers not assuming that filenames should be allocated somehow by then (strdup, dso__build_id_filename, etc). For now this is the minimalistic patch, a proper fix for .36 will be made. Reported-by: Stephane Eranian <eranian@google.com> Tested-by: Stephane Eranian <eranian@google.com> Cc: David S. Miller <davem@davemloft.net> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <20100604003900.GD10469@ghostprotocols.net> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-02Merge branch 'perf/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 into perf/urgentIngo Molnar2-17/+35
2010-06-01perf scripts python: Give field dict to unhandled callbackPierre Tardy1-16/+34
trace_unhandled() callback does not allow to access event fields, this patch resolves the problem. It can also been used as a more pythonic and flexible way for script writters to demux event types This will for example greatly simplify pytimechart event demux. Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Acked-by: Tom Zanussi <tzanussi@gmail.com> Cc: Ingo Molnar <mingo@elte.hu>, Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <1275340329-2397-1-git-send-email-tardyp@gmail.com> Signed-off-by: Pierre Tardy <tardyp@gmail.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-01perf hist: fix objdump output parsingKonstantin Stepanyuk1-1/+1
hist_entry__annotate() runs objdump with -S option so the output may contain lines of any format. If a line starts with a colon strtoull() returns 0 and calculated offset will be negative. This causes perf annotate segfaults. Make sure that strtoull() has parsed at least one digit. Cc: David S. Miller <davem@davemloft.net> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Konstantin Stepanyuk <konstantin.stepanyuk@gmail.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-01perf: Do the comm inheritance per thread in event__process_taskFrederic Weisbecker1-7/+2
event__process_task() doesn't propagate the comm copy on clone, but only on process fork. So we loose all the tid:comm resolution for tasks that aren't a main process thread. Progragate the per thread granularity to event__process_task for pid resolution. This fixes various unresolved pids in perf sched, especially when we trace multithread processes. The problem is quickly reproducible with the messaging benchmark using the multithread mode "-t" : perf sched record perf bench sched messaging -t Signed-off-by: Frederic 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: Tom Zanussi <tzanussi@gmail.com> Cc: Stephane Eranian <eranian@google.com>
2010-05-31perf: Process comm events by tidFrederic Weisbecker1-2/+2
When we synthetize the existing running tasks though procfs, we walk through every threads of a process, queuing one comm events per tid. But then on report time, event__process_comm() only creates and sets the comm on a per process granularity. This is the right thing for comm events that came from the kernel, as they are only created on exec. Sub-threads then inherit their comm from fork events. But that doesn't work with our synthetized comm events taken from procfs informations as the per thread granularity is done on comm events directly there. Hence we need event__process_comm() to work with the tid rather than the pid. It won't change anything for comm events coming from the kernel but this will fix the synthetized ones. Before: $ ./perf report -D | grep COMM | grep firefox 0x2c7b8 [0x18]: PERF_RECORD_COMM: firefox:5297 0x2c7d0 [0x18]: PERF_RECORD_COMM: firefox:5297 0x2c7e8 [0x18]: PERF_RECORD_COMM: firefox:5297 0x2c800 [0x18]: PERF_RECORD_COMM: firefox:5297 0x2c818 [0x18]: PERF_RECORD_COMM: firefox:5297 0x2c830 [0x18]: PERF_RECORD_COMM: firefox:5297 After: $ ./perf report -D | grep COMM | grep firefox 0x2c7b8 [0x18]: PERF_RECORD_COMM: firefox:5297 0x2c7d0 [0x18]: PERF_RECORD_COMM: firefox:5299 0x2c7e8 [0x18]: PERF_RECORD_COMM: firefox:5300 0x2c800 [0x18]: PERF_RECORD_COMM: firefox:5308 0x2c818 [0x18]: PERF_RECORD_COMM: firefox:5309 0x2c830 [0x18]: PERF_RECORD_COMM: firefox:5312 This fixes various unresolved pid on perf sched. Signed-off-by: Frederic 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: Tom Zanussi <tzanussi@gmail.com> Cc: Stephane Eranian <eranian@google.com>
2010-05-27perf tui: Fix last use_browser problem related to .perfconfigArnaldo Carvalho de Melo1-1/+1
When we moved to using ~/.perfconfig to set the value of use_browser, it changed from a boolean to an int so that the convention used for use_pager was followed. That convention is: -1: unspecified, that is what use_{browser,pager} is initialized 0: Don't use the browser (should be TUI), because was explicitely set to 0/off/false on ~/.perfconfig [tui] cmd =, or because we're redirecting the stdout to a file or piping it to some other command (!isatty()). 1: Use the TUI Some code was not properly audited and continued testing it as a boolean, this seems to be the last one. Reported-by: Frédéric Weisbecker <fweisbec@gmail.com> Tested-by: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>