aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf (follow)
AgeCommit message (Collapse)AuthorFilesLines
2012-05-09perf stat: handle ENXIO error for perf_event_openDavid Ahern1-1/+6
perf stat on PPC currently fails to run: $ perf stat -- sleep 1 Error: open_counter returned with 6 (No such device or address). /bin/dmesg may provide additional information. Fatal: Not all events could be opened. The problem is that until 2.6.37 (behavior changed with commit b0a873e) perf on PPC returns ENXIO when hw_perf_event_init() fails. With this patch we get the expected behavior: $ perf stat -v -- sleep 1 cycles event is not supported by the kernel. stalled-cycles-frontend event is not supported by the kernel. stalled-cycles-backend event is not supported by the kernel. instructions event is not supported by the kernel. branches event is not supported by the kernel. branch-misses event is not supported by the kernel. ... Signed-off-by: David Ahern <dsahern@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1336490956-57145-1-git-send-email-dsahern@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-05-07perf: Turn off compiler warnings for flex and bison generated filesGreg Kroah-Hartman1-2/+2
We don't know what types of warnings different versions of flex and bison combined with different versions of gcc is going to generate, so just punt and don't warn about anything. This fixes the build of perf for me on an openSUSE 12.1 system. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> Link: http://lkml.kernel.org/r/20120504183254.GA11154@kroah.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
2012-05-01perf stat: Fix case where guest/host monitoring is not supported by kernelStephane Eranian1-4/+29
By default, perf stat sets exclude_guest = 1. But when you run perf on a kernel which does not support host/guest filtering, then you get an error saying the event in unsupported. This comes from the fact that when the perf_event_attr struct passed by the user is larger than the one known to the kernel there is safety check which ensures that all unknown bits are zero. But here, exclude_guest is 1 (part of the unknown bits) and thus the perf_event_open() syscall return EINVAL. To my surprise, running perf record on the same kernel did not exhibit the problem. The reason is that perf record handles the problem by catching the error and retrying with guest/host excludes set to zero. For some reason, this was not done with perf stat. This patch fixes this problem. Signed-off-by: Stephane Eranian <eranian@google.com> Cc: Gleb Natapov <gleb@redhat.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Joerg Roedel <joro@8bytes.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Robert Richter <robert.richter@amd.com> Link: http://lkml.kernel.org/r/20120427124538.GA7230@quad Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-05-01perf build-id: Fix filename size calculationNamhyung Kim1-1/+1
The filename is a pointer variable so the sizeof(filename) will return length of a pointer. Fix it by using 'size'. Signed-off-by: Namhyung Kim <namhyung@gmail.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1335881976-3282-1-git-send-email-namhyung@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-20perf symbols: Read plt symbols from proper symtab_type binaryJiri Olsa1-7/+6
When loading symbols from DSO we check multiple paths of DSO binary until we succeed to load symbols ('.symtab' section). Once symbols are read we try to load also plt symbols. During the reading of plt symbols, the dso file is reopened from location given by dso->long_name. This could be wrong in case we want process buildid binaries. The change is to make the plt symbols being read from the DSO path, that normal symbols were read from. 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/1334756818-6631-1-git-send-email-jolsa@redhat.com [ committer note: moved dso to be the first parameter of that function ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-17perf tools: Add 'G' and 'H' modifiers to event parsingGleb Natapov2-1/+31
They were dropped during conversion of event parser. Add test case to make sure this will not happen again. Signed-off-by: Gleb Natapov <gleb@redhat.com> Acked-by: Jiri Olsa <jolsa@redhat.com> Cc: Avi Kivity <avi@redhat.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/r/20120417111345.GK11918@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-16perf tools: Drop CROSS_COMPILE from flex and bison callsOtavio Salvador1-2/+2
The flex and bison tools generate arch-independent C code so its binaries are not prefixed with the target-arch prefix. With this patch the Linux 3.4-rc2 can be successfuly build on OE-Core. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Link: http://lkml.kernel.org/r/1334148270-13139-1-git-send-email-otavio@ossystems.com.br Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-16perf report: Fix crash showing warning related to kernel mapsDavid Ahern1-5/+12
While testing https://lkml.org/lkml/2012/4/10/123 I hit this crash: (gdb) bt 0 0x000000000042000f in __cmd_report (rep=0x7fff80cec580) at builtin-report.c:380 1 cmd_report (argc=0, argv=<optimized out>, prefix=<optimized out>) at builtin-report.c:759 2 0x0000000000414513 in run_builtin (p=0x7724a8, argc=3, argv=0x7fff80ceca70) at perf.c:273 3 0x0000000000413d41 in handle_internal_command (argv=0x7fff80ceca70, argc=3) at perf.c:345 4 run_argv (argv=0x7fff80cec880, argcp=0x7fff80cec88c) at perf.c:389 5 main (argc=3, argv=0x7fff80ceca70) at perf.c:487 kernel_map can be NULL, so need to handle it while dumping a warning to user. v2: - fixed RB_EMPTY_ROOT check -- desc takes the altnerative output when RB_EMPTY_ROOT is false. Signed-off-by: David Ahern <dsahern@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Namhyung Kim <namhyung.kim@lge.com> Link: http://lkml.kernel.org/r/1334544855-55021-1-git-send-email-dsahern@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-14perf archive: Correct cutting of symbolic linkChanho Park1-1/+2
If a '$PERF_BUILDID_DIR'(typically $HOME/.debug) is a symbolic link directory, cutting of the path will fail. Here is an example where a buildid directory is a symbolic link. / # ls -al /root lrwxrwxrwx 1 root root 13 Mar 26 2012 /root -> opt/home/root / # cd ~ /opt/home/root # perf record -a -g sleep 1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.322 MB perf.data (~14057 samples) ] /opt/home/root # perf archive tar: Removing leading `/' from member names Now please run: $ tar xvf perf.data.tar.bz2 -C ~/.debug wherever you need to run 'perf report' on. /opt/home/root # mkdir temp /opt/home/root # tar xf perf.data.tar.bz2 -C ./temp /opt/home/root # find ./temp -name "*kernel*" ./temp/opt/home/root/.debug/[kernel.kallsyms] -> If successfully cut off the path, [kernel.kallsyms] is located in top of the archived file. This patch enables to cut correctly even if the buildid directory is a symbolic link. Signed-off-by: Chanho Park <chanho61.park@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1333348109-12598-1-git-send-email-chanho61.park@samsung.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-14perf tools: Ignore auto-generated bison/flex filesNamhyung Kim1-0/+2
The commit 65f3e56e0c81 ("perf tools: Remove auto-generated bison/flex files") removed those files from git, so they'll be listed on untracked files after building perf. Fix it. Signed-off-by: Namhyung Kim <namhyung.kim@lge.com> Cc: Ingo Molnar <mingo@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/1333948274-20043-1-git-send-email-namhyung.kim@lge.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-14perf tools: Fix parsers' rules to dependenciesJiri Olsa1-11/+8
Currently the parsers objects (bison/flex related) are each time perf is built. No matter the generated files are already in place, the parser generation is executed every time. Changing the rules to have proper flex/bison objects generation dependencies. The parsers code is not rebuilt until the flex/bison source files are touched. Also when flex/bison source is changed, only dependent objects are rebuilt. 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/1334140791-3024-1-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-12perf tools: fix NO_GTK2 Makefile config errorStephane Eranian1-1/+1
In case the user specified NO_GTK2 on the make cmdline, compilation would fail with undefined symbol because the Makefile would not set the correct cpp variable: NO_GTK2 vs. NO_GTK2_SUPPORT. This patch renames the variable to the correct name. Signed-off-by: Stephane Eranian <eranian@google.com> Cc: David Ahern <dsahern@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Pekka Enberg <penberg@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20120410103513.GA9229@quad Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-12perf session: Skip event correctly for unknown id/machineJiri Olsa1-2/+2
In case the perf_session__process_event function fails, we estimate the next event offset. This is not necessary for sample event failing on unknown ID or machine. In such case we know proper size of the event, so we dont need to guess. Also failure statistics are updated correctly so we don't miss any information. Forcing perf_session__process_event to return 0 in case of unknown ID or machine. 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/1334233262-5679-3-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-04-11perf kvm: Finding struct machine fails for PERF_RECORD_MMAPNikunj A. Dadhania1-2/+10
Running 'perf kvm --host --guest --guestmount /tmp/guestmount record -a -g -- sleep 2' Was resulting in a segfault. For event type PERF_RECORD_MMAP, event->ip.pid is being used in perf_session__find_machine_for_cpumode, which is not correct. The event->ip.pid field happens to be 0 in this case and results in returning a NULL machine object. Finally, access to self->pid in machine__mmap_name, results in a segfault later. For PERF_RECORD_MMAP type, pass event->mmap.pid. Signed-off-by: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com> Reviewed-by: David Ahern <dsahern@gmail.com> Tested-by: David Ahern <dsahern@gmail.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Cc: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com> Link: http://lkml.kernel.org/r/20120409081835.10576.22018.stgit@abhimanyu.in.ibm.com 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>