aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf (follow)
AgeCommit message (Collapse)AuthorFilesLines
2012-04-07perf annotate browser: string search: /?nArnaldo Carvalho de Melo1-1/+148
Using the same keystrokes as vim: / = search forward n = search next forward/backwards ? = search backwards Still needs to continue from start/end when not found, use HOME + / or END + ? for now. At some point we need a keybindings file to support ones favourite mode, erm, like EMACS, etc. Also we now need a 'h' window with all these keybindings. Requested-by: Andi Kleen <andi@firstfloor.org> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> 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-rv30xj2i258n0gwkzlu0c0bc@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-07perf report: Correct display of samples and events in headerAshay Rane2-7/+14
This patch prints the number of samples and the count of performance events separately. This allows comparing performance of different applications with each other. Previously, the sample count was displayed against an 'Events:' heading. With this patch, the header now reads (for example): Samples: 5K of event 'instructions' Event count (approx.): 2993026545 The patch covers both the stdio and the browser interface. Signed-off-by: Ashay Rane <ashay.rane@tacc.utexas.edu> [ committer note: Fixed wrt e7f01d1 ] Link: http://lkml.kernel.org/n/tip-h4nfjm8msedlk8gxkzivfh5y@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-07perf annotate browser: Initial support for navigating jump instructionsArnaldo Carvalho de Melo1-2/+61
Now it is possible to press ENTER or -> (right arrow) on jump instructions to navigate to the offset it points to. More work needed to support <- to go back, i.e. a jump history. This is done just like the callq case, i.e. parsing objdump output lines, but should move to use Masami's disassembler at some point. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> 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-706qqe2xibeiocuabp39mby7@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-07perf ui annotate browser: Add list based search for addr offsetArnaldo Carvalho de Melo1-9/+16
From the hit sorted rb_tree, so that we can use it in the upcoming jump instruction support. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> 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-44a7kl2atf9jxlg9npmotzdg@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-07perf ui annotate browser: Move callq handling to separate functionArnaldo Carvalho de Melo1-46/+48
So that we can as well handle jumps. Later we'll move this to a proper intruction table, etc. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> 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-i98elvmix2cw6t8stu1iagfd@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-07perf ui annotate browser: Allow toggling addr offset viewArnaldo Carvalho de Melo1-3/+12
The lines in objdump have this format: ffffffff8126543f: jne ffffffff81265494 <__list_del_entry+0x84> <SNIP> ffffffff81265494: mov %rdi,%rcx Since we now have objdump_line allowing tools to print the offset independently from the rest of the line, allow toggling a view where just offsets from the start of the function are shown: 2f: jne ffffffff81265494 <__list_del_entry+0x84> <SNIP> 84: mov %rdi,%rcx The offset view will be the default as soon as operations that deal with offsets in a function are handled accodringly, i.e. in offset view the above will become: 2f: jne __list_del_entry+0x84 <SNIP> 84: mov %rdi,%rcx And then a follow up patch will allow navigating thru jumps, just like we handle callq instructions. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> 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-4zpgimmz8xv7b5c920el7s45@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-07perf annotate: Allow printing objdump line addr in different colorArnaldo Carvalho de Melo5-16/+53
And by default use "magenta" for it. Both the --stdio and --tui routines follow the same semantics. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> 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-ede5zkaf7oorwvbqjezb4yg4@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-07perf ui browser: Return the current color when setting a new oneArnaldo Carvalho de Melo2-2/+6
Tools that want to change parts of the line to a different color and then restore the previous one will use this, starting with the annotate browser that will change the color of addresses if not on the current entry, i.e. the selected one. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic 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> Link: http://lkml.kernel.org/n/tip-uiajpevhxo4mzrvna6remb4a@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-05perf annotate: Validate addr in symbol__inc_addr_samplesArnaldo Carvalho de Melo4-3/+38
This routine was checking only if the provided address was after sym->end, not if it was before sym->start. Fix that by checking for both and return in both cases -ERANGE, so that tools can communicate this to the user properly, or if they chose so, to abort. This problem was reported previously but the fixes involved either doing what was being done for the > end case, i.e. silently drop the sample, returning 0, or aborting at this function, which is in a lib (or better, is slated to be at some point) and shouldn't abort. The 'report' tool already checks this value and uses pr_debug to warn the user. This patch makes the 'top' tool check it too and warn once per map where such range problem takes place. Reported-by: David Miller <davem@davemloft.net> Reported-by: Sorin Dumitru <dumitru.sorin87@gmail.com> Reported-by: Stephane Eranian <eranian@google.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/n/tip-lw8gs7p9i9nhldilo82tzpne@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-05perf hists browser: Fix NULL deref in hists browsing codeJiri Olsa1-0/+3
If there's an event with no samples in data file, the perf report command can segfault after entering the event details menu. Following steps reproduce the issue: # ./perf record -e syscalls:sys_enter_kexec_load,syscalls:sys_enter_mmap ls # ./perf report # enter '0 syscalls:sys_enter_kexec_load' menu # pres ENTER twice Above steps are valid assuming ls wont run kexec.. ;) The check for sellection to be NULL is missing. The fix makes sure it's being check. Above steps now endup with menu being displayed allowing 'Exit' as the only option. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1333570898-10505-2-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-05perf hists: Catch and handle out-of-date hist entry maps.David Miller1-0/+12
When a process exec()'s, all the maps are retired, but we keep the hist entries around which hold references to those outdated maps. If the same library gets mapped in for which we have hist entries, a new map will be created. But when we take a perf entry hit within that map, we'll find the existing hist entry with the older map. This causes symbol translations to be done incorrectly. For example, the perf entry processing will lookup the correct uptodate map entry and use that to calculate the symbol and DSO relative address. But later when we update the histogram we'll translate the address using the outdated map file instead leading to conditions such as out-of-range offsets in symbol__inc_addr_samples(). Therefore, update the map of the hist_entry dynamically at lookup/ creation time. Signed-off-by: David S. Miller <davem@davemloft.net> Cc: stable@kernel.org Link: http://lkml.kernel.org/r/20120327.031418.1220315351537060808.davem@davemloft.net Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-05perf annotate: Fix hist decayArnaldo Carvalho de Melo1-8/+4
We were only decaying the entries for the offsets that were associated with an objdump line. That way, when we accrued the whole instruction addr range, more than 100% was appearing in some cases in the live annotation TUI. Fix it by not traversing the source code line at all, just iterate thru the complete addr range decaying each one. Reported-by: Mike Galbraith <mgalbraith@suse.de> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> 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-hcae5oxa22syjrnalsxz7s6n@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-05perf top: Add intel_idle to the skip listArnaldo Carvalho de Melo1-0/+1
TODO: Accrue the cycles in the skip_list to an idle total, and show this on the 'top' UI, as suggested by Steven. Cc: Eric Dumazet <eric.dumazet@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/n/tip-9nfecmgghgl5747rjxqpc28f@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-04perf tools: Fix getrusage() related build failure on glibc trunkMarkus Trippelsdorf1-0/+1
On a system running glibc trunk perf doesn't build: CC builtin-sched.o builtin-sched.c: In function ‘get_cpu_usage_nsec_parent’: builtin-sched.c:399:16: error: storage size of ‘ru’ isn’t known builtin-sched.c:403:2: error: implicit declaration of function ‘getrusage’ [-Werror=implicit-function-declaration] [...] Fix it by including sys/resource.h. Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/20120404084527.GA294@x4 Signed-off-by: Ingo Molnar <mingo@kernel.org>
2012-03-31Merge branch 'perf/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgentIngo Molnar15-8546/+135
2012-03-30perf tools: Remove auto-generated bison/flex filesIngo Molnar9-8476/+30
These should not be in the Git history - they are auto-generated. Extend the Makefile rules of the parser files to include the generation run. Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/20120327183335.GA27621@gmail.com [ committer note: Fixed up O= handling ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-29perf annotate: Fix off by one symbol hist size allocation and hit accountingArnaldo Carvalho de Melo1-3/+3
We were not noticing it because symbol__inc_addr_samples was erroneously dropping samples that hit the last byte in a function. Working on a fix for a problem reported by David Miller, Stephane Eranian and Sorin Dumitru, where addresses < sym->start were causing problems, I noticed this other problem. Cc: David Ahern <dsahern@gmail.com> Cc: David Miller <davem@davemloft.net> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Sorin Dumitru <dumitru.sorin87@gmail.com> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-pqjaq4cr1xs2xen73pjhbav4@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-29perf tools: Add missing ref-cycles event back to event parserNamhyung Kim1-0/+1
The commit 89812fc81f8d ("perf tools: Add parser generator for events parsing") changed event parsing engine but missed the ref-cycles event. Add it. Signed-off-by: Namhyung Kim <namhyung.kim@lge.com> Acked-by: Jiri Olsa <jolsa@redhat.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1333016517-10591-1-git-send-email-namhyung.kim@lge.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-28perf annotate: addr2line wants addresses in same format as objdumpDavid Miller1-1/+1
Therefore, in symbol__get_source_line(), use map__rip_2objdump instead of calling map->unmap_ip() unconditionally. Link: http://lkml.kernel.org/r/20120325.162812.59519424882536855.davem@davemloft.net Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-28perf probe: Finder fails to resolve function name to addressPrashanth Nageshappa1-1/+3
If DIE entries corresponding to declarations appear before definition entry, probe finder returns error instead of continuing to look further for a definition entry. This patch ensures we reach to the DIE entry corresponding to the definition and get the function address. V2: A simpler solution based on Masami's suggestion. Signed-off-by: Prashanth Nageshappa <prashanth@linux.vnet.ibm.com> Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/4F703FB9.9020407@linux.vnet.ibm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-27perf symbols: Handle NULL dso in dso__name_lenDavid Miller1-0/+2
We should use "[unknown]" in this case, in concert with the code in _hist_entry__dso_snprintf(). Otherwise we'll crash when recomputing the histogram column lengths in hists__calc_col_len(). Signed-off-by: David S. Miller <davem@davemloft.net> Link: http://lkml.kernel.org/r/20120325.162822.2267799792062571623.davem@davemloft.net Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-27perf symbols: Do not include libgen.hDavid Miller1-1/+0
That causes us to end up using the XPG version of basename which can modify it's argument. Signed-off-by: David S. Miller <davem@davemloft.net> Link: http://lkml.kernel.org/r/20120327.000301.1122788061724345175.davem@davemloft.net Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-26perf tools: Fix bug in raw sample parsingStephane Eranian1-0/+2
In perf_event__parse_sample(), the array variable was not incremented by the amount of data used by the raw_data. That was okay until we added PERF_SAMPLE_BRANCH_STACK which depends on the array variable pointing to the beginning of the branch stack data. But that was not the case if branch stack was combined with raw mode sampling. That led to bogus branch stack addresses and count. The bug would show up with: $ perf record -R -b foo This patch fixes the problem by correctly moving the array pointer forward for RAW samples. Signed-off-by: Stephane Eranian <eranian@google.com> Cc: David Ahern <dsahern@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20120317222317.GA8803@quad [ committer note: Fix also later submitted by Jiri Olsa ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-26perf tools: Fix display of first level of callchainsFrederic Weisbecker1-64/+93
The callchain stdio mode display was written using a sorted by symbol report. In this mode we have only one callchain root per hist so we forgot to handle cases where we have multiple callchain root, as in per dso sorting for example. Fix this by handling these roots like any other branch, with the hist as the parent. Before: 1.97% libpthread-2.12.1.so | --- __libc_write create_worker bench_sched_messaging cmd_bench run_builtin main __libc_start_main | --- __libc_read create_worker bench_sched_messaging cmd_bench run_builtin main __libc_start_main After: 1.97% libpthread-2.12.1.so | |--36.97%-- __libc_write | create_worker | bench_sched_messaging | cmd_bench | run_builtin | main | __libc_start_main | |--31.47%-- __libc_read | create_worker | bench_sched_messaging | cmd_bench | run_builtin | main | __libc_start_main ... Single roots keep their entry without percentage because they have the same overhead than the hist they refer to. ie: 100% in fractal mode and the percentage of the hist in graph mode: 0.00% [k] reschedule_interrupt | --- default_idle amd_e400_idle cpu_idle start_secondary Reported-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: David Ahern <dsahern@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1332526010-15400-1-git-send-email-fweisbec@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-26perf tools: Switch module.h into export.hJiri Olsa2-1/+1
When merged to Linus's latest tree the perf build is broken due to following change in lib/rbtree.c object: lib: reduce the use of module.h wherever possible commit 8bc3bcc93a2b4e47d5d410146f6546bca6171663 Author: Paul Gortmaker <paul.gortmaker@windriver.com> Date: Wed Nov 16 21:29:17 2011 -0500 We need to move module.h header into export.h. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: acme@redhat.com Cc: a.p.zijlstra@chello.nl Cc: paulus@samba.org Cc: cjashfor@linux.vnet.ibm.com Cc: fweisbec@gmail.com Link: http://lkml.kernel.org/r/1332753425-3299-1-git-send-email-jolsa@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
2012-03-26Merge branch 'linus' into perf/urgentIngo Molnar1-1/+1
Merge reason: we need to fix a non-trivial merge conflict. Signed-off-by: Ingo Molnar <mingo@elte.hu>
2012-03-23bitops: rename for_each_set_bit_cont() in favor of analogous list.h functionAkinobu Mita1-1/+1
This renames for_each_set_bit_cont() to for_each_set_bit_from() because it is analogous to list_for_each_entry_from() in list.h rather than list_for_each_entry_continue(). This doesn't remove for_each_set_bit_cont() for now. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Robert Richter <robert.richter@amd.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-03-22perf diff: Fix to work with new hists designJiri Olsa5-30/+43
The perf diff command is broken since: perf hists: Threaded addition and sorting of entries commit 1980c2ebd7020d82c024b8c4046849b38e78e7da Several places were broken: - hists data need to be collected into opened sessions instead of into events - session's hists data need to be initialized properly when the session is created - hist_entry__pcnt_snprintf: the percentage and displacement buffer preparation must not use 'ret' because it's used as a pointer to the final buffer Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/20120322133726.GB1601@m.brq.redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-22perf tools: Fix modifier to be applied on correct eventsJiri Olsa6-337/+543
The event modifier needs to be applied only on the event definition it is attached to. The current state is that in case of multiple events definition (in single '-e' option, separated by ',') all will get modifier of the last one. Fixing this by adding separated list for each event definition, so the modifier is applied only to proper event(s). Added automated test to catch this, plus some other modifier tests. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1332267341-26338-3-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-22perf tools: Fix various casting issues for 32 bitsJiri Olsa2-2/+2
- util/parse-events.c(parse_events_add_breakpoint) need to use unsigned long instead of u64, otherwise we get following gcc error on 32 bits: error: cast from pointer to integer of different size - util/header.c(print_event_desc) cannot retype to signed type, otherwise we get following gcc error on 32 bits: error: comparison between signed and unsigned integer expressions Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1332267341-26338-2-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-22perf tools: Simplify event_read_id exit pathBorislav Petkov1-6/+4
We're freeing the token in any case so simplify the exit path by unifying it. No functional change. Signed-off-by: Borislav Petkov <bp@amd64.org> Link: http://lkml.kernel.org/r/1332339347-21342-1-git-send-email-bp@amd64.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-22Merge branch 'perf/urgent' into perf/coreArnaldo Carvalho de Melo14-34/+49
Merge Reason: to pick the fix: commit e7f01d1 perf tools: Use scnprintf where applicable Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-20Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tipLinus Torvalds74-710/+2632
Pull perf events changes for v3.4 from Ingo Molnar: - New "hardware based branch profiling" feature both on the kernel and the tooling side, on CPUs that support it. (modern x86 Intel CPUs with the 'LBR' hardware feature currently.) This new feature is basically a sophisticated 'magnifying glass' for branch execution - something that is pretty difficult to extract from regular, function histogram centric profiles. The simplest mode is activated via 'perf record -b', and the result looks like this in perf report: $ perf record -b any_call,u -e cycles:u branchy $ perf report -b --sort=symbol 52.34% [.] main [.] f1 24.04% [.] f1 [.] f3 23.60% [.] f1 [.] f2 0.01% [k] _IO_new_file_xsputn [k] _IO_file_overflow 0.01% [k] _IO_vfprintf_internal [k] _IO_new_file_xsputn 0.01% [k] _IO_vfprintf_internal [k] strchrnul 0.01% [k] __printf [k] _IO_vfprintf_internal 0.01% [k] main [k] __printf This output shows from/to branch columns and shows the highest percentage (from,to) jump combinations - i.e. the most likely taken branches in the system. "branches" can also include function calls and any other synchronous and asynchronous transitions of the instruction pointer that are not 'next instruction' - such as system calls, traps, interrupts, etc. This feature comes with (hopefully intuitive) flat ascii and TUI support in perf report. - Various 'perf annotate' visual improvements for us assembly junkies. It will now recognize function calls in the TUI and by hitting enter you can follow the call (recursively) and back, amongst other improvements. - Multiple threads/processes recording support in perf record, perf stat, perf top - which is activated via a comma-list of PIDs: perf top -p 21483,21485 perf stat -p 21483,21485 -ddd perf record -p 21483,21485 - Support for per UID views, via the --uid paramter to perf top, perf report, etc. For example 'perf top --uid mingo' will only show the tasks that I am running, excluding other users, root, etc. - Jump label restructurings and improvements - this includes the factoring out of the (hopefully much clearer) include/linux/static_key.h generic facility: struct static_key key = STATIC_KEY_INIT_FALSE; ... if (static_key_false(&key)) do unlikely code else do likely code ... static_key_slow_inc(); ... static_key_slow_inc(); ... The static_key_false() branch will be generated into the code with as little impact to the likely code path as possible. the static_key_slow_*() APIs flip the branch via live kernel code patching. This facility can now be used more widely within the kernel to micro-optimize hot branches whose likelihood matches the static-key usage and fast/slow cost patterns. - SW function tracer improvements: perf support and filtering support. - Various hardenings of the perf.data ABI, to make older perf.data's smoother on newer tool versions, to make new features integrate more smoothly, to support cross-endian recording/analyzing workflows better, etc. - Restructuring of the kprobes code, the splitting out of 'optprobes', and a corner case bugfix. - Allow the tracing of kernel console output (printk). - Improvements/fixes to user-space RDPMC support, allowing user-space self-profiling code to extract PMU counts without performing any system calls, while playing nice with the kernel side. - 'perf bench' improvements - ... and lots of internal restructurings, cleanups and fixes that made these features possible. And, as usual this list is incomplete as there were also lots of other improvements * 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (120 commits) perf report: Fix annotate double quit issue in branch view mode perf report: Remove duplicate annotate choice in branch view mode perf/x86: Prettify pmu config literals perf report: Enable TUI in branch view mode perf report: Auto-detect branch stack sampling mode perf record: Add HEADER_BRANCH_STACK tag perf record: Provide default branch stack sampling mode option perf tools: Make perf able to read files from older ABIs perf tools: Fix ABI compatibility bug in print_event_desc() perf tools: Enable reading of perf.data files from different ABI rev perf: Add ABI reference sizes perf report: Add support for taken branch sampling perf record: Add support for sampling taken branch perf tools: Add code to support PERF_SAMPLE_BRANCH_STACK x86/kprobes: Split out optprobe related code to kprobes-opt.c x86/kprobes: Fix a bug which can modify kernel code permanently x86/kprobes: Fix instruction recovery on optimized path perf: Add callback to flush branch_stack on context switch perf: Disable PERF_SAMPLE_BRANCH_* when not supported perf/x86: Add LBR software filter support for Intel CPUs ...
2012-03-19perf report: Add a simple GTK2-based 'perf report' browserPekka Enberg8-4/+272
This patch adds a simple GTK2-based browser to 'perf report' that's based on the TTY-based browser in builtin-report.c. To launch "perf report" using the new GTK interface just type: $ perf report --gtk The interface is somewhat limited in features at the moment: - No callgraph support - No KVM guest profiling support - No color coding for percentages - No sorting from the UI - ..and many, many more! That said, I think this patch a reasonable start to build future features on. Signed-off-by: Pekka Enberg <penberg@kernel.org> Cc: Colin Walters <walters@verbum.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Ingo Molnar <mingo@kernel.org> Link: http://lkml.kernel.org/r/alpine.LFD.2.02.1202231952410.6689@tux.localdomain [ committer note: Added #pragma to make gtk no strict prototype problem go away as suggested by Colin Walters modulo avoiding push/pop ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-19perf report: Document --symbol-filter optionNamhyung Kim1-0/+3
Add missing description of --symbol-filter in Documentation/perf-report.txt. Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Namhyung Kim <namhyung.kim@lge.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1332125628-23088-1-git-send-email-namhyung.kim@lge.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-19perf ui browser: Clean lines inside of the input windowNamhyung Kim1-3/+7
As Arnaldo pointed out, it should be cleared to prevent the window from displaying overlapped strings on the region. Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Namhyung Kim <namhyung.kim@lge.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1332125180-23041-1-git-send-email-namhyung.kim@lge.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-16perf report: Treat an argument as a symbol filterNamhyung Kim1-5/+10
As Ingo requested, it'd be better off treating first (and the only) argument as a symbol filter, so that user doesn't need to input the symbol on the dialog window on TUI. Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1331887855-874-5-git-send-email-namhyung.kim@lge.com Signed-off-by: Namhyung Kim <namhyung.kim@lge.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-16perf report: Add --symbol-filter optionNamhyung Kim1-0/+6
Add new --symbol-filter command line option to set appropriate filter string. Its short version is missing as I couldn't find an ideal one and --filter option of perf record also has no short version. Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1331887855-874-4-git-send-email-namhyung.kim@lge.com Signed-off-by: Namhyung Kim <namhyung.kim@lge.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-16perf ui browser: Add 's' key to filter by symbol nameNamhyung Kim1-1/+13
Now user can enter symbol name interested via ui_browser__input_window, and perf can process it using hists__filter_by_symbol(). Giving empty symbol (by pressing 's' followed by ENTER) will disable the filtering. Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1331887855-874-3-git-send-email-namhyung.kim@lge.com Signed-off-by: Namhyung Kim <namhyung.kim@lge.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-16perf ui browser: Introduce ui_browser__input_windowNamhyung Kim3-0/+82
The ui_browser__input_window() function is to get user's key input. Current implementation can handle maximum 49 characters. Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1331887855-874-2-git-send-email-namhyung.kim@lge.com Signed-off-by: Namhyung Kim <namhyung.kim@lge.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-16perf hists: Add hists__filter_by_symbolNamhyung Kim2-0/+37
This function will be used for simple (sub-)string matching filter based on user input. Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1331887855-874-1-git-send-email-namhyung.kim@lge.com Signed-off-by: Namhyung Kim <namhyung.kim@lge.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-16perf tools: Do not disable members of group eventNamhyung Kim3-5/+10
When event group is enabled for forked task (i.e. no target task/cpu was specified) all events were disabled and marked ->enable_on_exec. However they wouldn't be counted at all since only group leader will be enabled on exec actually. In contrast to perf stat, perf record doesn't have a real problem as it enables all the event before proceeding. But it needs to be fixed anyway IMHO. Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1331887340-32448-2-git-send-email-namhyung.kim@lge.com Signed-off-by: Namhyung Kim <namhyung.kim@lge.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-16perf stat: Fix event grouping on forked taskNamhyung Kim1-1/+1
When event group is enabled for forked task (i.e. no target task was specified) all events were disabled and marked ->enable_on_exec. However they are not counted at all since only group leader will be enabled on exec actually. So the result looked like below: $ ./perf stat --group -- sleep 1 Performance counter stats for 'sleep 1': 0.554926 task-clock # 0.001 CPUs utilized <not counted> context-switches <not counted> CPU-migrations <not counted> page-faults <not counted> cycles <not supported> stalled-cycles-frontend <not supported> stalled-cycles-backend <not counted> instructions <not counted> branches <not counted> branch-misses 1.001228093 seconds time elapsed Fix it by disabling group leader only. Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1331887340-32448-1-git-send-email-namhyung.kim@lge.com Signed-off-by: Namhyung Kim <namhyung.kim@lge.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-16perf tools: Add support to specify pmu style eventJiri Olsa5-100/+172
Added new event rule to the event definition grammar: event_def: event_pmu | ... event_pmu: PE_NAME '/' event_config '/' Using this rule, event could be now specified like: cpu/config=1,config1=2,config2=3/u where pmu name 'cpu' is looked up via following path: ${sysfs_mount}/bus/event_source/devices/${pmu} and config options are bound to the pmu's format definiton: ${sysfs_mount}/bus/event_source/devices/${pmu}/format The hardcoded config options still stays and have precedence over any format field defined with same name. Acked-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/n/tip-50d8nr94f8k4wkezutrxvthe@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-16perf tools: Add perf pmu object to access pmu format definitionJiri Olsa10-0/+4541
Adding pmu object which provides interface to pmu's sysfs event format definition located at: ${sysfs_mount}/bus/event_source/devices/${pmu}/format Following interface is exported: struct perf_pmu* perf_pmu__find(char *name); - this function returns pmu object, which is then passed as a handle to other interface functions int perf_pmu__config(struct perf_pmu *pmu, struct perf_event_attr *attr, struct list_head *head_terms); - this function configures perf_event_attr struct based on pmu's format definitions and config terms data, containined in head_terms list. Parser generator is used to retrive the pmu's format definition. The generated parser is part of the patch. Added makefile rule 'pmu-parser' to generate the parser code out of the bison/flex sources. Added builtin test 'Test perf pmu format parsing', which could be run like: perf test pmu Acked-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/n/tip-errz96u1668gj9wlop1zhpht@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-16perf tools: Add config options support for event parsingJiri Olsa9-447/+866
Adding a new rule to the event grammar to be able to specify values of additional attributes of symbolic event. The new syntax for event symbolic definition is: event_legacy_symbol: PE_NAME_SYM '/' event_config '/' | PE_NAME_SYM sep_slash_dc event_config: event_config ',' event_term | event_term event_term: PE_NAME '=' PE_NAME | PE_NAME '=' PE_VALUE PE_NAME sep_slash_dc: '/' | ':' | At the moment the config options are hardcoded to be used for legacy symbol events to define several perf_event_attr fields. It is: 'config' to define perf_event_attr::config 'config1' to define perf_event_attr::config1 'config2' to define perf_event_attr::config2 'period' to define perf_event_attr::sample_period Legacy events could be now specified as: cycles/period=100000/ If term is specified without the value assignment, then 1 is assigned by default. Acked-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/n/tip-mgkavww9790jbt2jdkooyv4q@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-16perf tools: Add parser generator for events parsingJiri Olsa10-341/+4752
Changing event parsing to use flex/bison parse generator. The event syntax stays as it was. grammar description: events: events ',' event | event event: event_def PE_MODIFIER_EVENT | event_def event_def: event_legacy_symbol sep_dc | event_legacy_cache sep_dc | event_legacy_breakpoint sep_dc | event_legacy_tracepoint sep_dc | event_legacy_numeric sep_dc | event_legacy_raw sep_dc event_legacy_symbol: PE_NAME_SYM event_legacy_cache: PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT | PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT | PE_NAME_CACHE_TYPE event_legacy_raw: PE_SEP_RAW PE_VALUE event_legacy_numeric: PE_VALUE ':' PE_VALUE event_legacy_breakpoint: PE_SEP_BP ':' PE_VALUE ':' PE_MODIFIER_BP event_breakpoint_type: PE_MODIFIER_BPTYPE | empty PE_NAME_SYM: cpu-cycles|cycles | stalled-cycles-frontend|idle-cycles-frontend | stalled-cycles-backend|idle-cycles-backend | instructions | cache-references | cache-misses | branch-instructions|branches | branch-misses | bus-cycles | cpu-clock | task-clock | page-faults|faults | minor-faults | major-faults | context-switches|cs | cpu-migrations|migrations | alignment-faults | emulation-faults PE_NAME_CACHE_TYPE: L1-dcache|l1-d|l1d|L1-data | L1-icache|l1-i|l1i|L1-instruction | LLC|L2 | dTLB|d-tlb|Data-TLB | iTLB|i-tlb|Instruction-TLB | branch|branches|bpu|btb|bpc | node PE_NAME_CACHE_OP_RESULT: load|loads|read | store|stores|write | prefetch|prefetches | speculative-read|speculative-load | refs|Reference|ops|access | misses|miss PE_MODIFIER_EVENT: [ukhp]{0,5} PE_MODIFIER_BP: [rwx] PE_SEP_BP: 'mem' PE_SEP_RAW: 'r' sep_dc: ':' | Added flex/bison files for event grammar parsing. The generated parser is part of the patch. Added makefile rule 'event-parser' to generate the parser code out of the bison/flex sources. Acked-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/n/tip-u4pfig5waq3ll2bfcdex8fgi@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-15perf tools: Adjust make rulesJan Beulich1-1/+5
Add rules to generate pre-processed files (just like are available for the normal kernel build), and adjust the rule to create assembly files from C ones to produce its output in the output directory rather than in the source tree. E.g. $ make -C tools/perf/ O=/tmp/perf /tmp/perf/builtin-top.i make: Entering directory `/home/git/linux/tools/perf' CC /tmp/perf/builtin-top.i make: Leaving directory `/home/git/linux/tools/perf' $ wc -l /tmp/perf/builtin-top.i 31379 /tmp/perf/builtin-top.i $ Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/4F588A0802000078000770FF@nat28.tlf.novell.com Signed-off-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-14perf tools, x86: Build perf on older user-space as wellIngo Molnar4-0/+10
On ancient systems I get this build failure: util/../../../arch/x86/include/asm/unistd.h:67:29: error: asm/unistd_64.h: No such file or directory In file included from util/cache.h:7, from builtin-test.c:8: util/../perf.h: In function ‘sys_perf_event_open’:In file included from util/../perf.h:16 perf.h:170: error: ‘__NR_perf_event_open’ undeclared (first use in this function) The reason is that this old system does not have the split unistd.h headers yet, from which to pick up the syscall definitions. Add the syscall numbers to the already existing i386 and x86_64 blocks in perf.h, and also provide empty include file stubs. With this patch perf builds and works fine on 5 years old user-space as well. Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Link: http://lkml.kernel.org/n/tip-jctwg64le1w47tuaoeyftsg9@git.kernel.org Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-03-14perf tools: Use scnprintf where applicableArnaldo Carvalho de Melo8-33/+35
Several places were expecting that the value returned was the number of characters printed, not what would be printed if there was space. Fix it by using the scnprintf and vscnprintf variants we inherited from the kernel sources. Some corner cases where the number of printed characters were not accounted were fixed too. Reported-by: Anton Blanchard <anton@samba.org> Cc: Anton Blanchard <anton@samba.org> Cc: Eric B Munson <emunson@mgebm.net> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic 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: Yanmin Zhang <yanmin_zhang@linux.intel.com> Cc: stable@kernel.org Link: http://lkml.kernel.org/n/tip-kwxo2eh29cxmd8ilixi2005x@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>