2009-12-12 02:24:02 +03:00
|
|
|
#include <linux/kernel.h>
|
2013-06-11 19:29:18 +04:00
|
|
|
#include <traceevent/event-parse.h>
|
2009-12-12 02:24:02 +03:00
|
|
|
|
perf tools: Cross platform perf.data analysis support
There are still some problems related to loading vmlinux files,
but those are unrelated to the feature implemented in this
patch, so will get fixed in the next patches, but here are some
results:
1. collect perf.data file on a Fedora 12 machine, x86_64, 64-bit
userland
2. transfer it to a Debian Testing machine, PARISC64, 32-bit
userland
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | head -5
74f9930ee94475b6b3238caf3725a50d59cb994b [kernel.kallsyms]
55fdd56670453ea66c011158c4b9d30179c1d049 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/ipt_MASQUERADE.ko
41adff63c730890480980d5d8ba513f1c216a858 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/iptable_nat.ko
90a33def1077bb8e97b8a78546dc96c2de62df46 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/nf_nat.ko
984c7bea90ce1376d5c8e7ef43a781801286e62d /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/tun.ko
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | tail -5
22492f3753c6a67de5c7ccbd6b863390c92c0723 /usr/lib64/libXt.so.6.0.0
353802bb7e1b895ba43507cc678f951e778e4c6f /usr/lib64/libMagickCore.so.2.0.0
d10c2897558595efe7be8b0584cf7e6398bc776c /usr/lib64/libfprint.so.0.0.0
a83ecfb519a788774a84d5ddde633c9ba56c03ab /home/acme/bin/perf
d3ca765a8ecf257d263801d7ad8c49c189082317 /usr/lib64/libdwarf.so.0.0
acme@parisc:~/git/linux-2.6-tip$
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm
The file [kernel.kallsyms] cannot be used, trying to use /proc/kallsyms...
^^^^ The problem related to vmlinux handling, it shouldn't be trying this
^^^^ rather alien /proc/kallsyms at all...
/lib64/libpthread-2.10.2.so with build id 5c68f7afeb33309c78037e374b0deee84dd441f6 not found, continuing without symbols
/lib64/libc-2.10.2.so with build id eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 not found, continuing without symbols
/home/acme/bin/perf with build id a83ecfb519a788774a84d5ddde633c9ba56c03ab not found, continuing without symbols
/usr/sbin/openvpn with build id f2037a091ef36b591187a858d75e203690ea9409 not found, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/e1000e/e1000e.ko, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko, continuing without symbols
<SNIP more complaints about not finding the right build-ids,
those will have to wait for 'perf archive' or plain
copying what was collected by 'perf record' on the x86_64,
source machine, see further below for an example of this >
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get when running the same command for the
same perf.data file on the F12, x86_64, source machine:
[root@doppio linux-2.6-tip]# perf report --sort comm
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
[root@doppio linux-2.6-tip]#
The other modes work as well, modulo the problem with vmlinux:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object
# ........ ............... .................................
#
35.11% find ffffffff81002b5a
18.25% perf ffffffff8102235f
16.17% find libc-2.10.2.so
9.07% find find
5.80% swapper ffffffff8102235f
3.95% perf libc-2.10.2.so
2.33% init ffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k
1.35% find [e1000e]
0.68% sleep libc-2.10.2.so
acme@parisc:~/git/linux-2.6-tip$
And the lack of the right buildids:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso,symbol 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object Symbol
# ........ ............... ................................. ......
#
35.11% find ffffffff81002b5a [k] 0xffffffff81002b5a
18.25% perf ffffffff8102235f [k] 0xffffffff8102235f
16.17% find libc-2.10.2.so [.] 0x00000000045782
9.07% find find [.] 0x0000000000fb0e
5.80% swapper ffffffff8102235f [k] 0xffffffff8102235f
3.95% perf libc-2.10.2.so [.] 0x0000000007f398
2.33% init ffffffff810091b9 [k] 0xffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k [.] 0x00000000105440
1.35% find [e1000e] [k] 0x00000000010948
0.68% sleep libc-2.10.2.so [.] 0x0000000011ad5b
acme@parisc:~/git/linux-2.6-tip$
But if we:
acme@parisc:~/git/linux-2.6-tip$ ls ~/.debug
ls: cannot access /home/acme/.debug: No such file or directory
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/lib64/libc-2.10.2.so/
acme@parisc:~/git/linux-2.6-tip$ scp doppio:.debug/lib64/libc-2.10.2.so/* ~/.debug/lib64/libc-2.10.2.so/
acme@doppio's password:
eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 100% 1783KB 714.7KB/s 00:02
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/.build-id/eb
acme@parisc:~/git/linux-2.6-tip$ ln -s ../../lib64/libc-2.10.2.so/eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 ~/.debug/.build-id/eb/4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1
acme@parisc:~/git/linux-2.6-tip$ perf report --dsos libc-2.10.2.so 2> /dev/null
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get on the source, F12, x86_64 machine:
[root@doppio linux-2.6-tip]# perf report --dsos libc-2.10.2.so
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[root@doppio linux-2.6-tip]#
So I think this is really, really nice in that it demonstrates
the portability of perf.data files and the use of build-ids
accross such aliens worlds :-)
There are some things to fix tho, like the bitmap on the header,
but things are looking good.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1263478990-8200-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-01-14 17:23:10 +03:00
|
|
|
#include <byteswap.h>
|
2009-12-12 02:24:02 +03:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/types.h>
|
2010-05-19 01:29:23 +04:00
|
|
|
#include <sys/mman.h>
|
2009-12-12 02:24:02 +03:00
|
|
|
|
2011-03-06 03:40:06 +03:00
|
|
|
#include "evlist.h"
|
|
|
|
#include "evsel.h"
|
2009-12-12 02:24:02 +03:00
|
|
|
#include "session.h"
|
2011-11-28 14:30:20 +04:00
|
|
|
#include "tool.h"
|
2009-12-14 19:22:59 +03:00
|
|
|
#include "sort.h"
|
2009-12-12 02:24:02 +03:00
|
|
|
#include "util.h"
|
2011-07-04 15:57:50 +04:00
|
|
|
#include "cpumap.h"
|
2012-08-07 17:20:45 +04:00
|
|
|
#include "perf_regs.h"
|
2012-09-10 20:50:19 +04:00
|
|
|
#include "vdso.h"
|
2009-12-12 02:24:02 +03:00
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
static int perf_session__open(struct perf_session *session)
|
2009-12-12 02:24:02 +03:00
|
|
|
{
|
2013-11-05 22:32:36 +04:00
|
|
|
struct perf_data_file *file = session->file;
|
2010-04-02 08:59:15 +04:00
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
if (perf_session__read_header(session) < 0) {
|
2012-02-10 02:21:06 +04:00
|
|
|
pr_err("incompatible file format (rerun with -v to learn more)");
|
2013-10-15 18:27:33 +04:00
|
|
|
return -1;
|
2009-12-12 02:24:02 +03:00
|
|
|
}
|
|
|
|
|
2013-10-15 18:27:34 +04:00
|
|
|
if (perf_data_file__is_pipe(file))
|
|
|
|
return 0;
|
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
if (!perf_evlist__valid_sample_type(session->evlist)) {
|
2011-06-02 18:04:54 +04:00
|
|
|
pr_err("non matching sample_type");
|
2013-10-15 18:27:33 +04:00
|
|
|
return -1;
|
2011-06-02 18:04:54 +04:00
|
|
|
}
|
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
if (!perf_evlist__valid_sample_id_all(session->evlist)) {
|
2011-06-02 18:04:54 +04:00
|
|
|
pr_err("non matching sample_id_all");
|
2013-10-15 18:27:33 +04:00
|
|
|
return -1;
|
2011-06-02 18:04:54 +04:00
|
|
|
}
|
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
if (!perf_evlist__valid_read_format(session->evlist)) {
|
2012-10-10 19:38:13 +04:00
|
|
|
pr_err("non matching read_format");
|
2013-10-15 18:27:33 +04:00
|
|
|
return -1;
|
2012-10-10 19:38:13 +04:00
|
|
|
}
|
|
|
|
|
2009-12-12 02:24:02 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-08-02 02:31:00 +04:00
|
|
|
void perf_session__set_id_hdr_size(struct perf_session *session)
|
2010-12-02 15:25:28 +03:00
|
|
|
{
|
2012-08-02 02:31:00 +04:00
|
|
|
u16 id_hdr_size = perf_evlist__id_hdr_size(session->evlist);
|
|
|
|
|
|
|
|
machines__set_id_hdr_size(&session->machines, id_hdr_size);
|
2010-12-02 15:25:28 +03:00
|
|
|
}
|
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
int perf_session__create_kernel_maps(struct perf_session *session)
|
2010-04-19 09:32:50 +04:00
|
|
|
{
|
2013-11-05 22:32:36 +04:00
|
|
|
int ret = machine__create_kernel_maps(&session->machines.host);
|
2010-04-19 09:32:50 +04:00
|
|
|
|
|
|
|
if (ret >= 0)
|
2013-11-05 22:32:36 +04:00
|
|
|
ret = machines__create_guest_kernel_maps(&session->machines);
|
2010-04-19 09:32:50 +04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
static void perf_session__destroy_kernel_maps(struct perf_session *session)
|
perf session: Free the ref_reloc_sym memory at the right place
Which is at perf_session__destroy_kernel_maps, counterpart to the
perf_session__create_kernel_maps where the kmap structure is located, just
after the vmlinux_maps.
Make it also check if the kernel maps were actually created, which may not
be the case if, for instance, perf_session__new can't complete due to
permission problems in, for instance, a 'perf report' case, when a
segfault will take place, that is how this was noticed.
The problem was introduced in d65a458, thus post .35.
This also adds code to release guest machines as them are also created
in perf_session__create_kernel_maps, so should be deleted on this newly
introduced counterpart, perf_session__destroy_kernel_maps.
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-08-03 01:18:28 +04:00
|
|
|
{
|
2013-11-05 22:32:36 +04:00
|
|
|
machines__destroy_kernel_maps(&session->machines);
|
perf session: Free the ref_reloc_sym memory at the right place
Which is at perf_session__destroy_kernel_maps, counterpart to the
perf_session__create_kernel_maps where the kmap structure is located, just
after the vmlinux_maps.
Make it also check if the kernel maps were actually created, which may not
be the case if, for instance, perf_session__new can't complete due to
permission problems in, for instance, a 'perf report' case, when a
segfault will take place, that is how this was noticed.
The problem was introduced in d65a458, thus post .35.
This also adds code to release guest machines as them are also created
in perf_session__create_kernel_maps, so should be deleted on this newly
introduced counterpart, perf_session__destroy_kernel_maps.
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-08-03 01:18:28 +04:00
|
|
|
}
|
|
|
|
|
2013-10-15 18:27:32 +04:00
|
|
|
struct perf_session *perf_session__new(struct perf_data_file *file,
|
|
|
|
bool repipe, struct perf_tool *tool)
|
2009-12-12 02:24:02 +03:00
|
|
|
{
|
2013-11-05 22:32:36 +04:00
|
|
|
struct perf_session *session = zalloc(sizeof(*session));
|
2011-12-07 13:02:54 +04:00
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
if (!session)
|
2009-12-12 02:24:02 +03:00
|
|
|
goto out;
|
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
session->repipe = repipe;
|
|
|
|
INIT_LIST_HEAD(&session->ordered_samples.samples);
|
|
|
|
INIT_LIST_HEAD(&session->ordered_samples.sample_cache);
|
|
|
|
INIT_LIST_HEAD(&session->ordered_samples.to_free);
|
|
|
|
machines__init(&session->machines);
|
2009-12-12 02:24:02 +03:00
|
|
|
|
2013-10-15 18:27:33 +04:00
|
|
|
if (file) {
|
|
|
|
if (perf_data_file__open(file))
|
2010-01-28 02:05:52 +03:00
|
|
|
goto out_delete;
|
2013-10-15 18:27:33 +04:00
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
session->file = file;
|
2013-10-15 18:27:33 +04:00
|
|
|
|
|
|
|
if (perf_data_file__is_read(file)) {
|
2013-11-05 22:32:36 +04:00
|
|
|
if (perf_session__open(session) < 0)
|
2013-10-15 18:27:33 +04:00
|
|
|
goto out_close;
|
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
perf_session__set_id_hdr_size(session);
|
2013-10-15 18:27:33 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!file || perf_data_file__is_write(file)) {
|
2010-01-28 02:05:52 +03:00
|
|
|
/*
|
|
|
|
* In O_RDONLY mode this will be performed when reading the
|
2011-01-29 19:01:45 +03:00
|
|
|
* kernel MMAP event, in perf_event__process_mmap().
|
2010-01-28 02:05:52 +03:00
|
|
|
*/
|
2013-11-05 22:32:36 +04:00
|
|
|
if (perf_session__create_kernel_maps(session) < 0)
|
2010-01-28 02:05:52 +03:00
|
|
|
goto out_delete;
|
|
|
|
}
|
2009-12-28 02:37:02 +03:00
|
|
|
|
2011-11-28 14:30:20 +04:00
|
|
|
if (tool && tool->ordering_requires_timestamps &&
|
2013-11-05 22:32:36 +04:00
|
|
|
tool->ordered_samples && !perf_evlist__sample_id_all(session->evlist)) {
|
2010-12-10 06:09:16 +03:00
|
|
|
dump_printf("WARNING: No sample_id_all support, falling back to unordered processing\n");
|
2011-11-28 14:30:20 +04:00
|
|
|
tool->ordered_samples = false;
|
2010-12-10 06:09:16 +03:00
|
|
|
}
|
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
return session;
|
2013-10-15 18:27:33 +04:00
|
|
|
|
|
|
|
out_close:
|
|
|
|
perf_data_file__close(file);
|
|
|
|
out_delete:
|
2013-11-05 22:32:36 +04:00
|
|
|
perf_session__delete(session);
|
2013-10-15 18:27:33 +04:00
|
|
|
out:
|
perf session: Move kmaps to perf_session
There is still some more work to do to disentangle map creation
from DSO loading, but this happens only for the kernel, and for
the early adopters of perf diff, where this disentanglement
matters most, we'll be testing different kernels, so no problem
here.
Further clarification: right now we create the kernel maps for
the various modules and discontiguous kernel text maps when
loading the DSO, we should do it as a two step process, first
creating the maps, for multiple mappings with the same DSO
store, then doing the dso load just once, for the first hit on
one of the maps sharing this DSO backing store.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1260741029-4430-6-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-12-14 00:50:29 +03:00
|
|
|
return NULL;
|
2009-12-12 02:24:02 +03:00
|
|
|
}
|
|
|
|
|
2011-11-09 19:24:25 +04:00
|
|
|
static void perf_session__delete_dead_threads(struct perf_session *session)
|
|
|
|
{
|
2012-12-19 02:15:48 +04:00
|
|
|
machine__delete_dead_threads(&session->machines.host);
|
2011-11-09 19:24:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void perf_session__delete_threads(struct perf_session *session)
|
|
|
|
{
|
2012-12-19 02:15:48 +04:00
|
|
|
machine__delete_threads(&session->machines.host);
|
2011-11-09 19:24:25 +04:00
|
|
|
}
|
|
|
|
|
2012-11-21 08:43:19 +04:00
|
|
|
static void perf_session_env__delete(struct perf_session_env *env)
|
|
|
|
{
|
|
|
|
free(env->hostname);
|
|
|
|
free(env->os_release);
|
|
|
|
free(env->version);
|
|
|
|
free(env->arch);
|
|
|
|
free(env->cpu_desc);
|
|
|
|
free(env->cpuid);
|
|
|
|
|
|
|
|
free(env->cmdline);
|
|
|
|
free(env->sibling_cores);
|
|
|
|
free(env->sibling_threads);
|
|
|
|
free(env->numa_nodes);
|
|
|
|
free(env->pmu_mappings);
|
|
|
|
}
|
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
void perf_session__delete(struct perf_session *session)
|
2009-12-12 02:24:02 +03:00
|
|
|
{
|
2013-11-05 22:32:36 +04:00
|
|
|
perf_session__destroy_kernel_maps(session);
|
|
|
|
perf_session__delete_dead_threads(session);
|
|
|
|
perf_session__delete_threads(session);
|
|
|
|
perf_session_env__delete(&session->header.env);
|
|
|
|
machines__exit(&session->machines);
|
|
|
|
if (session->file)
|
|
|
|
perf_data_file__close(session->file);
|
|
|
|
free(session);
|
2012-09-10 20:50:19 +04:00
|
|
|
vdso__exit();
|
2009-12-12 02:24:02 +03:00
|
|
|
}
|
2009-12-14 19:22:59 +03:00
|
|
|
|
2013-07-04 17:20:21 +04:00
|
|
|
static int process_event_synth_tracing_data_stub(struct perf_tool *tool
|
|
|
|
__maybe_unused,
|
|
|
|
union perf_event *event
|
2012-09-11 02:15:03 +04:00
|
|
|
__maybe_unused,
|
|
|
|
struct perf_session *session
|
|
|
|
__maybe_unused)
|
2011-11-25 14:19:45 +04:00
|
|
|
{
|
|
|
|
dump_printf(": unhandled!\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-07-04 17:20:21 +04:00
|
|
|
static int process_event_synth_attr_stub(struct perf_tool *tool __maybe_unused,
|
|
|
|
union perf_event *event __maybe_unused,
|
2012-09-11 02:15:03 +04:00
|
|
|
struct perf_evlist **pevlist
|
|
|
|
__maybe_unused)
|
2011-11-12 04:45:41 +04:00
|
|
|
{
|
|
|
|
dump_printf(": unhandled!\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-09-11 02:15:03 +04:00
|
|
|
static int process_event_sample_stub(struct perf_tool *tool __maybe_unused,
|
|
|
|
union perf_event *event __maybe_unused,
|
|
|
|
struct perf_sample *sample __maybe_unused,
|
|
|
|
struct perf_evsel *evsel __maybe_unused,
|
|
|
|
struct machine *machine __maybe_unused)
|
2011-03-15 21:44:01 +03:00
|
|
|
{
|
|
|
|
dump_printf(": unhandled!\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-09-11 02:15:03 +04:00
|
|
|
static int process_event_stub(struct perf_tool *tool __maybe_unused,
|
|
|
|
union perf_event *event __maybe_unused,
|
|
|
|
struct perf_sample *sample __maybe_unused,
|
|
|
|
struct machine *machine __maybe_unused)
|
2009-12-28 02:36:59 +03:00
|
|
|
{
|
|
|
|
dump_printf(": unhandled!\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-09-11 02:15:03 +04:00
|
|
|
static int process_finished_round_stub(struct perf_tool *tool __maybe_unused,
|
|
|
|
union perf_event *event __maybe_unused,
|
|
|
|
struct perf_session *perf_session
|
|
|
|
__maybe_unused)
|
2011-11-28 13:56:39 +04:00
|
|
|
{
|
|
|
|
dump_printf(": unhandled!\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-11-28 14:30:20 +04:00
|
|
|
static int process_finished_round(struct perf_tool *tool,
|
2011-11-25 14:19:45 +04:00
|
|
|
union perf_event *event,
|
|
|
|
struct perf_session *session);
|
2010-05-03 17:14:33 +04:00
|
|
|
|
2013-08-03 00:05:41 +04:00
|
|
|
void perf_tool__fill_defaults(struct perf_tool *tool)
|
2009-12-28 02:36:59 +03:00
|
|
|
{
|
2011-11-28 14:30:20 +04:00
|
|
|
if (tool->sample == NULL)
|
|
|
|
tool->sample = process_event_sample_stub;
|
|
|
|
if (tool->mmap == NULL)
|
|
|
|
tool->mmap = process_event_stub;
|
2013-09-23 05:44:59 +04:00
|
|
|
if (tool->mmap2 == NULL)
|
|
|
|
tool->mmap2 = process_event_stub;
|
2011-11-28 14:30:20 +04:00
|
|
|
if (tool->comm == NULL)
|
|
|
|
tool->comm = process_event_stub;
|
|
|
|
if (tool->fork == NULL)
|
|
|
|
tool->fork = process_event_stub;
|
|
|
|
if (tool->exit == NULL)
|
|
|
|
tool->exit = process_event_stub;
|
|
|
|
if (tool->lost == NULL)
|
|
|
|
tool->lost = perf_event__process_lost;
|
|
|
|
if (tool->read == NULL)
|
|
|
|
tool->read = process_event_sample_stub;
|
|
|
|
if (tool->throttle == NULL)
|
|
|
|
tool->throttle = process_event_stub;
|
|
|
|
if (tool->unthrottle == NULL)
|
|
|
|
tool->unthrottle = process_event_stub;
|
|
|
|
if (tool->attr == NULL)
|
|
|
|
tool->attr = process_event_synth_attr_stub;
|
|
|
|
if (tool->tracing_data == NULL)
|
|
|
|
tool->tracing_data = process_event_synth_tracing_data_stub;
|
|
|
|
if (tool->build_id == NULL)
|
|
|
|
tool->build_id = process_finished_round_stub;
|
|
|
|
if (tool->finished_round == NULL) {
|
|
|
|
if (tool->ordered_samples)
|
|
|
|
tool->finished_round = process_finished_round;
|
2010-05-03 17:14:33 +04:00
|
|
|
else
|
2011-11-28 14:30:20 +04:00
|
|
|
tool->finished_round = process_finished_round_stub;
|
2010-05-03 17:14:33 +04:00
|
|
|
}
|
2009-12-28 02:36:59 +03:00
|
|
|
}
|
2012-06-08 18:47:51 +04:00
|
|
|
|
|
|
|
void mem_bswap_32(void *src, int byte_size)
|
|
|
|
{
|
|
|
|
u32 *m = src;
|
|
|
|
while (byte_size > 0) {
|
|
|
|
*m = bswap_32(*m);
|
|
|
|
byte_size -= sizeof(u32);
|
|
|
|
++m;
|
|
|
|
}
|
|
|
|
}
|
2009-12-28 02:36:59 +03:00
|
|
|
|
perf tools: Cross platform perf.data analysis support
There are still some problems related to loading vmlinux files,
but those are unrelated to the feature implemented in this
patch, so will get fixed in the next patches, but here are some
results:
1. collect perf.data file on a Fedora 12 machine, x86_64, 64-bit
userland
2. transfer it to a Debian Testing machine, PARISC64, 32-bit
userland
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | head -5
74f9930ee94475b6b3238caf3725a50d59cb994b [kernel.kallsyms]
55fdd56670453ea66c011158c4b9d30179c1d049 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/ipt_MASQUERADE.ko
41adff63c730890480980d5d8ba513f1c216a858 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/iptable_nat.ko
90a33def1077bb8e97b8a78546dc96c2de62df46 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/nf_nat.ko
984c7bea90ce1376d5c8e7ef43a781801286e62d /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/tun.ko
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | tail -5
22492f3753c6a67de5c7ccbd6b863390c92c0723 /usr/lib64/libXt.so.6.0.0
353802bb7e1b895ba43507cc678f951e778e4c6f /usr/lib64/libMagickCore.so.2.0.0
d10c2897558595efe7be8b0584cf7e6398bc776c /usr/lib64/libfprint.so.0.0.0
a83ecfb519a788774a84d5ddde633c9ba56c03ab /home/acme/bin/perf
d3ca765a8ecf257d263801d7ad8c49c189082317 /usr/lib64/libdwarf.so.0.0
acme@parisc:~/git/linux-2.6-tip$
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm
The file [kernel.kallsyms] cannot be used, trying to use /proc/kallsyms...
^^^^ The problem related to vmlinux handling, it shouldn't be trying this
^^^^ rather alien /proc/kallsyms at all...
/lib64/libpthread-2.10.2.so with build id 5c68f7afeb33309c78037e374b0deee84dd441f6 not found, continuing without symbols
/lib64/libc-2.10.2.so with build id eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 not found, continuing without symbols
/home/acme/bin/perf with build id a83ecfb519a788774a84d5ddde633c9ba56c03ab not found, continuing without symbols
/usr/sbin/openvpn with build id f2037a091ef36b591187a858d75e203690ea9409 not found, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/e1000e/e1000e.ko, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko, continuing without symbols
<SNIP more complaints about not finding the right build-ids,
those will have to wait for 'perf archive' or plain
copying what was collected by 'perf record' on the x86_64,
source machine, see further below for an example of this >
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get when running the same command for the
same perf.data file on the F12, x86_64, source machine:
[root@doppio linux-2.6-tip]# perf report --sort comm
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
[root@doppio linux-2.6-tip]#
The other modes work as well, modulo the problem with vmlinux:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object
# ........ ............... .................................
#
35.11% find ffffffff81002b5a
18.25% perf ffffffff8102235f
16.17% find libc-2.10.2.so
9.07% find find
5.80% swapper ffffffff8102235f
3.95% perf libc-2.10.2.so
2.33% init ffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k
1.35% find [e1000e]
0.68% sleep libc-2.10.2.so
acme@parisc:~/git/linux-2.6-tip$
And the lack of the right buildids:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso,symbol 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object Symbol
# ........ ............... ................................. ......
#
35.11% find ffffffff81002b5a [k] 0xffffffff81002b5a
18.25% perf ffffffff8102235f [k] 0xffffffff8102235f
16.17% find libc-2.10.2.so [.] 0x00000000045782
9.07% find find [.] 0x0000000000fb0e
5.80% swapper ffffffff8102235f [k] 0xffffffff8102235f
3.95% perf libc-2.10.2.so [.] 0x0000000007f398
2.33% init ffffffff810091b9 [k] 0xffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k [.] 0x00000000105440
1.35% find [e1000e] [k] 0x00000000010948
0.68% sleep libc-2.10.2.so [.] 0x0000000011ad5b
acme@parisc:~/git/linux-2.6-tip$
But if we:
acme@parisc:~/git/linux-2.6-tip$ ls ~/.debug
ls: cannot access /home/acme/.debug: No such file or directory
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/lib64/libc-2.10.2.so/
acme@parisc:~/git/linux-2.6-tip$ scp doppio:.debug/lib64/libc-2.10.2.so/* ~/.debug/lib64/libc-2.10.2.so/
acme@doppio's password:
eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 100% 1783KB 714.7KB/s 00:02
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/.build-id/eb
acme@parisc:~/git/linux-2.6-tip$ ln -s ../../lib64/libc-2.10.2.so/eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 ~/.debug/.build-id/eb/4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1
acme@parisc:~/git/linux-2.6-tip$ perf report --dsos libc-2.10.2.so 2> /dev/null
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get on the source, F12, x86_64 machine:
[root@doppio linux-2.6-tip]# perf report --dsos libc-2.10.2.so
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[root@doppio linux-2.6-tip]#
So I think this is really, really nice in that it demonstrates
the portability of perf.data files and the use of build-ids
accross such aliens worlds :-)
There are some things to fix tho, like the bitmap on the header,
but things are looking good.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1263478990-8200-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-01-14 17:23:10 +03:00
|
|
|
void mem_bswap_64(void *src, int byte_size)
|
|
|
|
{
|
|
|
|
u64 *m = src;
|
|
|
|
|
|
|
|
while (byte_size > 0) {
|
|
|
|
*m = bswap_64(*m);
|
|
|
|
byte_size -= sizeof(u64);
|
|
|
|
++m;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-30 16:23:43 +04:00
|
|
|
static void swap_sample_id_all(union perf_event *event, void *data)
|
|
|
|
{
|
|
|
|
void *end = (void *) event + event->header.size;
|
|
|
|
int size = end - data;
|
|
|
|
|
|
|
|
BUG_ON(size % sizeof(u64));
|
|
|
|
mem_bswap_64(data, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void perf_event__all64_swap(union perf_event *event,
|
2012-09-11 02:15:03 +04:00
|
|
|
bool sample_id_all __maybe_unused)
|
perf tools: Cross platform perf.data analysis support
There are still some problems related to loading vmlinux files,
but those are unrelated to the feature implemented in this
patch, so will get fixed in the next patches, but here are some
results:
1. collect perf.data file on a Fedora 12 machine, x86_64, 64-bit
userland
2. transfer it to a Debian Testing machine, PARISC64, 32-bit
userland
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | head -5
74f9930ee94475b6b3238caf3725a50d59cb994b [kernel.kallsyms]
55fdd56670453ea66c011158c4b9d30179c1d049 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/ipt_MASQUERADE.ko
41adff63c730890480980d5d8ba513f1c216a858 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/iptable_nat.ko
90a33def1077bb8e97b8a78546dc96c2de62df46 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/nf_nat.ko
984c7bea90ce1376d5c8e7ef43a781801286e62d /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/tun.ko
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | tail -5
22492f3753c6a67de5c7ccbd6b863390c92c0723 /usr/lib64/libXt.so.6.0.0
353802bb7e1b895ba43507cc678f951e778e4c6f /usr/lib64/libMagickCore.so.2.0.0
d10c2897558595efe7be8b0584cf7e6398bc776c /usr/lib64/libfprint.so.0.0.0
a83ecfb519a788774a84d5ddde633c9ba56c03ab /home/acme/bin/perf
d3ca765a8ecf257d263801d7ad8c49c189082317 /usr/lib64/libdwarf.so.0.0
acme@parisc:~/git/linux-2.6-tip$
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm
The file [kernel.kallsyms] cannot be used, trying to use /proc/kallsyms...
^^^^ The problem related to vmlinux handling, it shouldn't be trying this
^^^^ rather alien /proc/kallsyms at all...
/lib64/libpthread-2.10.2.so with build id 5c68f7afeb33309c78037e374b0deee84dd441f6 not found, continuing without symbols
/lib64/libc-2.10.2.so with build id eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 not found, continuing without symbols
/home/acme/bin/perf with build id a83ecfb519a788774a84d5ddde633c9ba56c03ab not found, continuing without symbols
/usr/sbin/openvpn with build id f2037a091ef36b591187a858d75e203690ea9409 not found, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/e1000e/e1000e.ko, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko, continuing without symbols
<SNIP more complaints about not finding the right build-ids,
those will have to wait for 'perf archive' or plain
copying what was collected by 'perf record' on the x86_64,
source machine, see further below for an example of this >
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get when running the same command for the
same perf.data file on the F12, x86_64, source machine:
[root@doppio linux-2.6-tip]# perf report --sort comm
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
[root@doppio linux-2.6-tip]#
The other modes work as well, modulo the problem with vmlinux:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object
# ........ ............... .................................
#
35.11% find ffffffff81002b5a
18.25% perf ffffffff8102235f
16.17% find libc-2.10.2.so
9.07% find find
5.80% swapper ffffffff8102235f
3.95% perf libc-2.10.2.so
2.33% init ffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k
1.35% find [e1000e]
0.68% sleep libc-2.10.2.so
acme@parisc:~/git/linux-2.6-tip$
And the lack of the right buildids:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso,symbol 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object Symbol
# ........ ............... ................................. ......
#
35.11% find ffffffff81002b5a [k] 0xffffffff81002b5a
18.25% perf ffffffff8102235f [k] 0xffffffff8102235f
16.17% find libc-2.10.2.so [.] 0x00000000045782
9.07% find find [.] 0x0000000000fb0e
5.80% swapper ffffffff8102235f [k] 0xffffffff8102235f
3.95% perf libc-2.10.2.so [.] 0x0000000007f398
2.33% init ffffffff810091b9 [k] 0xffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k [.] 0x00000000105440
1.35% find [e1000e] [k] 0x00000000010948
0.68% sleep libc-2.10.2.so [.] 0x0000000011ad5b
acme@parisc:~/git/linux-2.6-tip$
But if we:
acme@parisc:~/git/linux-2.6-tip$ ls ~/.debug
ls: cannot access /home/acme/.debug: No such file or directory
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/lib64/libc-2.10.2.so/
acme@parisc:~/git/linux-2.6-tip$ scp doppio:.debug/lib64/libc-2.10.2.so/* ~/.debug/lib64/libc-2.10.2.so/
acme@doppio's password:
eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 100% 1783KB 714.7KB/s 00:02
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/.build-id/eb
acme@parisc:~/git/linux-2.6-tip$ ln -s ../../lib64/libc-2.10.2.so/eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 ~/.debug/.build-id/eb/4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1
acme@parisc:~/git/linux-2.6-tip$ perf report --dsos libc-2.10.2.so 2> /dev/null
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get on the source, F12, x86_64 machine:
[root@doppio linux-2.6-tip]# perf report --dsos libc-2.10.2.so
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[root@doppio linux-2.6-tip]#
So I think this is really, really nice in that it demonstrates
the portability of perf.data files and the use of build-ids
accross such aliens worlds :-)
There are some things to fix tho, like the bitmap on the header,
but things are looking good.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1263478990-8200-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-01-14 17:23:10 +03:00
|
|
|
{
|
2011-01-29 19:01:45 +03:00
|
|
|
struct perf_event_header *hdr = &event->header;
|
|
|
|
mem_bswap_64(hdr + 1, event->header.size - sizeof(*hdr));
|
perf tools: Cross platform perf.data analysis support
There are still some problems related to loading vmlinux files,
but those are unrelated to the feature implemented in this
patch, so will get fixed in the next patches, but here are some
results:
1. collect perf.data file on a Fedora 12 machine, x86_64, 64-bit
userland
2. transfer it to a Debian Testing machine, PARISC64, 32-bit
userland
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | head -5
74f9930ee94475b6b3238caf3725a50d59cb994b [kernel.kallsyms]
55fdd56670453ea66c011158c4b9d30179c1d049 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/ipt_MASQUERADE.ko
41adff63c730890480980d5d8ba513f1c216a858 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/iptable_nat.ko
90a33def1077bb8e97b8a78546dc96c2de62df46 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/nf_nat.ko
984c7bea90ce1376d5c8e7ef43a781801286e62d /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/tun.ko
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | tail -5
22492f3753c6a67de5c7ccbd6b863390c92c0723 /usr/lib64/libXt.so.6.0.0
353802bb7e1b895ba43507cc678f951e778e4c6f /usr/lib64/libMagickCore.so.2.0.0
d10c2897558595efe7be8b0584cf7e6398bc776c /usr/lib64/libfprint.so.0.0.0
a83ecfb519a788774a84d5ddde633c9ba56c03ab /home/acme/bin/perf
d3ca765a8ecf257d263801d7ad8c49c189082317 /usr/lib64/libdwarf.so.0.0
acme@parisc:~/git/linux-2.6-tip$
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm
The file [kernel.kallsyms] cannot be used, trying to use /proc/kallsyms...
^^^^ The problem related to vmlinux handling, it shouldn't be trying this
^^^^ rather alien /proc/kallsyms at all...
/lib64/libpthread-2.10.2.so with build id 5c68f7afeb33309c78037e374b0deee84dd441f6 not found, continuing without symbols
/lib64/libc-2.10.2.so with build id eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 not found, continuing without symbols
/home/acme/bin/perf with build id a83ecfb519a788774a84d5ddde633c9ba56c03ab not found, continuing without symbols
/usr/sbin/openvpn with build id f2037a091ef36b591187a858d75e203690ea9409 not found, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/e1000e/e1000e.ko, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko, continuing without symbols
<SNIP more complaints about not finding the right build-ids,
those will have to wait for 'perf archive' or plain
copying what was collected by 'perf record' on the x86_64,
source machine, see further below for an example of this >
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get when running the same command for the
same perf.data file on the F12, x86_64, source machine:
[root@doppio linux-2.6-tip]# perf report --sort comm
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
[root@doppio linux-2.6-tip]#
The other modes work as well, modulo the problem with vmlinux:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object
# ........ ............... .................................
#
35.11% find ffffffff81002b5a
18.25% perf ffffffff8102235f
16.17% find libc-2.10.2.so
9.07% find find
5.80% swapper ffffffff8102235f
3.95% perf libc-2.10.2.so
2.33% init ffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k
1.35% find [e1000e]
0.68% sleep libc-2.10.2.so
acme@parisc:~/git/linux-2.6-tip$
And the lack of the right buildids:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso,symbol 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object Symbol
# ........ ............... ................................. ......
#
35.11% find ffffffff81002b5a [k] 0xffffffff81002b5a
18.25% perf ffffffff8102235f [k] 0xffffffff8102235f
16.17% find libc-2.10.2.so [.] 0x00000000045782
9.07% find find [.] 0x0000000000fb0e
5.80% swapper ffffffff8102235f [k] 0xffffffff8102235f
3.95% perf libc-2.10.2.so [.] 0x0000000007f398
2.33% init ffffffff810091b9 [k] 0xffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k [.] 0x00000000105440
1.35% find [e1000e] [k] 0x00000000010948
0.68% sleep libc-2.10.2.so [.] 0x0000000011ad5b
acme@parisc:~/git/linux-2.6-tip$
But if we:
acme@parisc:~/git/linux-2.6-tip$ ls ~/.debug
ls: cannot access /home/acme/.debug: No such file or directory
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/lib64/libc-2.10.2.so/
acme@parisc:~/git/linux-2.6-tip$ scp doppio:.debug/lib64/libc-2.10.2.so/* ~/.debug/lib64/libc-2.10.2.so/
acme@doppio's password:
eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 100% 1783KB 714.7KB/s 00:02
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/.build-id/eb
acme@parisc:~/git/linux-2.6-tip$ ln -s ../../lib64/libc-2.10.2.so/eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 ~/.debug/.build-id/eb/4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1
acme@parisc:~/git/linux-2.6-tip$ perf report --dsos libc-2.10.2.so 2> /dev/null
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get on the source, F12, x86_64 machine:
[root@doppio linux-2.6-tip]# perf report --dsos libc-2.10.2.so
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[root@doppio linux-2.6-tip]#
So I think this is really, really nice in that it demonstrates
the portability of perf.data files and the use of build-ids
accross such aliens worlds :-)
There are some things to fix tho, like the bitmap on the header,
but things are looking good.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1263478990-8200-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-01-14 17:23:10 +03:00
|
|
|
}
|
|
|
|
|
2012-05-30 16:23:43 +04:00
|
|
|
static void perf_event__comm_swap(union perf_event *event, bool sample_id_all)
|
perf tools: Cross platform perf.data analysis support
There are still some problems related to loading vmlinux files,
but those are unrelated to the feature implemented in this
patch, so will get fixed in the next patches, but here are some
results:
1. collect perf.data file on a Fedora 12 machine, x86_64, 64-bit
userland
2. transfer it to a Debian Testing machine, PARISC64, 32-bit
userland
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | head -5
74f9930ee94475b6b3238caf3725a50d59cb994b [kernel.kallsyms]
55fdd56670453ea66c011158c4b9d30179c1d049 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/ipt_MASQUERADE.ko
41adff63c730890480980d5d8ba513f1c216a858 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/iptable_nat.ko
90a33def1077bb8e97b8a78546dc96c2de62df46 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/nf_nat.ko
984c7bea90ce1376d5c8e7ef43a781801286e62d /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/tun.ko
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | tail -5
22492f3753c6a67de5c7ccbd6b863390c92c0723 /usr/lib64/libXt.so.6.0.0
353802bb7e1b895ba43507cc678f951e778e4c6f /usr/lib64/libMagickCore.so.2.0.0
d10c2897558595efe7be8b0584cf7e6398bc776c /usr/lib64/libfprint.so.0.0.0
a83ecfb519a788774a84d5ddde633c9ba56c03ab /home/acme/bin/perf
d3ca765a8ecf257d263801d7ad8c49c189082317 /usr/lib64/libdwarf.so.0.0
acme@parisc:~/git/linux-2.6-tip$
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm
The file [kernel.kallsyms] cannot be used, trying to use /proc/kallsyms...
^^^^ The problem related to vmlinux handling, it shouldn't be trying this
^^^^ rather alien /proc/kallsyms at all...
/lib64/libpthread-2.10.2.so with build id 5c68f7afeb33309c78037e374b0deee84dd441f6 not found, continuing without symbols
/lib64/libc-2.10.2.so with build id eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 not found, continuing without symbols
/home/acme/bin/perf with build id a83ecfb519a788774a84d5ddde633c9ba56c03ab not found, continuing without symbols
/usr/sbin/openvpn with build id f2037a091ef36b591187a858d75e203690ea9409 not found, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/e1000e/e1000e.ko, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko, continuing without symbols
<SNIP more complaints about not finding the right build-ids,
those will have to wait for 'perf archive' or plain
copying what was collected by 'perf record' on the x86_64,
source machine, see further below for an example of this >
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get when running the same command for the
same perf.data file on the F12, x86_64, source machine:
[root@doppio linux-2.6-tip]# perf report --sort comm
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
[root@doppio linux-2.6-tip]#
The other modes work as well, modulo the problem with vmlinux:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object
# ........ ............... .................................
#
35.11% find ffffffff81002b5a
18.25% perf ffffffff8102235f
16.17% find libc-2.10.2.so
9.07% find find
5.80% swapper ffffffff8102235f
3.95% perf libc-2.10.2.so
2.33% init ffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k
1.35% find [e1000e]
0.68% sleep libc-2.10.2.so
acme@parisc:~/git/linux-2.6-tip$
And the lack of the right buildids:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso,symbol 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object Symbol
# ........ ............... ................................. ......
#
35.11% find ffffffff81002b5a [k] 0xffffffff81002b5a
18.25% perf ffffffff8102235f [k] 0xffffffff8102235f
16.17% find libc-2.10.2.so [.] 0x00000000045782
9.07% find find [.] 0x0000000000fb0e
5.80% swapper ffffffff8102235f [k] 0xffffffff8102235f
3.95% perf libc-2.10.2.so [.] 0x0000000007f398
2.33% init ffffffff810091b9 [k] 0xffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k [.] 0x00000000105440
1.35% find [e1000e] [k] 0x00000000010948
0.68% sleep libc-2.10.2.so [.] 0x0000000011ad5b
acme@parisc:~/git/linux-2.6-tip$
But if we:
acme@parisc:~/git/linux-2.6-tip$ ls ~/.debug
ls: cannot access /home/acme/.debug: No such file or directory
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/lib64/libc-2.10.2.so/
acme@parisc:~/git/linux-2.6-tip$ scp doppio:.debug/lib64/libc-2.10.2.so/* ~/.debug/lib64/libc-2.10.2.so/
acme@doppio's password:
eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 100% 1783KB 714.7KB/s 00:02
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/.build-id/eb
acme@parisc:~/git/linux-2.6-tip$ ln -s ../../lib64/libc-2.10.2.so/eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 ~/.debug/.build-id/eb/4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1
acme@parisc:~/git/linux-2.6-tip$ perf report --dsos libc-2.10.2.so 2> /dev/null
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get on the source, F12, x86_64 machine:
[root@doppio linux-2.6-tip]# perf report --dsos libc-2.10.2.so
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[root@doppio linux-2.6-tip]#
So I think this is really, really nice in that it demonstrates
the portability of perf.data files and the use of build-ids
accross such aliens worlds :-)
There are some things to fix tho, like the bitmap on the header,
but things are looking good.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1263478990-8200-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-01-14 17:23:10 +03:00
|
|
|
{
|
2011-01-29 19:01:45 +03:00
|
|
|
event->comm.pid = bswap_32(event->comm.pid);
|
|
|
|
event->comm.tid = bswap_32(event->comm.tid);
|
2012-05-30 16:23:43 +04:00
|
|
|
|
|
|
|
if (sample_id_all) {
|
|
|
|
void *data = &event->comm.comm;
|
|
|
|
|
2012-09-11 02:15:01 +04:00
|
|
|
data += PERF_ALIGN(strlen(data) + 1, sizeof(u64));
|
2012-05-30 16:23:43 +04:00
|
|
|
swap_sample_id_all(event, data);
|
|
|
|
}
|
perf tools: Cross platform perf.data analysis support
There are still some problems related to loading vmlinux files,
but those are unrelated to the feature implemented in this
patch, so will get fixed in the next patches, but here are some
results:
1. collect perf.data file on a Fedora 12 machine, x86_64, 64-bit
userland
2. transfer it to a Debian Testing machine, PARISC64, 32-bit
userland
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | head -5
74f9930ee94475b6b3238caf3725a50d59cb994b [kernel.kallsyms]
55fdd56670453ea66c011158c4b9d30179c1d049 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/ipt_MASQUERADE.ko
41adff63c730890480980d5d8ba513f1c216a858 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/iptable_nat.ko
90a33def1077bb8e97b8a78546dc96c2de62df46 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/nf_nat.ko
984c7bea90ce1376d5c8e7ef43a781801286e62d /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/tun.ko
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | tail -5
22492f3753c6a67de5c7ccbd6b863390c92c0723 /usr/lib64/libXt.so.6.0.0
353802bb7e1b895ba43507cc678f951e778e4c6f /usr/lib64/libMagickCore.so.2.0.0
d10c2897558595efe7be8b0584cf7e6398bc776c /usr/lib64/libfprint.so.0.0.0
a83ecfb519a788774a84d5ddde633c9ba56c03ab /home/acme/bin/perf
d3ca765a8ecf257d263801d7ad8c49c189082317 /usr/lib64/libdwarf.so.0.0
acme@parisc:~/git/linux-2.6-tip$
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm
The file [kernel.kallsyms] cannot be used, trying to use /proc/kallsyms...
^^^^ The problem related to vmlinux handling, it shouldn't be trying this
^^^^ rather alien /proc/kallsyms at all...
/lib64/libpthread-2.10.2.so with build id 5c68f7afeb33309c78037e374b0deee84dd441f6 not found, continuing without symbols
/lib64/libc-2.10.2.so with build id eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 not found, continuing without symbols
/home/acme/bin/perf with build id a83ecfb519a788774a84d5ddde633c9ba56c03ab not found, continuing without symbols
/usr/sbin/openvpn with build id f2037a091ef36b591187a858d75e203690ea9409 not found, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/e1000e/e1000e.ko, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko, continuing without symbols
<SNIP more complaints about not finding the right build-ids,
those will have to wait for 'perf archive' or plain
copying what was collected by 'perf record' on the x86_64,
source machine, see further below for an example of this >
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get when running the same command for the
same perf.data file on the F12, x86_64, source machine:
[root@doppio linux-2.6-tip]# perf report --sort comm
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
[root@doppio linux-2.6-tip]#
The other modes work as well, modulo the problem with vmlinux:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object
# ........ ............... .................................
#
35.11% find ffffffff81002b5a
18.25% perf ffffffff8102235f
16.17% find libc-2.10.2.so
9.07% find find
5.80% swapper ffffffff8102235f
3.95% perf libc-2.10.2.so
2.33% init ffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k
1.35% find [e1000e]
0.68% sleep libc-2.10.2.so
acme@parisc:~/git/linux-2.6-tip$
And the lack of the right buildids:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso,symbol 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object Symbol
# ........ ............... ................................. ......
#
35.11% find ffffffff81002b5a [k] 0xffffffff81002b5a
18.25% perf ffffffff8102235f [k] 0xffffffff8102235f
16.17% find libc-2.10.2.so [.] 0x00000000045782
9.07% find find [.] 0x0000000000fb0e
5.80% swapper ffffffff8102235f [k] 0xffffffff8102235f
3.95% perf libc-2.10.2.so [.] 0x0000000007f398
2.33% init ffffffff810091b9 [k] 0xffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k [.] 0x00000000105440
1.35% find [e1000e] [k] 0x00000000010948
0.68% sleep libc-2.10.2.so [.] 0x0000000011ad5b
acme@parisc:~/git/linux-2.6-tip$
But if we:
acme@parisc:~/git/linux-2.6-tip$ ls ~/.debug
ls: cannot access /home/acme/.debug: No such file or directory
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/lib64/libc-2.10.2.so/
acme@parisc:~/git/linux-2.6-tip$ scp doppio:.debug/lib64/libc-2.10.2.so/* ~/.debug/lib64/libc-2.10.2.so/
acme@doppio's password:
eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 100% 1783KB 714.7KB/s 00:02
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/.build-id/eb
acme@parisc:~/git/linux-2.6-tip$ ln -s ../../lib64/libc-2.10.2.so/eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 ~/.debug/.build-id/eb/4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1
acme@parisc:~/git/linux-2.6-tip$ perf report --dsos libc-2.10.2.so 2> /dev/null
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get on the source, F12, x86_64 machine:
[root@doppio linux-2.6-tip]# perf report --dsos libc-2.10.2.so
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[root@doppio linux-2.6-tip]#
So I think this is really, really nice in that it demonstrates
the portability of perf.data files and the use of build-ids
accross such aliens worlds :-)
There are some things to fix tho, like the bitmap on the header,
but things are looking good.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1263478990-8200-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-01-14 17:23:10 +03:00
|
|
|
}
|
|
|
|
|
2012-05-30 16:23:43 +04:00
|
|
|
static void perf_event__mmap_swap(union perf_event *event,
|
|
|
|
bool sample_id_all)
|
perf tools: Cross platform perf.data analysis support
There are still some problems related to loading vmlinux files,
but those are unrelated to the feature implemented in this
patch, so will get fixed in the next patches, but here are some
results:
1. collect perf.data file on a Fedora 12 machine, x86_64, 64-bit
userland
2. transfer it to a Debian Testing machine, PARISC64, 32-bit
userland
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | head -5
74f9930ee94475b6b3238caf3725a50d59cb994b [kernel.kallsyms]
55fdd56670453ea66c011158c4b9d30179c1d049 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/ipt_MASQUERADE.ko
41adff63c730890480980d5d8ba513f1c216a858 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/iptable_nat.ko
90a33def1077bb8e97b8a78546dc96c2de62df46 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/nf_nat.ko
984c7bea90ce1376d5c8e7ef43a781801286e62d /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/tun.ko
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | tail -5
22492f3753c6a67de5c7ccbd6b863390c92c0723 /usr/lib64/libXt.so.6.0.0
353802bb7e1b895ba43507cc678f951e778e4c6f /usr/lib64/libMagickCore.so.2.0.0
d10c2897558595efe7be8b0584cf7e6398bc776c /usr/lib64/libfprint.so.0.0.0
a83ecfb519a788774a84d5ddde633c9ba56c03ab /home/acme/bin/perf
d3ca765a8ecf257d263801d7ad8c49c189082317 /usr/lib64/libdwarf.so.0.0
acme@parisc:~/git/linux-2.6-tip$
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm
The file [kernel.kallsyms] cannot be used, trying to use /proc/kallsyms...
^^^^ The problem related to vmlinux handling, it shouldn't be trying this
^^^^ rather alien /proc/kallsyms at all...
/lib64/libpthread-2.10.2.so with build id 5c68f7afeb33309c78037e374b0deee84dd441f6 not found, continuing without symbols
/lib64/libc-2.10.2.so with build id eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 not found, continuing without symbols
/home/acme/bin/perf with build id a83ecfb519a788774a84d5ddde633c9ba56c03ab not found, continuing without symbols
/usr/sbin/openvpn with build id f2037a091ef36b591187a858d75e203690ea9409 not found, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/e1000e/e1000e.ko, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko, continuing without symbols
<SNIP more complaints about not finding the right build-ids,
those will have to wait for 'perf archive' or plain
copying what was collected by 'perf record' on the x86_64,
source machine, see further below for an example of this >
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get when running the same command for the
same perf.data file on the F12, x86_64, source machine:
[root@doppio linux-2.6-tip]# perf report --sort comm
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
[root@doppio linux-2.6-tip]#
The other modes work as well, modulo the problem with vmlinux:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object
# ........ ............... .................................
#
35.11% find ffffffff81002b5a
18.25% perf ffffffff8102235f
16.17% find libc-2.10.2.so
9.07% find find
5.80% swapper ffffffff8102235f
3.95% perf libc-2.10.2.so
2.33% init ffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k
1.35% find [e1000e]
0.68% sleep libc-2.10.2.so
acme@parisc:~/git/linux-2.6-tip$
And the lack of the right buildids:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso,symbol 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object Symbol
# ........ ............... ................................. ......
#
35.11% find ffffffff81002b5a [k] 0xffffffff81002b5a
18.25% perf ffffffff8102235f [k] 0xffffffff8102235f
16.17% find libc-2.10.2.so [.] 0x00000000045782
9.07% find find [.] 0x0000000000fb0e
5.80% swapper ffffffff8102235f [k] 0xffffffff8102235f
3.95% perf libc-2.10.2.so [.] 0x0000000007f398
2.33% init ffffffff810091b9 [k] 0xffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k [.] 0x00000000105440
1.35% find [e1000e] [k] 0x00000000010948
0.68% sleep libc-2.10.2.so [.] 0x0000000011ad5b
acme@parisc:~/git/linux-2.6-tip$
But if we:
acme@parisc:~/git/linux-2.6-tip$ ls ~/.debug
ls: cannot access /home/acme/.debug: No such file or directory
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/lib64/libc-2.10.2.so/
acme@parisc:~/git/linux-2.6-tip$ scp doppio:.debug/lib64/libc-2.10.2.so/* ~/.debug/lib64/libc-2.10.2.so/
acme@doppio's password:
eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 100% 1783KB 714.7KB/s 00:02
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/.build-id/eb
acme@parisc:~/git/linux-2.6-tip$ ln -s ../../lib64/libc-2.10.2.so/eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 ~/.debug/.build-id/eb/4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1
acme@parisc:~/git/linux-2.6-tip$ perf report --dsos libc-2.10.2.so 2> /dev/null
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get on the source, F12, x86_64 machine:
[root@doppio linux-2.6-tip]# perf report --dsos libc-2.10.2.so
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[root@doppio linux-2.6-tip]#
So I think this is really, really nice in that it demonstrates
the portability of perf.data files and the use of build-ids
accross such aliens worlds :-)
There are some things to fix tho, like the bitmap on the header,
but things are looking good.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1263478990-8200-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-01-14 17:23:10 +03:00
|
|
|
{
|
2011-01-29 19:01:45 +03:00
|
|
|
event->mmap.pid = bswap_32(event->mmap.pid);
|
|
|
|
event->mmap.tid = bswap_32(event->mmap.tid);
|
|
|
|
event->mmap.start = bswap_64(event->mmap.start);
|
|
|
|
event->mmap.len = bswap_64(event->mmap.len);
|
|
|
|
event->mmap.pgoff = bswap_64(event->mmap.pgoff);
|
2012-05-30 16:23:43 +04:00
|
|
|
|
|
|
|
if (sample_id_all) {
|
|
|
|
void *data = &event->mmap.filename;
|
|
|
|
|
2012-09-11 02:15:01 +04:00
|
|
|
data += PERF_ALIGN(strlen(data) + 1, sizeof(u64));
|
2012-05-30 16:23:43 +04:00
|
|
|
swap_sample_id_all(event, data);
|
|
|
|
}
|
perf tools: Cross platform perf.data analysis support
There are still some problems related to loading vmlinux files,
but those are unrelated to the feature implemented in this
patch, so will get fixed in the next patches, but here are some
results:
1. collect perf.data file on a Fedora 12 machine, x86_64, 64-bit
userland
2. transfer it to a Debian Testing machine, PARISC64, 32-bit
userland
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | head -5
74f9930ee94475b6b3238caf3725a50d59cb994b [kernel.kallsyms]
55fdd56670453ea66c011158c4b9d30179c1d049 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/ipt_MASQUERADE.ko
41adff63c730890480980d5d8ba513f1c216a858 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/iptable_nat.ko
90a33def1077bb8e97b8a78546dc96c2de62df46 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/nf_nat.ko
984c7bea90ce1376d5c8e7ef43a781801286e62d /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/tun.ko
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | tail -5
22492f3753c6a67de5c7ccbd6b863390c92c0723 /usr/lib64/libXt.so.6.0.0
353802bb7e1b895ba43507cc678f951e778e4c6f /usr/lib64/libMagickCore.so.2.0.0
d10c2897558595efe7be8b0584cf7e6398bc776c /usr/lib64/libfprint.so.0.0.0
a83ecfb519a788774a84d5ddde633c9ba56c03ab /home/acme/bin/perf
d3ca765a8ecf257d263801d7ad8c49c189082317 /usr/lib64/libdwarf.so.0.0
acme@parisc:~/git/linux-2.6-tip$
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm
The file [kernel.kallsyms] cannot be used, trying to use /proc/kallsyms...
^^^^ The problem related to vmlinux handling, it shouldn't be trying this
^^^^ rather alien /proc/kallsyms at all...
/lib64/libpthread-2.10.2.so with build id 5c68f7afeb33309c78037e374b0deee84dd441f6 not found, continuing without symbols
/lib64/libc-2.10.2.so with build id eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 not found, continuing without symbols
/home/acme/bin/perf with build id a83ecfb519a788774a84d5ddde633c9ba56c03ab not found, continuing without symbols
/usr/sbin/openvpn with build id f2037a091ef36b591187a858d75e203690ea9409 not found, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/e1000e/e1000e.ko, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko, continuing without symbols
<SNIP more complaints about not finding the right build-ids,
those will have to wait for 'perf archive' or plain
copying what was collected by 'perf record' on the x86_64,
source machine, see further below for an example of this >
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get when running the same command for the
same perf.data file on the F12, x86_64, source machine:
[root@doppio linux-2.6-tip]# perf report --sort comm
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
[root@doppio linux-2.6-tip]#
The other modes work as well, modulo the problem with vmlinux:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object
# ........ ............... .................................
#
35.11% find ffffffff81002b5a
18.25% perf ffffffff8102235f
16.17% find libc-2.10.2.so
9.07% find find
5.80% swapper ffffffff8102235f
3.95% perf libc-2.10.2.so
2.33% init ffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k
1.35% find [e1000e]
0.68% sleep libc-2.10.2.so
acme@parisc:~/git/linux-2.6-tip$
And the lack of the right buildids:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso,symbol 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object Symbol
# ........ ............... ................................. ......
#
35.11% find ffffffff81002b5a [k] 0xffffffff81002b5a
18.25% perf ffffffff8102235f [k] 0xffffffff8102235f
16.17% find libc-2.10.2.so [.] 0x00000000045782
9.07% find find [.] 0x0000000000fb0e
5.80% swapper ffffffff8102235f [k] 0xffffffff8102235f
3.95% perf libc-2.10.2.so [.] 0x0000000007f398
2.33% init ffffffff810091b9 [k] 0xffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k [.] 0x00000000105440
1.35% find [e1000e] [k] 0x00000000010948
0.68% sleep libc-2.10.2.so [.] 0x0000000011ad5b
acme@parisc:~/git/linux-2.6-tip$
But if we:
acme@parisc:~/git/linux-2.6-tip$ ls ~/.debug
ls: cannot access /home/acme/.debug: No such file or directory
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/lib64/libc-2.10.2.so/
acme@parisc:~/git/linux-2.6-tip$ scp doppio:.debug/lib64/libc-2.10.2.so/* ~/.debug/lib64/libc-2.10.2.so/
acme@doppio's password:
eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 100% 1783KB 714.7KB/s 00:02
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/.build-id/eb
acme@parisc:~/git/linux-2.6-tip$ ln -s ../../lib64/libc-2.10.2.so/eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 ~/.debug/.build-id/eb/4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1
acme@parisc:~/git/linux-2.6-tip$ perf report --dsos libc-2.10.2.so 2> /dev/null
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get on the source, F12, x86_64 machine:
[root@doppio linux-2.6-tip]# perf report --dsos libc-2.10.2.so
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[root@doppio linux-2.6-tip]#
So I think this is really, really nice in that it demonstrates
the portability of perf.data files and the use of build-ids
accross such aliens worlds :-)
There are some things to fix tho, like the bitmap on the header,
but things are looking good.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1263478990-8200-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-01-14 17:23:10 +03:00
|
|
|
}
|
|
|
|
|
2013-08-21 14:10:25 +04:00
|
|
|
static void perf_event__mmap2_swap(union perf_event *event,
|
|
|
|
bool sample_id_all)
|
|
|
|
{
|
|
|
|
event->mmap2.pid = bswap_32(event->mmap2.pid);
|
|
|
|
event->mmap2.tid = bswap_32(event->mmap2.tid);
|
|
|
|
event->mmap2.start = bswap_64(event->mmap2.start);
|
|
|
|
event->mmap2.len = bswap_64(event->mmap2.len);
|
|
|
|
event->mmap2.pgoff = bswap_64(event->mmap2.pgoff);
|
|
|
|
event->mmap2.maj = bswap_32(event->mmap2.maj);
|
|
|
|
event->mmap2.min = bswap_32(event->mmap2.min);
|
|
|
|
event->mmap2.ino = bswap_64(event->mmap2.ino);
|
|
|
|
|
|
|
|
if (sample_id_all) {
|
|
|
|
void *data = &event->mmap2.filename;
|
|
|
|
|
|
|
|
data += PERF_ALIGN(strlen(data) + 1, sizeof(u64));
|
|
|
|
swap_sample_id_all(event, data);
|
|
|
|
}
|
|
|
|
}
|
2012-05-30 16:23:43 +04:00
|
|
|
static void perf_event__task_swap(union perf_event *event, bool sample_id_all)
|
perf tools: Cross platform perf.data analysis support
There are still some problems related to loading vmlinux files,
but those are unrelated to the feature implemented in this
patch, so will get fixed in the next patches, but here are some
results:
1. collect perf.data file on a Fedora 12 machine, x86_64, 64-bit
userland
2. transfer it to a Debian Testing machine, PARISC64, 32-bit
userland
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | head -5
74f9930ee94475b6b3238caf3725a50d59cb994b [kernel.kallsyms]
55fdd56670453ea66c011158c4b9d30179c1d049 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/ipt_MASQUERADE.ko
41adff63c730890480980d5d8ba513f1c216a858 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/iptable_nat.ko
90a33def1077bb8e97b8a78546dc96c2de62df46 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/nf_nat.ko
984c7bea90ce1376d5c8e7ef43a781801286e62d /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/tun.ko
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | tail -5
22492f3753c6a67de5c7ccbd6b863390c92c0723 /usr/lib64/libXt.so.6.0.0
353802bb7e1b895ba43507cc678f951e778e4c6f /usr/lib64/libMagickCore.so.2.0.0
d10c2897558595efe7be8b0584cf7e6398bc776c /usr/lib64/libfprint.so.0.0.0
a83ecfb519a788774a84d5ddde633c9ba56c03ab /home/acme/bin/perf
d3ca765a8ecf257d263801d7ad8c49c189082317 /usr/lib64/libdwarf.so.0.0
acme@parisc:~/git/linux-2.6-tip$
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm
The file [kernel.kallsyms] cannot be used, trying to use /proc/kallsyms...
^^^^ The problem related to vmlinux handling, it shouldn't be trying this
^^^^ rather alien /proc/kallsyms at all...
/lib64/libpthread-2.10.2.so with build id 5c68f7afeb33309c78037e374b0deee84dd441f6 not found, continuing without symbols
/lib64/libc-2.10.2.so with build id eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 not found, continuing without symbols
/home/acme/bin/perf with build id a83ecfb519a788774a84d5ddde633c9ba56c03ab not found, continuing without symbols
/usr/sbin/openvpn with build id f2037a091ef36b591187a858d75e203690ea9409 not found, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/e1000e/e1000e.ko, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko, continuing without symbols
<SNIP more complaints about not finding the right build-ids,
those will have to wait for 'perf archive' or plain
copying what was collected by 'perf record' on the x86_64,
source machine, see further below for an example of this >
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get when running the same command for the
same perf.data file on the F12, x86_64, source machine:
[root@doppio linux-2.6-tip]# perf report --sort comm
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
[root@doppio linux-2.6-tip]#
The other modes work as well, modulo the problem with vmlinux:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object
# ........ ............... .................................
#
35.11% find ffffffff81002b5a
18.25% perf ffffffff8102235f
16.17% find libc-2.10.2.so
9.07% find find
5.80% swapper ffffffff8102235f
3.95% perf libc-2.10.2.so
2.33% init ffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k
1.35% find [e1000e]
0.68% sleep libc-2.10.2.so
acme@parisc:~/git/linux-2.6-tip$
And the lack of the right buildids:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso,symbol 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object Symbol
# ........ ............... ................................. ......
#
35.11% find ffffffff81002b5a [k] 0xffffffff81002b5a
18.25% perf ffffffff8102235f [k] 0xffffffff8102235f
16.17% find libc-2.10.2.so [.] 0x00000000045782
9.07% find find [.] 0x0000000000fb0e
5.80% swapper ffffffff8102235f [k] 0xffffffff8102235f
3.95% perf libc-2.10.2.so [.] 0x0000000007f398
2.33% init ffffffff810091b9 [k] 0xffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k [.] 0x00000000105440
1.35% find [e1000e] [k] 0x00000000010948
0.68% sleep libc-2.10.2.so [.] 0x0000000011ad5b
acme@parisc:~/git/linux-2.6-tip$
But if we:
acme@parisc:~/git/linux-2.6-tip$ ls ~/.debug
ls: cannot access /home/acme/.debug: No such file or directory
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/lib64/libc-2.10.2.so/
acme@parisc:~/git/linux-2.6-tip$ scp doppio:.debug/lib64/libc-2.10.2.so/* ~/.debug/lib64/libc-2.10.2.so/
acme@doppio's password:
eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 100% 1783KB 714.7KB/s 00:02
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/.build-id/eb
acme@parisc:~/git/linux-2.6-tip$ ln -s ../../lib64/libc-2.10.2.so/eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 ~/.debug/.build-id/eb/4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1
acme@parisc:~/git/linux-2.6-tip$ perf report --dsos libc-2.10.2.so 2> /dev/null
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get on the source, F12, x86_64 machine:
[root@doppio linux-2.6-tip]# perf report --dsos libc-2.10.2.so
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[root@doppio linux-2.6-tip]#
So I think this is really, really nice in that it demonstrates
the portability of perf.data files and the use of build-ids
accross such aliens worlds :-)
There are some things to fix tho, like the bitmap on the header,
but things are looking good.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1263478990-8200-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-01-14 17:23:10 +03:00
|
|
|
{
|
2011-01-29 19:01:45 +03:00
|
|
|
event->fork.pid = bswap_32(event->fork.pid);
|
|
|
|
event->fork.tid = bswap_32(event->fork.tid);
|
|
|
|
event->fork.ppid = bswap_32(event->fork.ppid);
|
|
|
|
event->fork.ptid = bswap_32(event->fork.ptid);
|
|
|
|
event->fork.time = bswap_64(event->fork.time);
|
2012-05-30 16:23:43 +04:00
|
|
|
|
|
|
|
if (sample_id_all)
|
|
|
|
swap_sample_id_all(event, &event->fork + 1);
|
perf tools: Cross platform perf.data analysis support
There are still some problems related to loading vmlinux files,
but those are unrelated to the feature implemented in this
patch, so will get fixed in the next patches, but here are some
results:
1. collect perf.data file on a Fedora 12 machine, x86_64, 64-bit
userland
2. transfer it to a Debian Testing machine, PARISC64, 32-bit
userland
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | head -5
74f9930ee94475b6b3238caf3725a50d59cb994b [kernel.kallsyms]
55fdd56670453ea66c011158c4b9d30179c1d049 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/ipt_MASQUERADE.ko
41adff63c730890480980d5d8ba513f1c216a858 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/iptable_nat.ko
90a33def1077bb8e97b8a78546dc96c2de62df46 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/nf_nat.ko
984c7bea90ce1376d5c8e7ef43a781801286e62d /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/tun.ko
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | tail -5
22492f3753c6a67de5c7ccbd6b863390c92c0723 /usr/lib64/libXt.so.6.0.0
353802bb7e1b895ba43507cc678f951e778e4c6f /usr/lib64/libMagickCore.so.2.0.0
d10c2897558595efe7be8b0584cf7e6398bc776c /usr/lib64/libfprint.so.0.0.0
a83ecfb519a788774a84d5ddde633c9ba56c03ab /home/acme/bin/perf
d3ca765a8ecf257d263801d7ad8c49c189082317 /usr/lib64/libdwarf.so.0.0
acme@parisc:~/git/linux-2.6-tip$
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm
The file [kernel.kallsyms] cannot be used, trying to use /proc/kallsyms...
^^^^ The problem related to vmlinux handling, it shouldn't be trying this
^^^^ rather alien /proc/kallsyms at all...
/lib64/libpthread-2.10.2.so with build id 5c68f7afeb33309c78037e374b0deee84dd441f6 not found, continuing without symbols
/lib64/libc-2.10.2.so with build id eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 not found, continuing without symbols
/home/acme/bin/perf with build id a83ecfb519a788774a84d5ddde633c9ba56c03ab not found, continuing without symbols
/usr/sbin/openvpn with build id f2037a091ef36b591187a858d75e203690ea9409 not found, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/e1000e/e1000e.ko, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko, continuing without symbols
<SNIP more complaints about not finding the right build-ids,
those will have to wait for 'perf archive' or plain
copying what was collected by 'perf record' on the x86_64,
source machine, see further below for an example of this >
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get when running the same command for the
same perf.data file on the F12, x86_64, source machine:
[root@doppio linux-2.6-tip]# perf report --sort comm
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
[root@doppio linux-2.6-tip]#
The other modes work as well, modulo the problem with vmlinux:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object
# ........ ............... .................................
#
35.11% find ffffffff81002b5a
18.25% perf ffffffff8102235f
16.17% find libc-2.10.2.so
9.07% find find
5.80% swapper ffffffff8102235f
3.95% perf libc-2.10.2.so
2.33% init ffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k
1.35% find [e1000e]
0.68% sleep libc-2.10.2.so
acme@parisc:~/git/linux-2.6-tip$
And the lack of the right buildids:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso,symbol 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object Symbol
# ........ ............... ................................. ......
#
35.11% find ffffffff81002b5a [k] 0xffffffff81002b5a
18.25% perf ffffffff8102235f [k] 0xffffffff8102235f
16.17% find libc-2.10.2.so [.] 0x00000000045782
9.07% find find [.] 0x0000000000fb0e
5.80% swapper ffffffff8102235f [k] 0xffffffff8102235f
3.95% perf libc-2.10.2.so [.] 0x0000000007f398
2.33% init ffffffff810091b9 [k] 0xffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k [.] 0x00000000105440
1.35% find [e1000e] [k] 0x00000000010948
0.68% sleep libc-2.10.2.so [.] 0x0000000011ad5b
acme@parisc:~/git/linux-2.6-tip$
But if we:
acme@parisc:~/git/linux-2.6-tip$ ls ~/.debug
ls: cannot access /home/acme/.debug: No such file or directory
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/lib64/libc-2.10.2.so/
acme@parisc:~/git/linux-2.6-tip$ scp doppio:.debug/lib64/libc-2.10.2.so/* ~/.debug/lib64/libc-2.10.2.so/
acme@doppio's password:
eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 100% 1783KB 714.7KB/s 00:02
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/.build-id/eb
acme@parisc:~/git/linux-2.6-tip$ ln -s ../../lib64/libc-2.10.2.so/eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 ~/.debug/.build-id/eb/4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1
acme@parisc:~/git/linux-2.6-tip$ perf report --dsos libc-2.10.2.so 2> /dev/null
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get on the source, F12, x86_64 machine:
[root@doppio linux-2.6-tip]# perf report --dsos libc-2.10.2.so
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[root@doppio linux-2.6-tip]#
So I think this is really, really nice in that it demonstrates
the portability of perf.data files and the use of build-ids
accross such aliens worlds :-)
There are some things to fix tho, like the bitmap on the header,
but things are looking good.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1263478990-8200-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-01-14 17:23:10 +03:00
|
|
|
}
|
|
|
|
|
2012-05-30 16:23:43 +04:00
|
|
|
static void perf_event__read_swap(union perf_event *event, bool sample_id_all)
|
perf tools: Cross platform perf.data analysis support
There are still some problems related to loading vmlinux files,
but those are unrelated to the feature implemented in this
patch, so will get fixed in the next patches, but here are some
results:
1. collect perf.data file on a Fedora 12 machine, x86_64, 64-bit
userland
2. transfer it to a Debian Testing machine, PARISC64, 32-bit
userland
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | head -5
74f9930ee94475b6b3238caf3725a50d59cb994b [kernel.kallsyms]
55fdd56670453ea66c011158c4b9d30179c1d049 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/ipt_MASQUERADE.ko
41adff63c730890480980d5d8ba513f1c216a858 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/iptable_nat.ko
90a33def1077bb8e97b8a78546dc96c2de62df46 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/nf_nat.ko
984c7bea90ce1376d5c8e7ef43a781801286e62d /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/tun.ko
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | tail -5
22492f3753c6a67de5c7ccbd6b863390c92c0723 /usr/lib64/libXt.so.6.0.0
353802bb7e1b895ba43507cc678f951e778e4c6f /usr/lib64/libMagickCore.so.2.0.0
d10c2897558595efe7be8b0584cf7e6398bc776c /usr/lib64/libfprint.so.0.0.0
a83ecfb519a788774a84d5ddde633c9ba56c03ab /home/acme/bin/perf
d3ca765a8ecf257d263801d7ad8c49c189082317 /usr/lib64/libdwarf.so.0.0
acme@parisc:~/git/linux-2.6-tip$
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm
The file [kernel.kallsyms] cannot be used, trying to use /proc/kallsyms...
^^^^ The problem related to vmlinux handling, it shouldn't be trying this
^^^^ rather alien /proc/kallsyms at all...
/lib64/libpthread-2.10.2.so with build id 5c68f7afeb33309c78037e374b0deee84dd441f6 not found, continuing without symbols
/lib64/libc-2.10.2.so with build id eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 not found, continuing without symbols
/home/acme/bin/perf with build id a83ecfb519a788774a84d5ddde633c9ba56c03ab not found, continuing without symbols
/usr/sbin/openvpn with build id f2037a091ef36b591187a858d75e203690ea9409 not found, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/e1000e/e1000e.ko, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko, continuing without symbols
<SNIP more complaints about not finding the right build-ids,
those will have to wait for 'perf archive' or plain
copying what was collected by 'perf record' on the x86_64,
source machine, see further below for an example of this >
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get when running the same command for the
same perf.data file on the F12, x86_64, source machine:
[root@doppio linux-2.6-tip]# perf report --sort comm
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
[root@doppio linux-2.6-tip]#
The other modes work as well, modulo the problem with vmlinux:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object
# ........ ............... .................................
#
35.11% find ffffffff81002b5a
18.25% perf ffffffff8102235f
16.17% find libc-2.10.2.so
9.07% find find
5.80% swapper ffffffff8102235f
3.95% perf libc-2.10.2.so
2.33% init ffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k
1.35% find [e1000e]
0.68% sleep libc-2.10.2.so
acme@parisc:~/git/linux-2.6-tip$
And the lack of the right buildids:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso,symbol 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object Symbol
# ........ ............... ................................. ......
#
35.11% find ffffffff81002b5a [k] 0xffffffff81002b5a
18.25% perf ffffffff8102235f [k] 0xffffffff8102235f
16.17% find libc-2.10.2.so [.] 0x00000000045782
9.07% find find [.] 0x0000000000fb0e
5.80% swapper ffffffff8102235f [k] 0xffffffff8102235f
3.95% perf libc-2.10.2.so [.] 0x0000000007f398
2.33% init ffffffff810091b9 [k] 0xffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k [.] 0x00000000105440
1.35% find [e1000e] [k] 0x00000000010948
0.68% sleep libc-2.10.2.so [.] 0x0000000011ad5b
acme@parisc:~/git/linux-2.6-tip$
But if we:
acme@parisc:~/git/linux-2.6-tip$ ls ~/.debug
ls: cannot access /home/acme/.debug: No such file or directory
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/lib64/libc-2.10.2.so/
acme@parisc:~/git/linux-2.6-tip$ scp doppio:.debug/lib64/libc-2.10.2.so/* ~/.debug/lib64/libc-2.10.2.so/
acme@doppio's password:
eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 100% 1783KB 714.7KB/s 00:02
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/.build-id/eb
acme@parisc:~/git/linux-2.6-tip$ ln -s ../../lib64/libc-2.10.2.so/eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 ~/.debug/.build-id/eb/4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1
acme@parisc:~/git/linux-2.6-tip$ perf report --dsos libc-2.10.2.so 2> /dev/null
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get on the source, F12, x86_64 machine:
[root@doppio linux-2.6-tip]# perf report --dsos libc-2.10.2.so
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[root@doppio linux-2.6-tip]#
So I think this is really, really nice in that it demonstrates
the portability of perf.data files and the use of build-ids
accross such aliens worlds :-)
There are some things to fix tho, like the bitmap on the header,
but things are looking good.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1263478990-8200-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-01-14 17:23:10 +03:00
|
|
|
{
|
2011-01-29 19:01:45 +03:00
|
|
|
event->read.pid = bswap_32(event->read.pid);
|
|
|
|
event->read.tid = bswap_32(event->read.tid);
|
|
|
|
event->read.value = bswap_64(event->read.value);
|
|
|
|
event->read.time_enabled = bswap_64(event->read.time_enabled);
|
|
|
|
event->read.time_running = bswap_64(event->read.time_running);
|
|
|
|
event->read.id = bswap_64(event->read.id);
|
2012-05-30 16:23:43 +04:00
|
|
|
|
|
|
|
if (sample_id_all)
|
|
|
|
swap_sample_id_all(event, &event->read + 1);
|
perf tools: Cross platform perf.data analysis support
There are still some problems related to loading vmlinux files,
but those are unrelated to the feature implemented in this
patch, so will get fixed in the next patches, but here are some
results:
1. collect perf.data file on a Fedora 12 machine, x86_64, 64-bit
userland
2. transfer it to a Debian Testing machine, PARISC64, 32-bit
userland
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | head -5
74f9930ee94475b6b3238caf3725a50d59cb994b [kernel.kallsyms]
55fdd56670453ea66c011158c4b9d30179c1d049 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/ipt_MASQUERADE.ko
41adff63c730890480980d5d8ba513f1c216a858 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/iptable_nat.ko
90a33def1077bb8e97b8a78546dc96c2de62df46 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/nf_nat.ko
984c7bea90ce1376d5c8e7ef43a781801286e62d /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/tun.ko
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | tail -5
22492f3753c6a67de5c7ccbd6b863390c92c0723 /usr/lib64/libXt.so.6.0.0
353802bb7e1b895ba43507cc678f951e778e4c6f /usr/lib64/libMagickCore.so.2.0.0
d10c2897558595efe7be8b0584cf7e6398bc776c /usr/lib64/libfprint.so.0.0.0
a83ecfb519a788774a84d5ddde633c9ba56c03ab /home/acme/bin/perf
d3ca765a8ecf257d263801d7ad8c49c189082317 /usr/lib64/libdwarf.so.0.0
acme@parisc:~/git/linux-2.6-tip$
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm
The file [kernel.kallsyms] cannot be used, trying to use /proc/kallsyms...
^^^^ The problem related to vmlinux handling, it shouldn't be trying this
^^^^ rather alien /proc/kallsyms at all...
/lib64/libpthread-2.10.2.so with build id 5c68f7afeb33309c78037e374b0deee84dd441f6 not found, continuing without symbols
/lib64/libc-2.10.2.so with build id eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 not found, continuing without symbols
/home/acme/bin/perf with build id a83ecfb519a788774a84d5ddde633c9ba56c03ab not found, continuing without symbols
/usr/sbin/openvpn with build id f2037a091ef36b591187a858d75e203690ea9409 not found, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/e1000e/e1000e.ko, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko, continuing without symbols
<SNIP more complaints about not finding the right build-ids,
those will have to wait for 'perf archive' or plain
copying what was collected by 'perf record' on the x86_64,
source machine, see further below for an example of this >
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get when running the same command for the
same perf.data file on the F12, x86_64, source machine:
[root@doppio linux-2.6-tip]# perf report --sort comm
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
[root@doppio linux-2.6-tip]#
The other modes work as well, modulo the problem with vmlinux:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object
# ........ ............... .................................
#
35.11% find ffffffff81002b5a
18.25% perf ffffffff8102235f
16.17% find libc-2.10.2.so
9.07% find find
5.80% swapper ffffffff8102235f
3.95% perf libc-2.10.2.so
2.33% init ffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k
1.35% find [e1000e]
0.68% sleep libc-2.10.2.so
acme@parisc:~/git/linux-2.6-tip$
And the lack of the right buildids:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso,symbol 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object Symbol
# ........ ............... ................................. ......
#
35.11% find ffffffff81002b5a [k] 0xffffffff81002b5a
18.25% perf ffffffff8102235f [k] 0xffffffff8102235f
16.17% find libc-2.10.2.so [.] 0x00000000045782
9.07% find find [.] 0x0000000000fb0e
5.80% swapper ffffffff8102235f [k] 0xffffffff8102235f
3.95% perf libc-2.10.2.so [.] 0x0000000007f398
2.33% init ffffffff810091b9 [k] 0xffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k [.] 0x00000000105440
1.35% find [e1000e] [k] 0x00000000010948
0.68% sleep libc-2.10.2.so [.] 0x0000000011ad5b
acme@parisc:~/git/linux-2.6-tip$
But if we:
acme@parisc:~/git/linux-2.6-tip$ ls ~/.debug
ls: cannot access /home/acme/.debug: No such file or directory
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/lib64/libc-2.10.2.so/
acme@parisc:~/git/linux-2.6-tip$ scp doppio:.debug/lib64/libc-2.10.2.so/* ~/.debug/lib64/libc-2.10.2.so/
acme@doppio's password:
eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 100% 1783KB 714.7KB/s 00:02
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/.build-id/eb
acme@parisc:~/git/linux-2.6-tip$ ln -s ../../lib64/libc-2.10.2.so/eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 ~/.debug/.build-id/eb/4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1
acme@parisc:~/git/linux-2.6-tip$ perf report --dsos libc-2.10.2.so 2> /dev/null
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get on the source, F12, x86_64 machine:
[root@doppio linux-2.6-tip]# perf report --dsos libc-2.10.2.so
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[root@doppio linux-2.6-tip]#
So I think this is really, really nice in that it demonstrates
the portability of perf.data files and the use of build-ids
accross such aliens worlds :-)
There are some things to fix tho, like the bitmap on the header,
but things are looking good.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1263478990-8200-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-01-14 17:23:10 +03:00
|
|
|
}
|
|
|
|
|
2013-09-01 14:36:15 +04:00
|
|
|
static void perf_event__throttle_swap(union perf_event *event,
|
|
|
|
bool sample_id_all)
|
|
|
|
{
|
|
|
|
event->throttle.time = bswap_64(event->throttle.time);
|
|
|
|
event->throttle.id = bswap_64(event->throttle.id);
|
|
|
|
event->throttle.stream_id = bswap_64(event->throttle.stream_id);
|
|
|
|
|
|
|
|
if (sample_id_all)
|
|
|
|
swap_sample_id_all(event, &event->throttle + 1);
|
|
|
|
}
|
|
|
|
|
2012-05-16 10:59:03 +04:00
|
|
|
static u8 revbyte(u8 b)
|
|
|
|
{
|
|
|
|
int rev = (b >> 4) | ((b & 0xf) << 4);
|
|
|
|
rev = ((rev & 0xcc) >> 2) | ((rev & 0x33) << 2);
|
|
|
|
rev = ((rev & 0xaa) >> 1) | ((rev & 0x55) << 1);
|
|
|
|
return (u8) rev;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX this is hack in attempt to carry flags bitfield
|
|
|
|
* throught endian village. ABI says:
|
|
|
|
*
|
|
|
|
* Bit-fields are allocated from right to left (least to most significant)
|
|
|
|
* on little-endian implementations and from left to right (most to least
|
|
|
|
* significant) on big-endian implementations.
|
|
|
|
*
|
|
|
|
* The above seems to be byte specific, so we need to reverse each
|
|
|
|
* byte of the bitfield. 'Internet' also says this might be implementation
|
|
|
|
* specific and we probably need proper fix and carry perf_event_attr
|
|
|
|
* bitfield flags in separate data file FEAT_ section. Thought this seems
|
|
|
|
* to work for now.
|
|
|
|
*/
|
|
|
|
static void swap_bitfield(u8 *p, unsigned len)
|
|
|
|
{
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
*p = revbyte(*p);
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-15 22:34:09 +04:00
|
|
|
/* exported for swapping attributes in file header */
|
|
|
|
void perf_event__attr_swap(struct perf_event_attr *attr)
|
|
|
|
{
|
|
|
|
attr->type = bswap_32(attr->type);
|
|
|
|
attr->size = bswap_32(attr->size);
|
|
|
|
attr->config = bswap_64(attr->config);
|
|
|
|
attr->sample_period = bswap_64(attr->sample_period);
|
|
|
|
attr->sample_type = bswap_64(attr->sample_type);
|
|
|
|
attr->read_format = bswap_64(attr->read_format);
|
|
|
|
attr->wakeup_events = bswap_32(attr->wakeup_events);
|
|
|
|
attr->bp_type = bswap_32(attr->bp_type);
|
|
|
|
attr->bp_addr = bswap_64(attr->bp_addr);
|
|
|
|
attr->bp_len = bswap_64(attr->bp_len);
|
2013-10-18 16:29:03 +04:00
|
|
|
attr->branch_sample_type = bswap_64(attr->branch_sample_type);
|
|
|
|
attr->sample_regs_user = bswap_64(attr->sample_regs_user);
|
|
|
|
attr->sample_stack_user = bswap_32(attr->sample_stack_user);
|
2012-05-16 10:59:03 +04:00
|
|
|
|
|
|
|
swap_bitfield((u8 *) (&attr->read_format + 1), sizeof(u64));
|
2011-07-15 22:34:09 +04:00
|
|
|
}
|
|
|
|
|
2012-05-30 16:23:43 +04:00
|
|
|
static void perf_event__hdr_attr_swap(union perf_event *event,
|
2012-09-11 02:15:03 +04:00
|
|
|
bool sample_id_all __maybe_unused)
|
2010-04-02 08:59:19 +04:00
|
|
|
{
|
|
|
|
size_t size;
|
|
|
|
|
2011-07-15 22:34:09 +04:00
|
|
|
perf_event__attr_swap(&event->attr.attr);
|
2010-04-02 08:59:19 +04:00
|
|
|
|
2011-01-29 19:01:45 +03:00
|
|
|
size = event->header.size;
|
|
|
|
size -= (void *)&event->attr.id - (void *)event;
|
|
|
|
mem_bswap_64(event->attr.id, size);
|
2010-04-02 08:59:19 +04:00
|
|
|
}
|
|
|
|
|
2012-05-30 16:23:43 +04:00
|
|
|
static void perf_event__event_type_swap(union perf_event *event,
|
2012-09-11 02:15:03 +04:00
|
|
|
bool sample_id_all __maybe_unused)
|
2010-04-02 08:59:20 +04:00
|
|
|
{
|
2011-01-29 19:01:45 +03:00
|
|
|
event->event_type.event_type.event_id =
|
|
|
|
bswap_64(event->event_type.event_type.event_id);
|
2010-04-02 08:59:20 +04:00
|
|
|
}
|
|
|
|
|
2012-05-30 16:23:43 +04:00
|
|
|
static void perf_event__tracing_data_swap(union perf_event *event,
|
2012-09-11 02:15:03 +04:00
|
|
|
bool sample_id_all __maybe_unused)
|
2010-04-02 08:59:21 +04:00
|
|
|
{
|
2011-01-29 19:01:45 +03:00
|
|
|
event->tracing_data.size = bswap_32(event->tracing_data.size);
|
2010-04-02 08:59:21 +04:00
|
|
|
}
|
|
|
|
|
2012-05-30 16:23:43 +04:00
|
|
|
typedef void (*perf_event__swap_op)(union perf_event *event,
|
|
|
|
bool sample_id_all);
|
perf tools: Cross platform perf.data analysis support
There are still some problems related to loading vmlinux files,
but those are unrelated to the feature implemented in this
patch, so will get fixed in the next patches, but here are some
results:
1. collect perf.data file on a Fedora 12 machine, x86_64, 64-bit
userland
2. transfer it to a Debian Testing machine, PARISC64, 32-bit
userland
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | head -5
74f9930ee94475b6b3238caf3725a50d59cb994b [kernel.kallsyms]
55fdd56670453ea66c011158c4b9d30179c1d049 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/ipt_MASQUERADE.ko
41adff63c730890480980d5d8ba513f1c216a858 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/iptable_nat.ko
90a33def1077bb8e97b8a78546dc96c2de62df46 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/nf_nat.ko
984c7bea90ce1376d5c8e7ef43a781801286e62d /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/tun.ko
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | tail -5
22492f3753c6a67de5c7ccbd6b863390c92c0723 /usr/lib64/libXt.so.6.0.0
353802bb7e1b895ba43507cc678f951e778e4c6f /usr/lib64/libMagickCore.so.2.0.0
d10c2897558595efe7be8b0584cf7e6398bc776c /usr/lib64/libfprint.so.0.0.0
a83ecfb519a788774a84d5ddde633c9ba56c03ab /home/acme/bin/perf
d3ca765a8ecf257d263801d7ad8c49c189082317 /usr/lib64/libdwarf.so.0.0
acme@parisc:~/git/linux-2.6-tip$
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm
The file [kernel.kallsyms] cannot be used, trying to use /proc/kallsyms...
^^^^ The problem related to vmlinux handling, it shouldn't be trying this
^^^^ rather alien /proc/kallsyms at all...
/lib64/libpthread-2.10.2.so with build id 5c68f7afeb33309c78037e374b0deee84dd441f6 not found, continuing without symbols
/lib64/libc-2.10.2.so with build id eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 not found, continuing without symbols
/home/acme/bin/perf with build id a83ecfb519a788774a84d5ddde633c9ba56c03ab not found, continuing without symbols
/usr/sbin/openvpn with build id f2037a091ef36b591187a858d75e203690ea9409 not found, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/e1000e/e1000e.ko, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko, continuing without symbols
<SNIP more complaints about not finding the right build-ids,
those will have to wait for 'perf archive' or plain
copying what was collected by 'perf record' on the x86_64,
source machine, see further below for an example of this >
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get when running the same command for the
same perf.data file on the F12, x86_64, source machine:
[root@doppio linux-2.6-tip]# perf report --sort comm
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
[root@doppio linux-2.6-tip]#
The other modes work as well, modulo the problem with vmlinux:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object
# ........ ............... .................................
#
35.11% find ffffffff81002b5a
18.25% perf ffffffff8102235f
16.17% find libc-2.10.2.so
9.07% find find
5.80% swapper ffffffff8102235f
3.95% perf libc-2.10.2.so
2.33% init ffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k
1.35% find [e1000e]
0.68% sleep libc-2.10.2.so
acme@parisc:~/git/linux-2.6-tip$
And the lack of the right buildids:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso,symbol 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object Symbol
# ........ ............... ................................. ......
#
35.11% find ffffffff81002b5a [k] 0xffffffff81002b5a
18.25% perf ffffffff8102235f [k] 0xffffffff8102235f
16.17% find libc-2.10.2.so [.] 0x00000000045782
9.07% find find [.] 0x0000000000fb0e
5.80% swapper ffffffff8102235f [k] 0xffffffff8102235f
3.95% perf libc-2.10.2.so [.] 0x0000000007f398
2.33% init ffffffff810091b9 [k] 0xffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k [.] 0x00000000105440
1.35% find [e1000e] [k] 0x00000000010948
0.68% sleep libc-2.10.2.so [.] 0x0000000011ad5b
acme@parisc:~/git/linux-2.6-tip$
But if we:
acme@parisc:~/git/linux-2.6-tip$ ls ~/.debug
ls: cannot access /home/acme/.debug: No such file or directory
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/lib64/libc-2.10.2.so/
acme@parisc:~/git/linux-2.6-tip$ scp doppio:.debug/lib64/libc-2.10.2.so/* ~/.debug/lib64/libc-2.10.2.so/
acme@doppio's password:
eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 100% 1783KB 714.7KB/s 00:02
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/.build-id/eb
acme@parisc:~/git/linux-2.6-tip$ ln -s ../../lib64/libc-2.10.2.so/eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 ~/.debug/.build-id/eb/4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1
acme@parisc:~/git/linux-2.6-tip$ perf report --dsos libc-2.10.2.so 2> /dev/null
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get on the source, F12, x86_64 machine:
[root@doppio linux-2.6-tip]# perf report --dsos libc-2.10.2.so
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[root@doppio linux-2.6-tip]#
So I think this is really, really nice in that it demonstrates
the portability of perf.data files and the use of build-ids
accross such aliens worlds :-)
There are some things to fix tho, like the bitmap on the header,
but things are looking good.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1263478990-8200-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-01-14 17:23:10 +03:00
|
|
|
|
2011-01-29 19:01:45 +03:00
|
|
|
static perf_event__swap_op perf_event__swap_ops[] = {
|
|
|
|
[PERF_RECORD_MMAP] = perf_event__mmap_swap,
|
2013-08-21 14:10:25 +04:00
|
|
|
[PERF_RECORD_MMAP2] = perf_event__mmap2_swap,
|
2011-01-29 19:01:45 +03:00
|
|
|
[PERF_RECORD_COMM] = perf_event__comm_swap,
|
|
|
|
[PERF_RECORD_FORK] = perf_event__task_swap,
|
|
|
|
[PERF_RECORD_EXIT] = perf_event__task_swap,
|
|
|
|
[PERF_RECORD_LOST] = perf_event__all64_swap,
|
|
|
|
[PERF_RECORD_READ] = perf_event__read_swap,
|
2013-09-01 14:36:15 +04:00
|
|
|
[PERF_RECORD_THROTTLE] = perf_event__throttle_swap,
|
|
|
|
[PERF_RECORD_UNTHROTTLE] = perf_event__throttle_swap,
|
2011-01-29 19:01:45 +03:00
|
|
|
[PERF_RECORD_SAMPLE] = perf_event__all64_swap,
|
2011-07-15 22:34:09 +04:00
|
|
|
[PERF_RECORD_HEADER_ATTR] = perf_event__hdr_attr_swap,
|
2011-01-29 19:01:45 +03:00
|
|
|
[PERF_RECORD_HEADER_EVENT_TYPE] = perf_event__event_type_swap,
|
|
|
|
[PERF_RECORD_HEADER_TRACING_DATA] = perf_event__tracing_data_swap,
|
|
|
|
[PERF_RECORD_HEADER_BUILD_ID] = NULL,
|
|
|
|
[PERF_RECORD_HEADER_MAX] = NULL,
|
perf tools: Cross platform perf.data analysis support
There are still some problems related to loading vmlinux files,
but those are unrelated to the feature implemented in this
patch, so will get fixed in the next patches, but here are some
results:
1. collect perf.data file on a Fedora 12 machine, x86_64, 64-bit
userland
2. transfer it to a Debian Testing machine, PARISC64, 32-bit
userland
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | head -5
74f9930ee94475b6b3238caf3725a50d59cb994b [kernel.kallsyms]
55fdd56670453ea66c011158c4b9d30179c1d049 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/ipt_MASQUERADE.ko
41adff63c730890480980d5d8ba513f1c216a858 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/iptable_nat.ko
90a33def1077bb8e97b8a78546dc96c2de62df46 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/nf_nat.ko
984c7bea90ce1376d5c8e7ef43a781801286e62d /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/tun.ko
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | tail -5
22492f3753c6a67de5c7ccbd6b863390c92c0723 /usr/lib64/libXt.so.6.0.0
353802bb7e1b895ba43507cc678f951e778e4c6f /usr/lib64/libMagickCore.so.2.0.0
d10c2897558595efe7be8b0584cf7e6398bc776c /usr/lib64/libfprint.so.0.0.0
a83ecfb519a788774a84d5ddde633c9ba56c03ab /home/acme/bin/perf
d3ca765a8ecf257d263801d7ad8c49c189082317 /usr/lib64/libdwarf.so.0.0
acme@parisc:~/git/linux-2.6-tip$
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm
The file [kernel.kallsyms] cannot be used, trying to use /proc/kallsyms...
^^^^ The problem related to vmlinux handling, it shouldn't be trying this
^^^^ rather alien /proc/kallsyms at all...
/lib64/libpthread-2.10.2.so with build id 5c68f7afeb33309c78037e374b0deee84dd441f6 not found, continuing without symbols
/lib64/libc-2.10.2.so with build id eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 not found, continuing without symbols
/home/acme/bin/perf with build id a83ecfb519a788774a84d5ddde633c9ba56c03ab not found, continuing without symbols
/usr/sbin/openvpn with build id f2037a091ef36b591187a858d75e203690ea9409 not found, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/e1000e/e1000e.ko, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko, continuing without symbols
<SNIP more complaints about not finding the right build-ids,
those will have to wait for 'perf archive' or plain
copying what was collected by 'perf record' on the x86_64,
source machine, see further below for an example of this >
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get when running the same command for the
same perf.data file on the F12, x86_64, source machine:
[root@doppio linux-2.6-tip]# perf report --sort comm
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
[root@doppio linux-2.6-tip]#
The other modes work as well, modulo the problem with vmlinux:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object
# ........ ............... .................................
#
35.11% find ffffffff81002b5a
18.25% perf ffffffff8102235f
16.17% find libc-2.10.2.so
9.07% find find
5.80% swapper ffffffff8102235f
3.95% perf libc-2.10.2.so
2.33% init ffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k
1.35% find [e1000e]
0.68% sleep libc-2.10.2.so
acme@parisc:~/git/linux-2.6-tip$
And the lack of the right buildids:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso,symbol 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object Symbol
# ........ ............... ................................. ......
#
35.11% find ffffffff81002b5a [k] 0xffffffff81002b5a
18.25% perf ffffffff8102235f [k] 0xffffffff8102235f
16.17% find libc-2.10.2.so [.] 0x00000000045782
9.07% find find [.] 0x0000000000fb0e
5.80% swapper ffffffff8102235f [k] 0xffffffff8102235f
3.95% perf libc-2.10.2.so [.] 0x0000000007f398
2.33% init ffffffff810091b9 [k] 0xffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k [.] 0x00000000105440
1.35% find [e1000e] [k] 0x00000000010948
0.68% sleep libc-2.10.2.so [.] 0x0000000011ad5b
acme@parisc:~/git/linux-2.6-tip$
But if we:
acme@parisc:~/git/linux-2.6-tip$ ls ~/.debug
ls: cannot access /home/acme/.debug: No such file or directory
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/lib64/libc-2.10.2.so/
acme@parisc:~/git/linux-2.6-tip$ scp doppio:.debug/lib64/libc-2.10.2.so/* ~/.debug/lib64/libc-2.10.2.so/
acme@doppio's password:
eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 100% 1783KB 714.7KB/s 00:02
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/.build-id/eb
acme@parisc:~/git/linux-2.6-tip$ ln -s ../../lib64/libc-2.10.2.so/eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 ~/.debug/.build-id/eb/4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1
acme@parisc:~/git/linux-2.6-tip$ perf report --dsos libc-2.10.2.so 2> /dev/null
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get on the source, F12, x86_64 machine:
[root@doppio linux-2.6-tip]# perf report --dsos libc-2.10.2.so
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[root@doppio linux-2.6-tip]#
So I think this is really, really nice in that it demonstrates
the portability of perf.data files and the use of build-ids
accross such aliens worlds :-)
There are some things to fix tho, like the bitmap on the header,
but things are looking good.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1263478990-8200-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-01-14 17:23:10 +03:00
|
|
|
};
|
|
|
|
|
2010-04-24 02:04:12 +04:00
|
|
|
struct sample_queue {
|
|
|
|
u64 timestamp;
|
2010-12-07 15:48:50 +03:00
|
|
|
u64 file_offset;
|
2011-01-29 19:01:45 +03:00
|
|
|
union perf_event *event;
|
2010-04-24 02:04:12 +04:00
|
|
|
struct list_head list;
|
|
|
|
};
|
|
|
|
|
2010-11-30 20:49:53 +03:00
|
|
|
static void perf_session_free_sample_buffers(struct perf_session *session)
|
|
|
|
{
|
|
|
|
struct ordered_samples *os = &session->ordered_samples;
|
|
|
|
|
2010-11-30 20:49:55 +03:00
|
|
|
while (!list_empty(&os->to_free)) {
|
2010-11-30 20:49:53 +03:00
|
|
|
struct sample_queue *sq;
|
|
|
|
|
2010-11-30 20:49:55 +03:00
|
|
|
sq = list_entry(os->to_free.next, struct sample_queue, list);
|
2010-11-30 20:49:53 +03:00
|
|
|
list_del(&sq->list);
|
|
|
|
free(sq);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-05 16:32:55 +03:00
|
|
|
static int perf_session_deliver_event(struct perf_session *session,
|
2011-01-29 19:01:45 +03:00
|
|
|
union perf_event *event,
|
2011-01-29 18:02:00 +03:00
|
|
|
struct perf_sample *sample,
|
2011-11-28 14:30:20 +04:00
|
|
|
struct perf_tool *tool,
|
2010-12-07 15:48:53 +03:00
|
|
|
u64 file_offset);
|
2010-12-05 16:32:55 +03:00
|
|
|
|
2012-08-26 22:24:41 +04:00
|
|
|
static int flush_sample_queue(struct perf_session *s,
|
2013-08-03 00:05:41 +04:00
|
|
|
struct perf_tool *tool)
|
2010-04-24 02:04:12 +04:00
|
|
|
{
|
2010-11-30 20:49:33 +03:00
|
|
|
struct ordered_samples *os = &s->ordered_samples;
|
|
|
|
struct list_head *head = &os->samples;
|
2010-04-24 02:04:12 +04:00
|
|
|
struct sample_queue *tmp, *iter;
|
2011-01-29 18:02:00 +03:00
|
|
|
struct perf_sample sample;
|
2010-11-30 20:49:33 +03:00
|
|
|
u64 limit = os->next_flush;
|
|
|
|
u64 last_ts = os->last_sample ? os->last_sample->timestamp : 0ULL;
|
2013-09-05 13:14:50 +04:00
|
|
|
bool show_progress = limit == ULLONG_MAX;
|
2013-10-23 22:40:38 +04:00
|
|
|
struct ui_progress prog;
|
2011-05-22 04:17:22 +04:00
|
|
|
int ret;
|
2010-04-24 02:04:12 +04:00
|
|
|
|
2011-11-28 14:30:20 +04:00
|
|
|
if (!tool->ordered_samples || !limit)
|
2012-08-26 22:24:41 +04:00
|
|
|
return 0;
|
2010-04-24 02:04:12 +04:00
|
|
|
|
2013-10-23 22:40:38 +04:00
|
|
|
if (show_progress)
|
|
|
|
ui_progress__init(&prog, os->nr_samples, "Processing time ordered events...");
|
|
|
|
|
2010-04-24 02:04:12 +04:00
|
|
|
list_for_each_entry_safe(iter, tmp, head, list) {
|
2013-09-17 23:34:28 +04:00
|
|
|
if (session_done())
|
|
|
|
return 0;
|
|
|
|
|
2010-04-24 02:04:12 +04:00
|
|
|
if (iter->timestamp > limit)
|
2010-11-30 20:49:33 +03:00
|
|
|
break;
|
2010-04-24 02:04:12 +04:00
|
|
|
|
2012-09-26 19:48:18 +04:00
|
|
|
ret = perf_evlist__parse_sample(s->evlist, iter->event, &sample);
|
2011-05-22 04:17:22 +04:00
|
|
|
if (ret)
|
|
|
|
pr_err("Can't parse sample, err = %d\n", ret);
|
2012-08-26 22:24:41 +04:00
|
|
|
else {
|
|
|
|
ret = perf_session_deliver_event(s, iter->event, &sample, tool,
|
|
|
|
iter->file_offset);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
}
|
2010-04-24 02:04:12 +04:00
|
|
|
|
2010-11-30 20:49:33 +03:00
|
|
|
os->last_flush = iter->timestamp;
|
2010-04-24 02:04:12 +04:00
|
|
|
list_del(&iter->list);
|
2010-11-30 20:49:53 +03:00
|
|
|
list_add(&iter->list, &os->sample_cache);
|
2013-10-23 22:40:38 +04:00
|
|
|
|
|
|
|
if (show_progress)
|
|
|
|
ui_progress__update(&prog, 1);
|
2010-04-24 02:04:12 +04:00
|
|
|
}
|
2010-11-30 20:49:33 +03:00
|
|
|
|
|
|
|
if (list_empty(head)) {
|
|
|
|
os->last_sample = NULL;
|
|
|
|
} else if (last_ts <= limit) {
|
|
|
|
os->last_sample =
|
|
|
|
list_entry(head->prev, struct sample_queue, list);
|
|
|
|
}
|
2011-10-29 18:41:45 +04:00
|
|
|
|
|
|
|
os->nr_samples = 0;
|
2012-08-26 22:24:41 +04:00
|
|
|
|
|
|
|
return 0;
|
2010-04-24 02:04:12 +04:00
|
|
|
}
|
|
|
|
|
2010-05-03 17:14:33 +04:00
|
|
|
/*
|
|
|
|
* When perf record finishes a pass on every buffers, it records this pseudo
|
|
|
|
* event.
|
|
|
|
* We record the max timestamp t found in the pass n.
|
|
|
|
* Assuming these timestamps are monotonic across cpus, we know that if
|
|
|
|
* a buffer still has events with timestamps below t, they will be all
|
|
|
|
* available and then read in the pass n + 1.
|
|
|
|
* Hence when we start to read the pass n + 2, we can safely flush every
|
|
|
|
* events with timestamps below t.
|
|
|
|
*
|
|
|
|
* ============ PASS n =================
|
|
|
|
* CPU 0 | CPU 1
|
|
|
|
* |
|
|
|
|
* cnt1 timestamps | cnt2 timestamps
|
|
|
|
* 1 | 2
|
|
|
|
* 2 | 3
|
|
|
|
* - | 4 <--- max recorded
|
|
|
|
*
|
|
|
|
* ============ PASS n + 1 ==============
|
|
|
|
* CPU 0 | CPU 1
|
|
|
|
* |
|
|
|
|
* cnt1 timestamps | cnt2 timestamps
|
|
|
|
* 3 | 5
|
|
|
|
* 4 | 6
|
|
|
|
* 5 | 7 <---- max recorded
|
|
|
|
*
|
|
|
|
* Flush every events below timestamp 4
|
|
|
|
*
|
|
|
|
* ============ PASS n + 2 ==============
|
|
|
|
* CPU 0 | CPU 1
|
|
|
|
* |
|
|
|
|
* cnt1 timestamps | cnt2 timestamps
|
|
|
|
* 6 | 8
|
|
|
|
* 7 | 9
|
|
|
|
* - | 10
|
|
|
|
*
|
|
|
|
* Flush every events below timestamp 7
|
|
|
|
* etc...
|
|
|
|
*/
|
2011-11-28 14:30:20 +04:00
|
|
|
static int process_finished_round(struct perf_tool *tool,
|
2012-09-11 02:15:03 +04:00
|
|
|
union perf_event *event __maybe_unused,
|
2011-11-25 14:19:45 +04:00
|
|
|
struct perf_session *session)
|
2010-05-03 17:14:33 +04:00
|
|
|
{
|
2012-08-26 22:24:41 +04:00
|
|
|
int ret = flush_sample_queue(session, tool);
|
|
|
|
if (!ret)
|
|
|
|
session->ordered_samples.next_flush = session->ordered_samples.max_timestamp;
|
2010-05-03 17:14:33 +04:00
|
|
|
|
2012-08-26 22:24:41 +04:00
|
|
|
return ret;
|
2010-05-03 17:14:33 +04:00
|
|
|
}
|
|
|
|
|
2010-04-24 02:04:12 +04:00
|
|
|
/* The queue is ordered by time */
|
2010-12-05 16:32:55 +03:00
|
|
|
static void __queue_event(struct sample_queue *new, struct perf_session *s)
|
2010-04-24 02:04:12 +04:00
|
|
|
{
|
2010-11-30 20:49:33 +03:00
|
|
|
struct ordered_samples *os = &s->ordered_samples;
|
|
|
|
struct sample_queue *sample = os->last_sample;
|
|
|
|
u64 timestamp = new->timestamp;
|
|
|
|
struct list_head *p;
|
2010-04-24 02:04:12 +04:00
|
|
|
|
2011-10-29 18:41:45 +04:00
|
|
|
++os->nr_samples;
|
2010-11-30 20:49:33 +03:00
|
|
|
os->last_sample = new;
|
2010-04-24 02:04:12 +04:00
|
|
|
|
2010-11-30 20:49:33 +03:00
|
|
|
if (!sample) {
|
|
|
|
list_add(&new->list, &os->samples);
|
|
|
|
os->max_timestamp = timestamp;
|
2010-04-24 02:04:12 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2010-11-30 20:49:33 +03:00
|
|
|
* last_sample might point to some random place in the list as it's
|
|
|
|
* the last queued event. We expect that the new event is close to
|
|
|
|
* this.
|
2010-04-24 02:04:12 +04:00
|
|
|
*/
|
2010-11-30 20:49:33 +03:00
|
|
|
if (sample->timestamp <= timestamp) {
|
|
|
|
while (sample->timestamp <= timestamp) {
|
|
|
|
p = sample->list.next;
|
|
|
|
if (p == &os->samples) {
|
|
|
|
list_add_tail(&new->list, &os->samples);
|
|
|
|
os->max_timestamp = timestamp;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
sample = list_entry(p, struct sample_queue, list);
|
|
|
|
}
|
|
|
|
list_add_tail(&new->list, &sample->list);
|
|
|
|
} else {
|
|
|
|
while (sample->timestamp > timestamp) {
|
|
|
|
p = sample->list.prev;
|
|
|
|
if (p == &os->samples) {
|
|
|
|
list_add(&new->list, &os->samples);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
sample = list_entry(p, struct sample_queue, list);
|
|
|
|
}
|
|
|
|
list_add(&new->list, &sample->list);
|
|
|
|
}
|
2010-04-24 02:04:12 +04:00
|
|
|
}
|
|
|
|
|
2010-11-30 20:49:55 +03:00
|
|
|
#define MAX_SAMPLE_BUFFER (64 * 1024 / sizeof(struct sample_queue))
|
|
|
|
|
2013-08-06 05:41:33 +04:00
|
|
|
int perf_session_queue_event(struct perf_session *s, union perf_event *event,
|
2011-01-29 18:02:00 +03:00
|
|
|
struct perf_sample *sample, u64 file_offset)
|
2010-04-24 02:04:12 +04:00
|
|
|
{
|
2010-11-30 20:49:55 +03:00
|
|
|
struct ordered_samples *os = &s->ordered_samples;
|
|
|
|
struct list_head *sc = &os->sample_cache;
|
2011-01-29 18:02:00 +03:00
|
|
|
u64 timestamp = sample->time;
|
2010-04-24 02:04:12 +04:00
|
|
|
struct sample_queue *new;
|
|
|
|
|
2010-12-07 15:48:44 +03:00
|
|
|
if (!timestamp || timestamp == ~0ULL)
|
2010-12-05 16:32:55 +03:00
|
|
|
return -ETIME;
|
|
|
|
|
2010-04-24 02:04:12 +04:00
|
|
|
if (timestamp < s->ordered_samples.last_flush) {
|
|
|
|
printf("Warning: Timestamp below last timeslice flush\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2010-11-30 20:49:53 +03:00
|
|
|
if (!list_empty(sc)) {
|
|
|
|
new = list_entry(sc->next, struct sample_queue, list);
|
|
|
|
list_del(&new->list);
|
2010-11-30 20:49:55 +03:00
|
|
|
} else if (os->sample_buffer) {
|
|
|
|
new = os->sample_buffer + os->sample_buffer_idx;
|
|
|
|
if (++os->sample_buffer_idx == MAX_SAMPLE_BUFFER)
|
|
|
|
os->sample_buffer = NULL;
|
2010-11-30 20:49:53 +03:00
|
|
|
} else {
|
2010-11-30 20:49:55 +03:00
|
|
|
os->sample_buffer = malloc(MAX_SAMPLE_BUFFER * sizeof(*new));
|
|
|
|
if (!os->sample_buffer)
|
2010-11-30 20:49:53 +03:00
|
|
|
return -ENOMEM;
|
2010-11-30 20:49:55 +03:00
|
|
|
list_add(&os->sample_buffer->list, &os->to_free);
|
|
|
|
os->sample_buffer_idx = 2;
|
|
|
|
new = os->sample_buffer + 1;
|
2010-11-30 20:49:53 +03:00
|
|
|
}
|
2010-04-24 02:04:12 +04:00
|
|
|
|
|
|
|
new->timestamp = timestamp;
|
2010-12-07 15:48:50 +03:00
|
|
|
new->file_offset = file_offset;
|
2010-11-30 20:49:49 +03:00
|
|
|
new->event = event;
|
2010-04-24 02:04:12 +04:00
|
|
|
|
2010-12-05 16:32:55 +03:00
|
|
|
__queue_event(new, s);
|
perf session: Parse sample earlier
At perf_session__process_event, so that we reduce the number of lines in eache
tool sample processing routine that now receives a sample_data pointer already
parsed.
This will also be useful in the next patch, where we'll allow sample the
identity fields in MMAP, FORK, EXIT, etc, when it will be possible to see (cpu,
timestamp) just after before every event.
Also validate callchains in perf_session__process_event, i.e. as early as
possible, and keep a counter of the number of events discarded due to invalid
callchains, warning the user about it if it happens.
There is an assumption that was kept that all events have the same sample_type,
that will be dealt with in the future, when this preexisting limitation will be
removed.
Tested-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Ian Munsie <imunsie@au1.ibm.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Ian Munsie <imunsie@au1.ibm.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <1291318772-30880-4-git-send-email-acme@infradead.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-12-02 19:10:21 +03:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2010-04-24 02:04:12 +04:00
|
|
|
|
2011-01-29 18:02:00 +03:00
|
|
|
static void callchain__printf(struct perf_sample *sample)
|
perf session: Parse sample earlier
At perf_session__process_event, so that we reduce the number of lines in eache
tool sample processing routine that now receives a sample_data pointer already
parsed.
This will also be useful in the next patch, where we'll allow sample the
identity fields in MMAP, FORK, EXIT, etc, when it will be possible to see (cpu,
timestamp) just after before every event.
Also validate callchains in perf_session__process_event, i.e. as early as
possible, and keep a counter of the number of events discarded due to invalid
callchains, warning the user about it if it happens.
There is an assumption that was kept that all events have the same sample_type,
that will be dealt with in the future, when this preexisting limitation will be
removed.
Tested-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Ian Munsie <imunsie@au1.ibm.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Ian Munsie <imunsie@au1.ibm.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <1291318772-30880-4-git-send-email-acme@infradead.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-12-02 19:10:21 +03:00
|
|
|
{
|
|
|
|
unsigned int i;
|
2010-04-24 02:04:12 +04:00
|
|
|
|
2011-01-23 01:37:02 +03:00
|
|
|
printf("... chain: nr:%" PRIu64 "\n", sample->callchain->nr);
|
perf session: Parse sample earlier
At perf_session__process_event, so that we reduce the number of lines in eache
tool sample processing routine that now receives a sample_data pointer already
parsed.
This will also be useful in the next patch, where we'll allow sample the
identity fields in MMAP, FORK, EXIT, etc, when it will be possible to see (cpu,
timestamp) just after before every event.
Also validate callchains in perf_session__process_event, i.e. as early as
possible, and keep a counter of the number of events discarded due to invalid
callchains, warning the user about it if it happens.
There is an assumption that was kept that all events have the same sample_type,
that will be dealt with in the future, when this preexisting limitation will be
removed.
Tested-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Ian Munsie <imunsie@au1.ibm.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Ian Munsie <imunsie@au1.ibm.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <1291318772-30880-4-git-send-email-acme@infradead.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-12-02 19:10:21 +03:00
|
|
|
|
|
|
|
for (i = 0; i < sample->callchain->nr; i++)
|
2011-01-23 01:37:02 +03:00
|
|
|
printf("..... %2d: %016" PRIx64 "\n",
|
|
|
|
i, sample->callchain->ips[i]);
|
2010-04-24 02:04:12 +04:00
|
|
|
}
|
|
|
|
|
2012-02-10 02:21:01 +04:00
|
|
|
static void branch_stack__printf(struct perf_sample *sample)
|
|
|
|
{
|
|
|
|
uint64_t i;
|
|
|
|
|
|
|
|
printf("... branch stack: nr:%" PRIu64 "\n", sample->branch_stack->nr);
|
|
|
|
|
|
|
|
for (i = 0; i < sample->branch_stack->nr; i++)
|
|
|
|
printf("..... %2"PRIu64": %016" PRIx64 " -> %016" PRIx64 "\n",
|
|
|
|
i, sample->branch_stack->entries[i].from,
|
|
|
|
sample->branch_stack->entries[i].to);
|
|
|
|
}
|
|
|
|
|
2012-08-07 17:20:45 +04:00
|
|
|
static void regs_dump__printf(u64 mask, u64 *regs)
|
|
|
|
{
|
|
|
|
unsigned rid, i = 0;
|
|
|
|
|
|
|
|
for_each_set_bit(rid, (unsigned long *) &mask, sizeof(mask) * 8) {
|
|
|
|
u64 val = regs[i++];
|
|
|
|
|
|
|
|
printf(".... %-5s 0x%" PRIx64 "\n",
|
|
|
|
perf_reg_name(rid), val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void regs_user__printf(struct perf_sample *sample, u64 mask)
|
|
|
|
{
|
|
|
|
struct regs_dump *user_regs = &sample->user_regs;
|
|
|
|
|
|
|
|
if (user_regs->regs) {
|
|
|
|
printf("... user regs: mask 0x%" PRIx64 "\n", mask);
|
|
|
|
regs_dump__printf(mask, user_regs->regs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void stack_user__printf(struct stack_dump *dump)
|
|
|
|
{
|
|
|
|
printf("... ustack: size %" PRIu64 ", offset 0x%x\n",
|
|
|
|
dump->size, dump->offset);
|
|
|
|
}
|
|
|
|
|
2010-12-02 15:25:28 +03:00
|
|
|
static void perf_session__print_tstamp(struct perf_session *session,
|
2011-01-29 19:01:45 +03:00
|
|
|
union perf_event *event,
|
2011-01-29 18:02:00 +03:00
|
|
|
struct perf_sample *sample)
|
2010-12-02 15:25:28 +03:00
|
|
|
{
|
2013-08-27 12:23:09 +04:00
|
|
|
u64 sample_type = __perf_evlist__combined_sample_type(session->evlist);
|
2012-08-02 02:15:52 +04:00
|
|
|
|
2010-12-02 15:25:28 +03:00
|
|
|
if (event->header.type != PERF_RECORD_SAMPLE &&
|
2012-08-02 02:25:26 +04:00
|
|
|
!perf_evlist__sample_id_all(session->evlist)) {
|
2010-12-02 15:25:28 +03:00
|
|
|
fputs("-1 -1 ", stdout);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-08-02 02:15:52 +04:00
|
|
|
if ((sample_type & PERF_SAMPLE_CPU))
|
2010-12-02 15:25:28 +03:00
|
|
|
printf("%u ", sample->cpu);
|
|
|
|
|
2012-08-02 02:15:52 +04:00
|
|
|
if (sample_type & PERF_SAMPLE_TIME)
|
2011-01-23 01:37:02 +03:00
|
|
|
printf("%" PRIu64 " ", sample->time);
|
2010-12-02 15:25:28 +03:00
|
|
|
}
|
|
|
|
|
2012-10-10 19:38:13 +04:00
|
|
|
static void sample_read__printf(struct perf_sample *sample, u64 read_format)
|
|
|
|
{
|
|
|
|
printf("... sample_read:\n");
|
|
|
|
|
|
|
|
if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED)
|
|
|
|
printf("...... time enabled %016" PRIx64 "\n",
|
|
|
|
sample->read.time_enabled);
|
|
|
|
|
|
|
|
if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING)
|
|
|
|
printf("...... time running %016" PRIx64 "\n",
|
|
|
|
sample->read.time_running);
|
|
|
|
|
|
|
|
if (read_format & PERF_FORMAT_GROUP) {
|
|
|
|
u64 i;
|
|
|
|
|
|
|
|
printf(".... group nr %" PRIu64 "\n", sample->read.group.nr);
|
|
|
|
|
|
|
|
for (i = 0; i < sample->read.group.nr; i++) {
|
|
|
|
struct sample_read_value *value;
|
|
|
|
|
|
|
|
value = &sample->read.group.values[i];
|
|
|
|
printf("..... id %016" PRIx64
|
|
|
|
", value %016" PRIx64 "\n",
|
|
|
|
value->id, value->value);
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
printf("..... id %016" PRIx64 ", value %016" PRIx64 "\n",
|
|
|
|
sample->read.one.id, sample->read.one.value);
|
|
|
|
}
|
|
|
|
|
2011-01-29 19:01:45 +03:00
|
|
|
static void dump_event(struct perf_session *session, union perf_event *event,
|
2011-01-29 18:02:00 +03:00
|
|
|
u64 file_offset, struct perf_sample *sample)
|
2010-12-07 15:48:47 +03:00
|
|
|
{
|
|
|
|
if (!dump_trace)
|
|
|
|
return;
|
|
|
|
|
2011-01-23 01:37:02 +03:00
|
|
|
printf("\n%#" PRIx64 " [%#x]: event: %d\n",
|
|
|
|
file_offset, event->header.size, event->header.type);
|
2010-12-07 15:48:47 +03:00
|
|
|
|
|
|
|
trace_event(event);
|
|
|
|
|
|
|
|
if (sample)
|
|
|
|
perf_session__print_tstamp(session, event, sample);
|
|
|
|
|
2011-01-23 01:37:02 +03:00
|
|
|
printf("%#" PRIx64 " [%#x]: PERF_RECORD_%s", file_offset,
|
2011-01-29 19:01:45 +03:00
|
|
|
event->header.size, perf_event__name(event->header.type));
|
2010-12-07 15:48:47 +03:00
|
|
|
}
|
|
|
|
|
2012-08-07 17:20:45 +04:00
|
|
|
static void dump_sample(struct perf_evsel *evsel, union perf_event *event,
|
2011-01-29 18:02:00 +03:00
|
|
|
struct perf_sample *sample)
|
2010-12-07 15:48:47 +03:00
|
|
|
{
|
2012-08-02 02:15:52 +04:00
|
|
|
u64 sample_type;
|
|
|
|
|
2010-12-09 17:20:20 +03:00
|
|
|
if (!dump_trace)
|
|
|
|
return;
|
|
|
|
|
2011-05-30 23:08:23 +04:00
|
|
|
printf("(IP, %d): %d/%d: %#" PRIx64 " period: %" PRIu64 " addr: %#" PRIx64 "\n",
|
2011-01-23 01:37:02 +03:00
|
|
|
event->header.misc, sample->pid, sample->tid, sample->ip,
|
2011-05-30 23:08:23 +04:00
|
|
|
sample->period, sample->addr);
|
2010-12-07 15:48:47 +03:00
|
|
|
|
2012-08-07 17:20:45 +04:00
|
|
|
sample_type = evsel->attr.sample_type;
|
2012-08-02 02:15:52 +04:00
|
|
|
|
|
|
|
if (sample_type & PERF_SAMPLE_CALLCHAIN)
|
2010-12-09 17:20:20 +03:00
|
|
|
callchain__printf(sample);
|
2012-02-10 02:21:01 +04:00
|
|
|
|
2012-08-02 02:15:52 +04:00
|
|
|
if (sample_type & PERF_SAMPLE_BRANCH_STACK)
|
2012-02-10 02:21:01 +04:00
|
|
|
branch_stack__printf(sample);
|
2012-08-07 17:20:45 +04:00
|
|
|
|
|
|
|
if (sample_type & PERF_SAMPLE_REGS_USER)
|
|
|
|
regs_user__printf(sample, evsel->attr.sample_regs_user);
|
|
|
|
|
|
|
|
if (sample_type & PERF_SAMPLE_STACK_USER)
|
|
|
|
stack_user__printf(&sample->user_stack);
|
2013-01-24 19:10:29 +04:00
|
|
|
|
|
|
|
if (sample_type & PERF_SAMPLE_WEIGHT)
|
|
|
|
printf("... weight: %" PRIu64 "\n", sample->weight);
|
2013-01-24 19:10:35 +04:00
|
|
|
|
|
|
|
if (sample_type & PERF_SAMPLE_DATA_SRC)
|
|
|
|
printf(" . data_src: 0x%"PRIx64"\n", sample->data_src);
|
2012-10-10 19:38:13 +04:00
|
|
|
|
2013-09-20 18:40:43 +04:00
|
|
|
if (sample_type & PERF_SAMPLE_TRANSACTION)
|
|
|
|
printf("... transaction: %" PRIx64 "\n", sample->transaction);
|
|
|
|
|
2012-10-10 19:38:13 +04:00
|
|
|
if (sample_type & PERF_SAMPLE_READ)
|
|
|
|
sample_read__printf(sample, evsel->attr.read_format);
|
2010-12-07 15:48:47 +03:00
|
|
|
}
|
|
|
|
|
2011-11-28 13:56:39 +04:00
|
|
|
static struct machine *
|
|
|
|
perf_session__find_machine_for_cpumode(struct perf_session *session,
|
2013-08-27 12:23:06 +04:00
|
|
|
union perf_event *event,
|
|
|
|
struct perf_sample *sample)
|
2011-11-28 13:56:39 +04:00
|
|
|
{
|
|
|
|
const u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
|
|
|
|
|
2012-07-21 03:25:48 +04:00
|
|
|
if (perf_guest &&
|
|
|
|
((cpumode == PERF_RECORD_MISC_GUEST_KERNEL) ||
|
|
|
|
(cpumode == PERF_RECORD_MISC_GUEST_USER))) {
|
2012-04-09 12:22:23 +04:00
|
|
|
u32 pid;
|
|
|
|
|
2013-08-21 14:10:25 +04:00
|
|
|
if (event->header.type == PERF_RECORD_MMAP
|
|
|
|
|| event->header.type == PERF_RECORD_MMAP2)
|
2012-04-09 12:22:23 +04:00
|
|
|
pid = event->mmap.pid;
|
|
|
|
else
|
2013-08-27 12:23:06 +04:00
|
|
|
pid = sample->pid;
|
2012-04-09 12:22:23 +04:00
|
|
|
|
perf kvm: Fix regression with guest machine creation
Commit 743eb868657bdb1b26c7b24077ca21c67c82c777 reworked when the
machines were created. Prior to this commit guest machines could be
created in perf_event__process_kernel_mmap() while processing kernel
MMAP events. This commit assumes that the machines exist by the time
perf_session_deliver_event is called (e.g., during processing of build
id events) - which is not always correct.
One example is the use of default guest args (--guestkallsyms and
--guestmodules) for short times where no samples hit within a guest
module. For this case no build id is added to the file header. No build
id == no machine created. That leads to the next example -- the use of
no-buildid (-B) on the record for all perf-kvm invocations. In both
cases perf report dies with a SEGFAULT of the form:
(gdb) bt
0 0x000000000046dd7b in machine__mmap_name (self=0x0, bf=0x7fffffffbd20 "q\021", size=4096) at util/map.c:715
1 0x0000000000444161 in perf_event__process_kernel_mmap (tool=0x7fffffffdd80, event=0x7ffff7fb4120, machine=0x0) at util/event.c:562
2 0x0000000000444642 in perf_event__process_mmap (tool=0x7fffffffdd80, event=0x7ffff7fb4120, sample=0x7fffffffd210, machine=0x0)
at util/event.c:668
3 0x0000000000470e0b in perf_session_deliver_event (session=0x915ca0, event=0x7ffff7fb4120, sample=0x7fffffffd210, tool=0x7fffffffdd80,
file_offset=8480) at util/session.c:979
4 0x000000000047032e in flush_sample_queue (s=0x915ca0, tool=0x7fffffffdd80) at util/session.c:679
5 0x0000000000471c8d in __perf_session__process_events (session=0x915ca0, data_offset=400, data_size=150448, file_size=150848, tool=
0x7fffffffdd80) at util/session.c:1363
6 0x0000000000471d42 in perf_session__process_events (self=0x915ca0, tool=0x7fffffffdd80) at util/session.c:1379
7 0x000000000042484a in __cmd_report (rep=0x7fffffffdd80) at builtin-report.c:368
8 0x0000000000425bf1 in cmd_report (argc=0, argv=0x915b00, prefix=0x0) at builtin-report.c:756
9 0x0000000000438505 in __cmd_report (argc=4, argv=0x7fffffffe260) at builtin-kvm.c:84
10 0x000000000043882a in cmd_kvm (argc=4, argv=0x7fffffffe260, prefix=0x0) at builtin-kvm.c:131
11 0x00000000004152cd in run_builtin (p=0x7a54e8, argc=9, argv=0x7fffffffe260) at perf.c:273
12 0x00000000004154c7 in handle_internal_command (argc=9, argv=0x7fffffffe260) at perf.c:345
13 0x0000000000415613 in run_argv (argcp=0x7fffffffe14c, argv=0x7fffffffe140) at perf.c:389
14 0x0000000000415899 in main (argc=9, argv=0x7fffffffe260) at perf.c:487
Fix by allowing the machine to be created in perf_session_deliver_event.
Tested with --guestmount option and default guest args, with and without
-B arg on record for both and for short (10 seconds) and long (10
minutes) windows.
Reported-by: Pradeep Kumar Surisetty <psuriset@linux.vnet.ibm.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Pradeep Kumar Surisetty <psuriset@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/1341180697-64515-1-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-07-02 02:11:37 +04:00
|
|
|
return perf_session__findnew_machine(session, pid);
|
2012-04-09 12:22:23 +04:00
|
|
|
}
|
2011-11-28 13:56:39 +04:00
|
|
|
|
2012-12-19 16:04:24 +04:00
|
|
|
return &session->machines.host;
|
2011-11-28 13:56:39 +04:00
|
|
|
}
|
|
|
|
|
2012-10-10 20:52:24 +04:00
|
|
|
static int deliver_sample_value(struct perf_session *session,
|
|
|
|
struct perf_tool *tool,
|
|
|
|
union perf_event *event,
|
|
|
|
struct perf_sample *sample,
|
|
|
|
struct sample_read_value *v,
|
|
|
|
struct machine *machine)
|
|
|
|
{
|
|
|
|
struct perf_sample_id *sid;
|
|
|
|
|
|
|
|
sid = perf_evlist__id2sid(session->evlist, v->id);
|
|
|
|
if (sid) {
|
|
|
|
sample->id = v->id;
|
|
|
|
sample->period = v->value - sid->period;
|
|
|
|
sid->period = v->value;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!sid || sid->evsel == NULL) {
|
|
|
|
++session->stats.nr_unknown_id;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return tool->sample(tool, event, sample, sid->evsel, machine);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int deliver_sample_group(struct perf_session *session,
|
|
|
|
struct perf_tool *tool,
|
|
|
|
union perf_event *event,
|
|
|
|
struct perf_sample *sample,
|
|
|
|
struct machine *machine)
|
|
|
|
{
|
|
|
|
int ret = -EINVAL;
|
|
|
|
u64 i;
|
|
|
|
|
|
|
|
for (i = 0; i < sample->read.group.nr; i++) {
|
|
|
|
ret = deliver_sample_value(session, tool, event, sample,
|
|
|
|
&sample->read.group.values[i],
|
|
|
|
machine);
|
|
|
|
if (ret)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
perf_session__deliver_sample(struct perf_session *session,
|
|
|
|
struct perf_tool *tool,
|
|
|
|
union perf_event *event,
|
|
|
|
struct perf_sample *sample,
|
|
|
|
struct perf_evsel *evsel,
|
|
|
|
struct machine *machine)
|
|
|
|
{
|
|
|
|
/* We know evsel != NULL. */
|
|
|
|
u64 sample_type = evsel->attr.sample_type;
|
|
|
|
u64 read_format = evsel->attr.read_format;
|
|
|
|
|
|
|
|
/* Standard sample delievery. */
|
|
|
|
if (!(sample_type & PERF_SAMPLE_READ))
|
|
|
|
return tool->sample(tool, event, sample, evsel, machine);
|
|
|
|
|
|
|
|
/* For PERF_SAMPLE_READ we have either single or group mode. */
|
|
|
|
if (read_format & PERF_FORMAT_GROUP)
|
|
|
|
return deliver_sample_group(session, tool, event, sample,
|
|
|
|
machine);
|
|
|
|
else
|
|
|
|
return deliver_sample_value(session, tool, event, sample,
|
|
|
|
&sample->read.one, machine);
|
|
|
|
}
|
|
|
|
|
2010-12-05 16:32:55 +03:00
|
|
|
static int perf_session_deliver_event(struct perf_session *session,
|
2011-01-29 19:01:45 +03:00
|
|
|
union perf_event *event,
|
2011-01-29 18:02:00 +03:00
|
|
|
struct perf_sample *sample,
|
2011-11-28 14:30:20 +04:00
|
|
|
struct perf_tool *tool,
|
2010-12-07 15:48:55 +03:00
|
|
|
u64 file_offset)
|
2010-12-05 16:32:55 +03:00
|
|
|
{
|
2011-03-15 21:44:01 +03:00
|
|
|
struct perf_evsel *evsel;
|
2011-11-28 13:56:39 +04:00
|
|
|
struct machine *machine;
|
2011-03-15 21:44:01 +03:00
|
|
|
|
2010-12-07 15:48:55 +03:00
|
|
|
dump_event(session, event, file_offset, sample);
|
|
|
|
|
2011-10-29 18:15:04 +04:00
|
|
|
evsel = perf_evlist__id2evsel(session->evlist, sample->id);
|
|
|
|
if (evsel != NULL && event->header.type != PERF_RECORD_SAMPLE) {
|
|
|
|
/*
|
|
|
|
* XXX We're leaving PERF_RECORD_SAMPLE unnacounted here
|
|
|
|
* because the tools right now may apply filters, discarding
|
|
|
|
* some of the samples. For consistency, in the future we
|
|
|
|
* should have something like nr_filtered_samples and remove
|
|
|
|
* the sample->period from total_sample_period, etc, KISS for
|
|
|
|
* now tho.
|
|
|
|
*
|
|
|
|
* Also testing against NULL allows us to handle files without
|
|
|
|
* attr.sample_id_all and/or without PERF_SAMPLE_ID. In the
|
|
|
|
* future probably it'll be a good idea to restrict event
|
|
|
|
* processing via perf_session to files with both set.
|
|
|
|
*/
|
|
|
|
hists__inc_nr_events(&evsel->hists, event->header.type);
|
|
|
|
}
|
|
|
|
|
2013-08-27 12:23:06 +04:00
|
|
|
machine = perf_session__find_machine_for_cpumode(session, event,
|
|
|
|
sample);
|
2011-11-28 13:56:39 +04:00
|
|
|
|
2010-12-05 16:32:55 +03:00
|
|
|
switch (event->header.type) {
|
|
|
|
case PERF_RECORD_SAMPLE:
|
2012-08-07 17:20:45 +04:00
|
|
|
dump_sample(evsel, event, sample);
|
2011-03-15 21:44:01 +03:00
|
|
|
if (evsel == NULL) {
|
2012-12-18 23:24:46 +04:00
|
|
|
++session->stats.nr_unknown_id;
|
2012-04-12 16:21:01 +04:00
|
|
|
return 0;
|
2011-03-15 21:44:01 +03:00
|
|
|
}
|
2012-02-10 21:05:04 +04:00
|
|
|
if (machine == NULL) {
|
2012-12-18 23:24:46 +04:00
|
|
|
++session->stats.nr_unprocessable_samples;
|
2012-04-12 16:21:01 +04:00
|
|
|
return 0;
|
2012-02-10 21:05:04 +04:00
|
|
|
}
|
2012-10-10 20:52:24 +04:00
|
|
|
return perf_session__deliver_sample(session, tool, event,
|
|
|
|
sample, evsel, machine);
|
2010-12-05 16:32:55 +03:00
|
|
|
case PERF_RECORD_MMAP:
|
2011-11-28 14:30:20 +04:00
|
|
|
return tool->mmap(tool, event, sample, machine);
|
2013-08-21 14:10:25 +04:00
|
|
|
case PERF_RECORD_MMAP2:
|
|
|
|
return tool->mmap2(tool, event, sample, machine);
|
2010-12-05 16:32:55 +03:00
|
|
|
case PERF_RECORD_COMM:
|
2011-11-28 14:30:20 +04:00
|
|
|
return tool->comm(tool, event, sample, machine);
|
2010-12-05 16:32:55 +03:00
|
|
|
case PERF_RECORD_FORK:
|
2011-11-28 14:30:20 +04:00
|
|
|
return tool->fork(tool, event, sample, machine);
|
2010-12-05 16:32:55 +03:00
|
|
|
case PERF_RECORD_EXIT:
|
2011-11-28 14:30:20 +04:00
|
|
|
return tool->exit(tool, event, sample, machine);
|
2010-12-05 16:32:55 +03:00
|
|
|
case PERF_RECORD_LOST:
|
2011-11-28 14:30:20 +04:00
|
|
|
if (tool->lost == perf_event__process_lost)
|
2012-12-18 23:24:46 +04:00
|
|
|
session->stats.total_lost += event->lost.lost;
|
2011-11-28 14:30:20 +04:00
|
|
|
return tool->lost(tool, event, sample, machine);
|
2010-12-05 16:32:55 +03:00
|
|
|
case PERF_RECORD_READ:
|
2011-11-28 14:30:20 +04:00
|
|
|
return tool->read(tool, event, sample, evsel, machine);
|
2010-12-05 16:32:55 +03:00
|
|
|
case PERF_RECORD_THROTTLE:
|
2011-11-28 14:30:20 +04:00
|
|
|
return tool->throttle(tool, event, sample, machine);
|
2010-12-05 16:32:55 +03:00
|
|
|
case PERF_RECORD_UNTHROTTLE:
|
2011-11-28 14:30:20 +04:00
|
|
|
return tool->unthrottle(tool, event, sample, machine);
|
2010-12-05 16:32:55 +03:00
|
|
|
default:
|
2012-12-18 23:24:46 +04:00
|
|
|
++session->stats.nr_unknown_events;
|
2010-12-05 16:32:55 +03:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-29 19:01:45 +03:00
|
|
|
static int perf_session__process_user_event(struct perf_session *session, union perf_event *event,
|
2011-11-28 14:30:20 +04:00
|
|
|
struct perf_tool *tool, u64 file_offset)
|
2009-12-28 02:36:59 +03:00
|
|
|
{
|
2013-10-15 18:27:34 +04:00
|
|
|
int fd = perf_data_file__fd(session->file);
|
2011-11-12 04:45:41 +04:00
|
|
|
int err;
|
|
|
|
|
2010-12-07 15:49:01 +03:00
|
|
|
dump_event(session, event, file_offset, NULL);
|
2009-12-28 02:36:59 +03:00
|
|
|
|
2010-12-05 16:32:55 +03:00
|
|
|
/* These events are processed right away */
|
2009-12-28 02:36:59 +03:00
|
|
|
switch (event->header.type) {
|
2010-04-02 08:59:19 +04:00
|
|
|
case PERF_RECORD_HEADER_ATTR:
|
2013-07-04 17:20:21 +04:00
|
|
|
err = tool->attr(tool, event, &session->evlist);
|
2011-11-12 04:45:41 +04:00
|
|
|
if (err == 0)
|
2012-08-02 02:31:00 +04:00
|
|
|
perf_session__set_id_hdr_size(session);
|
2011-11-12 04:45:41 +04:00
|
|
|
return err;
|
2010-04-02 08:59:21 +04:00
|
|
|
case PERF_RECORD_HEADER_TRACING_DATA:
|
|
|
|
/* setup for reading amidst mmap */
|
2013-10-15 18:27:34 +04:00
|
|
|
lseek(fd, file_offset, SEEK_SET);
|
2013-07-04 17:20:21 +04:00
|
|
|
return tool->tracing_data(tool, event, session);
|
2010-04-02 08:59:22 +04:00
|
|
|
case PERF_RECORD_HEADER_BUILD_ID:
|
2011-11-28 14:30:20 +04:00
|
|
|
return tool->build_id(tool, event, session);
|
2010-05-03 17:14:33 +04:00
|
|
|
case PERF_RECORD_FINISHED_ROUND:
|
2011-11-28 14:30:20 +04:00
|
|
|
return tool->finished_round(tool, event, session);
|
2009-12-28 02:36:59 +03:00
|
|
|
default:
|
2010-12-07 15:49:01 +03:00
|
|
|
return -EINVAL;
|
2009-12-28 02:36:59 +03:00
|
|
|
}
|
2010-12-07 15:49:01 +03:00
|
|
|
}
|
|
|
|
|
2012-05-30 16:23:43 +04:00
|
|
|
static void event_swap(union perf_event *event, bool sample_id_all)
|
|
|
|
{
|
|
|
|
perf_event__swap_op swap;
|
|
|
|
|
|
|
|
swap = perf_event__swap_ops[event->header.type];
|
|
|
|
if (swap)
|
|
|
|
swap(event, sample_id_all);
|
|
|
|
}
|
|
|
|
|
2013-08-06 05:41:33 +04:00
|
|
|
static int perf_session__process_event(struct perf_session *session,
|
|
|
|
union perf_event *event,
|
|
|
|
struct perf_tool *tool,
|
|
|
|
u64 file_offset)
|
2010-12-07 15:49:01 +03:00
|
|
|
{
|
2011-01-29 18:02:00 +03:00
|
|
|
struct perf_sample sample;
|
2010-12-07 15:49:01 +03:00
|
|
|
int ret;
|
|
|
|
|
2012-05-30 16:23:43 +04:00
|
|
|
if (session->header.needs_swap)
|
2012-08-02 02:25:26 +04:00
|
|
|
event_swap(event, perf_evlist__sample_id_all(session->evlist));
|
2010-12-07 15:49:01 +03:00
|
|
|
|
|
|
|
if (event->header.type >= PERF_RECORD_HEADER_MAX)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2012-12-18 23:24:46 +04:00
|
|
|
events_stats__inc(&session->stats, event->header.type);
|
2010-12-07 15:49:01 +03:00
|
|
|
|
|
|
|
if (event->header.type >= PERF_RECORD_USER_TYPE_START)
|
2011-11-28 14:30:20 +04:00
|
|
|
return perf_session__process_user_event(session, event, tool, file_offset);
|
2010-12-05 16:32:55 +03:00
|
|
|
|
2010-12-07 15:48:58 +03:00
|
|
|
/*
|
|
|
|
* For all kernel events we get the sample data
|
|
|
|
*/
|
2012-09-26 19:48:18 +04:00
|
|
|
ret = perf_evlist__parse_sample(session->evlist, event, &sample);
|
2011-05-22 04:17:22 +04:00
|
|
|
if (ret)
|
|
|
|
return ret;
|
2010-12-07 15:48:58 +03:00
|
|
|
|
2011-11-28 14:30:20 +04:00
|
|
|
if (tool->ordered_samples) {
|
2010-12-07 15:48:50 +03:00
|
|
|
ret = perf_session_queue_event(session, event, &sample,
|
|
|
|
file_offset);
|
2010-12-05 16:32:55 +03:00
|
|
|
if (ret != -ETIME)
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-11-28 14:30:20 +04:00
|
|
|
return perf_session_deliver_event(session, event, &sample, tool,
|
2010-12-07 15:48:53 +03:00
|
|
|
file_offset);
|
2009-12-28 02:36:59 +03:00
|
|
|
}
|
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
void perf_event_header__bswap(struct perf_event_header *hdr)
|
perf tools: Cross platform perf.data analysis support
There are still some problems related to loading vmlinux files,
but those are unrelated to the feature implemented in this
patch, so will get fixed in the next patches, but here are some
results:
1. collect perf.data file on a Fedora 12 machine, x86_64, 64-bit
userland
2. transfer it to a Debian Testing machine, PARISC64, 32-bit
userland
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | head -5
74f9930ee94475b6b3238caf3725a50d59cb994b [kernel.kallsyms]
55fdd56670453ea66c011158c4b9d30179c1d049 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/ipt_MASQUERADE.ko
41adff63c730890480980d5d8ba513f1c216a858 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/iptable_nat.ko
90a33def1077bb8e97b8a78546dc96c2de62df46 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/nf_nat.ko
984c7bea90ce1376d5c8e7ef43a781801286e62d /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/tun.ko
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | tail -5
22492f3753c6a67de5c7ccbd6b863390c92c0723 /usr/lib64/libXt.so.6.0.0
353802bb7e1b895ba43507cc678f951e778e4c6f /usr/lib64/libMagickCore.so.2.0.0
d10c2897558595efe7be8b0584cf7e6398bc776c /usr/lib64/libfprint.so.0.0.0
a83ecfb519a788774a84d5ddde633c9ba56c03ab /home/acme/bin/perf
d3ca765a8ecf257d263801d7ad8c49c189082317 /usr/lib64/libdwarf.so.0.0
acme@parisc:~/git/linux-2.6-tip$
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm
The file [kernel.kallsyms] cannot be used, trying to use /proc/kallsyms...
^^^^ The problem related to vmlinux handling, it shouldn't be trying this
^^^^ rather alien /proc/kallsyms at all...
/lib64/libpthread-2.10.2.so with build id 5c68f7afeb33309c78037e374b0deee84dd441f6 not found, continuing without symbols
/lib64/libc-2.10.2.so with build id eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 not found, continuing without symbols
/home/acme/bin/perf with build id a83ecfb519a788774a84d5ddde633c9ba56c03ab not found, continuing without symbols
/usr/sbin/openvpn with build id f2037a091ef36b591187a858d75e203690ea9409 not found, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/e1000e/e1000e.ko, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko, continuing without symbols
<SNIP more complaints about not finding the right build-ids,
those will have to wait for 'perf archive' or plain
copying what was collected by 'perf record' on the x86_64,
source machine, see further below for an example of this >
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get when running the same command for the
same perf.data file on the F12, x86_64, source machine:
[root@doppio linux-2.6-tip]# perf report --sort comm
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
[root@doppio linux-2.6-tip]#
The other modes work as well, modulo the problem with vmlinux:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object
# ........ ............... .................................
#
35.11% find ffffffff81002b5a
18.25% perf ffffffff8102235f
16.17% find libc-2.10.2.so
9.07% find find
5.80% swapper ffffffff8102235f
3.95% perf libc-2.10.2.so
2.33% init ffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k
1.35% find [e1000e]
0.68% sleep libc-2.10.2.so
acme@parisc:~/git/linux-2.6-tip$
And the lack of the right buildids:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso,symbol 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object Symbol
# ........ ............... ................................. ......
#
35.11% find ffffffff81002b5a [k] 0xffffffff81002b5a
18.25% perf ffffffff8102235f [k] 0xffffffff8102235f
16.17% find libc-2.10.2.so [.] 0x00000000045782
9.07% find find [.] 0x0000000000fb0e
5.80% swapper ffffffff8102235f [k] 0xffffffff8102235f
3.95% perf libc-2.10.2.so [.] 0x0000000007f398
2.33% init ffffffff810091b9 [k] 0xffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k [.] 0x00000000105440
1.35% find [e1000e] [k] 0x00000000010948
0.68% sleep libc-2.10.2.so [.] 0x0000000011ad5b
acme@parisc:~/git/linux-2.6-tip$
But if we:
acme@parisc:~/git/linux-2.6-tip$ ls ~/.debug
ls: cannot access /home/acme/.debug: No such file or directory
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/lib64/libc-2.10.2.so/
acme@parisc:~/git/linux-2.6-tip$ scp doppio:.debug/lib64/libc-2.10.2.so/* ~/.debug/lib64/libc-2.10.2.so/
acme@doppio's password:
eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 100% 1783KB 714.7KB/s 00:02
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/.build-id/eb
acme@parisc:~/git/linux-2.6-tip$ ln -s ../../lib64/libc-2.10.2.so/eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 ~/.debug/.build-id/eb/4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1
acme@parisc:~/git/linux-2.6-tip$ perf report --dsos libc-2.10.2.so 2> /dev/null
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get on the source, F12, x86_64 machine:
[root@doppio linux-2.6-tip]# perf report --dsos libc-2.10.2.so
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[root@doppio linux-2.6-tip]#
So I think this is really, really nice in that it demonstrates
the portability of perf.data files and the use of build-ids
accross such aliens worlds :-)
There are some things to fix tho, like the bitmap on the header,
but things are looking good.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1263478990-8200-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-01-14 17:23:10 +03:00
|
|
|
{
|
2013-11-05 22:32:36 +04:00
|
|
|
hdr->type = bswap_32(hdr->type);
|
|
|
|
hdr->misc = bswap_16(hdr->misc);
|
|
|
|
hdr->size = bswap_16(hdr->size);
|
perf tools: Cross platform perf.data analysis support
There are still some problems related to loading vmlinux files,
but those are unrelated to the feature implemented in this
patch, so will get fixed in the next patches, but here are some
results:
1. collect perf.data file on a Fedora 12 machine, x86_64, 64-bit
userland
2. transfer it to a Debian Testing machine, PARISC64, 32-bit
userland
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | head -5
74f9930ee94475b6b3238caf3725a50d59cb994b [kernel.kallsyms]
55fdd56670453ea66c011158c4b9d30179c1d049 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/ipt_MASQUERADE.ko
41adff63c730890480980d5d8ba513f1c216a858 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/iptable_nat.ko
90a33def1077bb8e97b8a78546dc96c2de62df46 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/nf_nat.ko
984c7bea90ce1376d5c8e7ef43a781801286e62d /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/tun.ko
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | tail -5
22492f3753c6a67de5c7ccbd6b863390c92c0723 /usr/lib64/libXt.so.6.0.0
353802bb7e1b895ba43507cc678f951e778e4c6f /usr/lib64/libMagickCore.so.2.0.0
d10c2897558595efe7be8b0584cf7e6398bc776c /usr/lib64/libfprint.so.0.0.0
a83ecfb519a788774a84d5ddde633c9ba56c03ab /home/acme/bin/perf
d3ca765a8ecf257d263801d7ad8c49c189082317 /usr/lib64/libdwarf.so.0.0
acme@parisc:~/git/linux-2.6-tip$
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm
The file [kernel.kallsyms] cannot be used, trying to use /proc/kallsyms...
^^^^ The problem related to vmlinux handling, it shouldn't be trying this
^^^^ rather alien /proc/kallsyms at all...
/lib64/libpthread-2.10.2.so with build id 5c68f7afeb33309c78037e374b0deee84dd441f6 not found, continuing without symbols
/lib64/libc-2.10.2.so with build id eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 not found, continuing without symbols
/home/acme/bin/perf with build id a83ecfb519a788774a84d5ddde633c9ba56c03ab not found, continuing without symbols
/usr/sbin/openvpn with build id f2037a091ef36b591187a858d75e203690ea9409 not found, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/e1000e/e1000e.ko, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko, continuing without symbols
<SNIP more complaints about not finding the right build-ids,
those will have to wait for 'perf archive' or plain
copying what was collected by 'perf record' on the x86_64,
source machine, see further below for an example of this >
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get when running the same command for the
same perf.data file on the F12, x86_64, source machine:
[root@doppio linux-2.6-tip]# perf report --sort comm
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
[root@doppio linux-2.6-tip]#
The other modes work as well, modulo the problem with vmlinux:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object
# ........ ............... .................................
#
35.11% find ffffffff81002b5a
18.25% perf ffffffff8102235f
16.17% find libc-2.10.2.so
9.07% find find
5.80% swapper ffffffff8102235f
3.95% perf libc-2.10.2.so
2.33% init ffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k
1.35% find [e1000e]
0.68% sleep libc-2.10.2.so
acme@parisc:~/git/linux-2.6-tip$
And the lack of the right buildids:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso,symbol 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object Symbol
# ........ ............... ................................. ......
#
35.11% find ffffffff81002b5a [k] 0xffffffff81002b5a
18.25% perf ffffffff8102235f [k] 0xffffffff8102235f
16.17% find libc-2.10.2.so [.] 0x00000000045782
9.07% find find [.] 0x0000000000fb0e
5.80% swapper ffffffff8102235f [k] 0xffffffff8102235f
3.95% perf libc-2.10.2.so [.] 0x0000000007f398
2.33% init ffffffff810091b9 [k] 0xffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k [.] 0x00000000105440
1.35% find [e1000e] [k] 0x00000000010948
0.68% sleep libc-2.10.2.so [.] 0x0000000011ad5b
acme@parisc:~/git/linux-2.6-tip$
But if we:
acme@parisc:~/git/linux-2.6-tip$ ls ~/.debug
ls: cannot access /home/acme/.debug: No such file or directory
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/lib64/libc-2.10.2.so/
acme@parisc:~/git/linux-2.6-tip$ scp doppio:.debug/lib64/libc-2.10.2.so/* ~/.debug/lib64/libc-2.10.2.so/
acme@doppio's password:
eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 100% 1783KB 714.7KB/s 00:02
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/.build-id/eb
acme@parisc:~/git/linux-2.6-tip$ ln -s ../../lib64/libc-2.10.2.so/eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 ~/.debug/.build-id/eb/4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1
acme@parisc:~/git/linux-2.6-tip$ perf report --dsos libc-2.10.2.so 2> /dev/null
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get on the source, F12, x86_64 machine:
[root@doppio linux-2.6-tip]# perf report --dsos libc-2.10.2.so
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[root@doppio linux-2.6-tip]#
So I think this is really, really nice in that it demonstrates
the portability of perf.data files and the use of build-ids
accross such aliens worlds :-)
There are some things to fix tho, like the bitmap on the header,
but things are looking good.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1263478990-8200-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-01-14 17:23:10 +03:00
|
|
|
}
|
|
|
|
|
2011-11-09 19:24:25 +04:00
|
|
|
struct thread *perf_session__findnew(struct perf_session *session, pid_t pid)
|
|
|
|
{
|
2013-08-27 12:23:03 +04:00
|
|
|
return machine__findnew_thread(&session->machines.host, 0, pid);
|
2011-11-09 19:24:25 +04:00
|
|
|
}
|
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
static struct thread *perf_session__register_idle_thread(struct perf_session *session)
|
2009-12-28 02:36:59 +03:00
|
|
|
{
|
2013-11-05 22:32:36 +04:00
|
|
|
struct thread *thread = perf_session__findnew(session, 0);
|
2009-12-28 02:36:59 +03:00
|
|
|
|
2013-09-11 18:18:24 +04:00
|
|
|
if (thread == NULL || thread__set_comm(thread, "swapper", 0)) {
|
2009-12-28 02:36:59 +03:00
|
|
|
pr_err("problem inserting idle task.\n");
|
|
|
|
thread = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return thread;
|
|
|
|
}
|
|
|
|
|
2011-01-04 21:25:15 +03:00
|
|
|
static void perf_session__warn_about_errors(const struct perf_session *session,
|
2011-11-28 14:30:20 +04:00
|
|
|
const struct perf_tool *tool)
|
2011-01-04 21:25:15 +03:00
|
|
|
{
|
2011-11-28 14:30:20 +04:00
|
|
|
if (tool->lost == perf_event__process_lost &&
|
2012-12-18 23:24:46 +04:00
|
|
|
session->stats.nr_events[PERF_RECORD_LOST] != 0) {
|
2011-10-29 18:15:04 +04:00
|
|
|
ui__warning("Processed %d events and lost %d chunks!\n\n"
|
|
|
|
"Check IO/CPU overload!\n\n",
|
2012-12-18 23:24:46 +04:00
|
|
|
session->stats.nr_events[0],
|
|
|
|
session->stats.nr_events[PERF_RECORD_LOST]);
|
2011-01-04 21:25:15 +03:00
|
|
|
}
|
|
|
|
|
2012-12-18 23:24:46 +04:00
|
|
|
if (session->stats.nr_unknown_events != 0) {
|
2011-01-04 21:25:15 +03:00
|
|
|
ui__warning("Found %u unknown events!\n\n"
|
|
|
|
"Is this an older tool processing a perf.data "
|
|
|
|
"file generated by a more recent tool?\n\n"
|
|
|
|
"If that is not the case, consider "
|
|
|
|
"reporting to linux-kernel@vger.kernel.org.\n\n",
|
2012-12-18 23:24:46 +04:00
|
|
|
session->stats.nr_unknown_events);
|
2011-01-04 21:25:15 +03:00
|
|
|
}
|
|
|
|
|
2012-12-18 23:24:46 +04:00
|
|
|
if (session->stats.nr_unknown_id != 0) {
|
2011-03-15 21:44:01 +03:00
|
|
|
ui__warning("%u samples with id not present in the header\n",
|
2012-12-18 23:24:46 +04:00
|
|
|
session->stats.nr_unknown_id);
|
2011-03-15 21:44:01 +03:00
|
|
|
}
|
|
|
|
|
2012-12-18 23:24:46 +04:00
|
|
|
if (session->stats.nr_invalid_chains != 0) {
|
2011-01-04 21:25:15 +03:00
|
|
|
ui__warning("Found invalid callchains!\n\n"
|
|
|
|
"%u out of %u events were discarded for this reason.\n\n"
|
|
|
|
"Consider reporting to linux-kernel@vger.kernel.org.\n\n",
|
2012-12-18 23:24:46 +04:00
|
|
|
session->stats.nr_invalid_chains,
|
|
|
|
session->stats.nr_events[PERF_RECORD_SAMPLE]);
|
2011-01-04 21:25:15 +03:00
|
|
|
}
|
2012-02-10 21:05:04 +04:00
|
|
|
|
2012-12-18 23:24:46 +04:00
|
|
|
if (session->stats.nr_unprocessable_samples != 0) {
|
2012-02-10 21:05:04 +04:00
|
|
|
ui__warning("%u unprocessable samples recorded.\n"
|
|
|
|
"Do you have a KVM guest running and not using 'perf kvm'?\n",
|
2012-12-18 23:24:46 +04:00
|
|
|
session->stats.nr_unprocessable_samples);
|
2012-02-10 21:05:04 +04:00
|
|
|
}
|
2011-01-04 21:25:15 +03:00
|
|
|
}
|
|
|
|
|
2010-04-02 08:59:15 +04:00
|
|
|
volatile int session_done;
|
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
static int __perf_session__process_pipe_events(struct perf_session *session,
|
2011-11-28 14:30:20 +04:00
|
|
|
struct perf_tool *tool)
|
2010-04-02 08:59:15 +04:00
|
|
|
{
|
2013-11-05 22:32:36 +04:00
|
|
|
int fd = perf_data_file__fd(session->file);
|
perf tools: Fix piped mode read code
In __perf_session__process_pipe_events(), there was a risk we would read
more than what a union perf_event struct can hold. this could happen in
case, perf is reading a file which contains new record types it does not
know about and which are larger than anything it knows about.
In general, perf is supposed to skip records it does not understand, but
in pipe mode, those have to be read and ignored. The fixed size header
contains the size of the record, but that size may be larger than union
perf_event, yet it was used as the backing to the read in:
union perf_event event;
void *p;
size = event->header.size;
p = &event;
p += sizeof(struct perf_event_header);
if (size - sizeof(struct perf_event_header)) {
err = readn(self->fd, p, size - sizeof(struct perf_event_header));
We fix this by allocating a buffer based on the size reported in the
header. We reuse the buffer as much as we can. We realloc in case it
becomes too small. In the common case, the performance impact is
negligible.
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/1337081295-10303-3-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-05-15 15:28:12 +04:00
|
|
|
union perf_event *event;
|
|
|
|
uint32_t size, cur_size = 0;
|
|
|
|
void *buf = NULL;
|
2010-04-02 08:59:15 +04:00
|
|
|
int skip = 0;
|
|
|
|
u64 head;
|
2013-11-28 14:30:14 +04:00
|
|
|
ssize_t err;
|
2010-04-02 08:59:15 +04:00
|
|
|
void *p;
|
|
|
|
|
2011-11-28 14:30:20 +04:00
|
|
|
perf_tool__fill_defaults(tool);
|
2010-04-02 08:59:15 +04:00
|
|
|
|
|
|
|
head = 0;
|
perf tools: Fix piped mode read code
In __perf_session__process_pipe_events(), there was a risk we would read
more than what a union perf_event struct can hold. this could happen in
case, perf is reading a file which contains new record types it does not
know about and which are larger than anything it knows about.
In general, perf is supposed to skip records it does not understand, but
in pipe mode, those have to be read and ignored. The fixed size header
contains the size of the record, but that size may be larger than union
perf_event, yet it was used as the backing to the read in:
union perf_event event;
void *p;
size = event->header.size;
p = &event;
p += sizeof(struct perf_event_header);
if (size - sizeof(struct perf_event_header)) {
err = readn(self->fd, p, size - sizeof(struct perf_event_header));
We fix this by allocating a buffer based on the size reported in the
header. We reuse the buffer as much as we can. We realloc in case it
becomes too small. In the common case, the performance impact is
negligible.
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/1337081295-10303-3-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-05-15 15:28:12 +04:00
|
|
|
cur_size = sizeof(union perf_event);
|
|
|
|
|
|
|
|
buf = malloc(cur_size);
|
|
|
|
if (!buf)
|
|
|
|
return -errno;
|
2010-04-02 08:59:15 +04:00
|
|
|
more:
|
perf tools: Fix piped mode read code
In __perf_session__process_pipe_events(), there was a risk we would read
more than what a union perf_event struct can hold. this could happen in
case, perf is reading a file which contains new record types it does not
know about and which are larger than anything it knows about.
In general, perf is supposed to skip records it does not understand, but
in pipe mode, those have to be read and ignored. The fixed size header
contains the size of the record, but that size may be larger than union
perf_event, yet it was used as the backing to the read in:
union perf_event event;
void *p;
size = event->header.size;
p = &event;
p += sizeof(struct perf_event_header);
if (size - sizeof(struct perf_event_header)) {
err = readn(self->fd, p, size - sizeof(struct perf_event_header));
We fix this by allocating a buffer based on the size reported in the
header. We reuse the buffer as much as we can. We realloc in case it
becomes too small. In the common case, the performance impact is
negligible.
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/1337081295-10303-3-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-05-15 15:28:12 +04:00
|
|
|
event = buf;
|
2013-10-15 18:27:34 +04:00
|
|
|
err = readn(fd, event, sizeof(struct perf_event_header));
|
2010-04-02 08:59:15 +04:00
|
|
|
if (err <= 0) {
|
|
|
|
if (err == 0)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
pr_err("failed to read event header\n");
|
|
|
|
goto out_err;
|
|
|
|
}
|
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
if (session->header.needs_swap)
|
perf tools: Fix piped mode read code
In __perf_session__process_pipe_events(), there was a risk we would read
more than what a union perf_event struct can hold. this could happen in
case, perf is reading a file which contains new record types it does not
know about and which are larger than anything it knows about.
In general, perf is supposed to skip records it does not understand, but
in pipe mode, those have to be read and ignored. The fixed size header
contains the size of the record, but that size may be larger than union
perf_event, yet it was used as the backing to the read in:
union perf_event event;
void *p;
size = event->header.size;
p = &event;
p += sizeof(struct perf_event_header);
if (size - sizeof(struct perf_event_header)) {
err = readn(self->fd, p, size - sizeof(struct perf_event_header));
We fix this by allocating a buffer based on the size reported in the
header. We reuse the buffer as much as we can. We realloc in case it
becomes too small. In the common case, the performance impact is
negligible.
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/1337081295-10303-3-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-05-15 15:28:12 +04:00
|
|
|
perf_event_header__bswap(&event->header);
|
2010-04-02 08:59:15 +04:00
|
|
|
|
perf tools: Fix piped mode read code
In __perf_session__process_pipe_events(), there was a risk we would read
more than what a union perf_event struct can hold. this could happen in
case, perf is reading a file which contains new record types it does not
know about and which are larger than anything it knows about.
In general, perf is supposed to skip records it does not understand, but
in pipe mode, those have to be read and ignored. The fixed size header
contains the size of the record, but that size may be larger than union
perf_event, yet it was used as the backing to the read in:
union perf_event event;
void *p;
size = event->header.size;
p = &event;
p += sizeof(struct perf_event_header);
if (size - sizeof(struct perf_event_header)) {
err = readn(self->fd, p, size - sizeof(struct perf_event_header));
We fix this by allocating a buffer based on the size reported in the
header. We reuse the buffer as much as we can. We realloc in case it
becomes too small. In the common case, the performance impact is
negligible.
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/1337081295-10303-3-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-05-15 15:28:12 +04:00
|
|
|
size = event->header.size;
|
2013-07-04 17:20:27 +04:00
|
|
|
if (size < sizeof(struct perf_event_header)) {
|
|
|
|
pr_err("bad event header size\n");
|
|
|
|
goto out_err;
|
|
|
|
}
|
2010-04-02 08:59:15 +04:00
|
|
|
|
perf tools: Fix piped mode read code
In __perf_session__process_pipe_events(), there was a risk we would read
more than what a union perf_event struct can hold. this could happen in
case, perf is reading a file which contains new record types it does not
know about and which are larger than anything it knows about.
In general, perf is supposed to skip records it does not understand, but
in pipe mode, those have to be read and ignored. The fixed size header
contains the size of the record, but that size may be larger than union
perf_event, yet it was used as the backing to the read in:
union perf_event event;
void *p;
size = event->header.size;
p = &event;
p += sizeof(struct perf_event_header);
if (size - sizeof(struct perf_event_header)) {
err = readn(self->fd, p, size - sizeof(struct perf_event_header));
We fix this by allocating a buffer based on the size reported in the
header. We reuse the buffer as much as we can. We realloc in case it
becomes too small. In the common case, the performance impact is
negligible.
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/1337081295-10303-3-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-05-15 15:28:12 +04:00
|
|
|
if (size > cur_size) {
|
|
|
|
void *new = realloc(buf, size);
|
|
|
|
if (!new) {
|
|
|
|
pr_err("failed to allocate memory to read event\n");
|
|
|
|
goto out_err;
|
|
|
|
}
|
|
|
|
buf = new;
|
|
|
|
cur_size = size;
|
|
|
|
event = buf;
|
|
|
|
}
|
|
|
|
p = event;
|
2010-04-02 08:59:15 +04:00
|
|
|
p += sizeof(struct perf_event_header);
|
|
|
|
|
2010-05-05 09:27:40 +04:00
|
|
|
if (size - sizeof(struct perf_event_header)) {
|
2013-10-15 18:27:34 +04:00
|
|
|
err = readn(fd, p, size - sizeof(struct perf_event_header));
|
2010-05-05 09:27:40 +04:00
|
|
|
if (err <= 0) {
|
|
|
|
if (err == 0) {
|
|
|
|
pr_err("unexpected end of event stream\n");
|
|
|
|
goto done;
|
|
|
|
}
|
2010-04-02 08:59:15 +04:00
|
|
|
|
2010-05-05 09:27:40 +04:00
|
|
|
pr_err("failed to read event data\n");
|
|
|
|
goto out_err;
|
|
|
|
}
|
2010-04-02 08:59:15 +04:00
|
|
|
}
|
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
if ((skip = perf_session__process_event(session, event, tool, head)) < 0) {
|
2012-04-16 22:42:51 +04:00
|
|
|
pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n",
|
perf tools: Fix piped mode read code
In __perf_session__process_pipe_events(), there was a risk we would read
more than what a union perf_event struct can hold. this could happen in
case, perf is reading a file which contains new record types it does not
know about and which are larger than anything it knows about.
In general, perf is supposed to skip records it does not understand, but
in pipe mode, those have to be read and ignored. The fixed size header
contains the size of the record, but that size may be larger than union
perf_event, yet it was used as the backing to the read in:
union perf_event event;
void *p;
size = event->header.size;
p = &event;
p += sizeof(struct perf_event_header);
if (size - sizeof(struct perf_event_header)) {
err = readn(self->fd, p, size - sizeof(struct perf_event_header));
We fix this by allocating a buffer based on the size reported in the
header. We reuse the buffer as much as we can. We realloc in case it
becomes too small. In the common case, the performance impact is
negligible.
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/1337081295-10303-3-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-05-15 15:28:12 +04:00
|
|
|
head, event->header.size, event->header.type);
|
2012-04-16 22:42:51 +04:00
|
|
|
err = -EINVAL;
|
|
|
|
goto out_err;
|
2010-04-02 08:59:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
head += size;
|
|
|
|
|
|
|
|
if (skip > 0)
|
|
|
|
head += skip;
|
|
|
|
|
|
|
|
if (!session_done())
|
|
|
|
goto more;
|
|
|
|
done:
|
2013-10-18 16:29:02 +04:00
|
|
|
/* do the final flush for ordered samples */
|
2013-11-05 22:32:36 +04:00
|
|
|
session->ordered_samples.next_flush = ULLONG_MAX;
|
|
|
|
err = flush_sample_queue(session, tool);
|
2010-04-02 08:59:15 +04:00
|
|
|
out_err:
|
perf tools: Fix piped mode read code
In __perf_session__process_pipe_events(), there was a risk we would read
more than what a union perf_event struct can hold. this could happen in
case, perf is reading a file which contains new record types it does not
know about and which are larger than anything it knows about.
In general, perf is supposed to skip records it does not understand, but
in pipe mode, those have to be read and ignored. The fixed size header
contains the size of the record, but that size may be larger than union
perf_event, yet it was used as the backing to the read in:
union perf_event event;
void *p;
size = event->header.size;
p = &event;
p += sizeof(struct perf_event_header);
if (size - sizeof(struct perf_event_header)) {
err = readn(self->fd, p, size - sizeof(struct perf_event_header));
We fix this by allocating a buffer based on the size reported in the
header. We reuse the buffer as much as we can. We realloc in case it
becomes too small. In the common case, the performance impact is
negligible.
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/1337081295-10303-3-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-05-15 15:28:12 +04:00
|
|
|
free(buf);
|
2013-11-05 22:32:36 +04:00
|
|
|
perf_session__warn_about_errors(session, tool);
|
|
|
|
perf_session_free_sample_buffers(session);
|
2010-04-02 08:59:15 +04:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2011-05-23 15:06:28 +04:00
|
|
|
static union perf_event *
|
|
|
|
fetch_mmaped_event(struct perf_session *session,
|
|
|
|
u64 head, size_t mmap_size, char *buf)
|
|
|
|
{
|
|
|
|
union perf_event *event;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Ensure we have enough space remaining to read
|
|
|
|
* the size of the event in the headers.
|
|
|
|
*/
|
|
|
|
if (head + sizeof(event->header) > mmap_size)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
event = (union perf_event *)(buf + head);
|
|
|
|
|
|
|
|
if (session->header.needs_swap)
|
|
|
|
perf_event_header__bswap(&event->header);
|
|
|
|
|
2013-07-04 17:20:27 +04:00
|
|
|
if (head + event->header.size > mmap_size) {
|
|
|
|
/* We're not fetching the event so swap back again */
|
|
|
|
if (session->header.needs_swap)
|
|
|
|
perf_event_header__bswap(&event->header);
|
2011-05-23 15:06:28 +04:00
|
|
|
return NULL;
|
2013-07-04 17:20:27 +04:00
|
|
|
}
|
2011-05-23 15:06:28 +04:00
|
|
|
|
|
|
|
return event;
|
|
|
|
}
|
|
|
|
|
2012-11-10 23:12:19 +04:00
|
|
|
/*
|
|
|
|
* On 64bit we can mmap the data file in one go. No need for tiny mmap
|
|
|
|
* slices. On 32bit we use 32MB.
|
|
|
|
*/
|
|
|
|
#if BITS_PER_LONG == 64
|
|
|
|
#define MMAP_SIZE ULLONG_MAX
|
|
|
|
#define NUM_MMAPS 1
|
|
|
|
#else
|
|
|
|
#define MMAP_SIZE (32 * 1024 * 1024ULL)
|
|
|
|
#define NUM_MMAPS 128
|
|
|
|
#endif
|
|
|
|
|
2010-11-30 20:49:38 +03:00
|
|
|
int __perf_session__process_events(struct perf_session *session,
|
2010-02-03 21:52:05 +03:00
|
|
|
u64 data_offset, u64 data_size,
|
2011-11-28 14:30:20 +04:00
|
|
|
u64 file_size, struct perf_tool *tool)
|
2009-12-28 02:36:59 +03:00
|
|
|
{
|
2013-10-15 18:27:34 +04:00
|
|
|
int fd = perf_data_file__fd(session->file);
|
2013-10-23 22:40:38 +04:00
|
|
|
u64 head, page_offset, file_offset, file_pos;
|
2010-11-30 20:49:49 +03:00
|
|
|
int err, mmap_prot, mmap_flags, map_idx = 0;
|
2012-10-06 21:57:10 +04:00
|
|
|
size_t mmap_size;
|
2012-11-10 23:12:19 +04:00
|
|
|
char *buf, *mmaps[NUM_MMAPS];
|
2011-01-29 19:01:45 +03:00
|
|
|
union perf_event *event;
|
2009-12-28 02:36:59 +03:00
|
|
|
uint32_t size;
|
2013-10-23 22:40:38 +04:00
|
|
|
struct ui_progress prog;
|
2010-11-30 20:49:38 +03:00
|
|
|
|
2011-11-28 14:30:20 +04:00
|
|
|
perf_tool__fill_defaults(tool);
|
2009-12-28 02:36:59 +03:00
|
|
|
|
2010-11-30 20:49:38 +03:00
|
|
|
page_offset = page_size * (data_offset / page_size);
|
|
|
|
file_offset = page_offset;
|
|
|
|
head = data_offset - page_offset;
|
2009-12-28 02:36:59 +03:00
|
|
|
|
2013-09-30 12:19:48 +04:00
|
|
|
if (data_size && (data_offset + data_size < file_size))
|
2010-11-30 20:49:44 +03:00
|
|
|
file_size = data_offset + data_size;
|
|
|
|
|
2013-10-23 22:40:38 +04:00
|
|
|
ui_progress__init(&prog, file_size, "Processing events...");
|
2010-11-30 20:49:46 +03:00
|
|
|
|
2012-11-10 23:12:19 +04:00
|
|
|
mmap_size = MMAP_SIZE;
|
2010-11-30 20:49:46 +03:00
|
|
|
if (mmap_size > file_size)
|
|
|
|
mmap_size = file_size;
|
|
|
|
|
2010-11-30 20:49:49 +03:00
|
|
|
memset(mmaps, 0, sizeof(mmaps));
|
|
|
|
|
perf tools: Cross platform perf.data analysis support
There are still some problems related to loading vmlinux files,
but those are unrelated to the feature implemented in this
patch, so will get fixed in the next patches, but here are some
results:
1. collect perf.data file on a Fedora 12 machine, x86_64, 64-bit
userland
2. transfer it to a Debian Testing machine, PARISC64, 32-bit
userland
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | head -5
74f9930ee94475b6b3238caf3725a50d59cb994b [kernel.kallsyms]
55fdd56670453ea66c011158c4b9d30179c1d049 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/ipt_MASQUERADE.ko
41adff63c730890480980d5d8ba513f1c216a858 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/iptable_nat.ko
90a33def1077bb8e97b8a78546dc96c2de62df46 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/nf_nat.ko
984c7bea90ce1376d5c8e7ef43a781801286e62d /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/tun.ko
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | tail -5
22492f3753c6a67de5c7ccbd6b863390c92c0723 /usr/lib64/libXt.so.6.0.0
353802bb7e1b895ba43507cc678f951e778e4c6f /usr/lib64/libMagickCore.so.2.0.0
d10c2897558595efe7be8b0584cf7e6398bc776c /usr/lib64/libfprint.so.0.0.0
a83ecfb519a788774a84d5ddde633c9ba56c03ab /home/acme/bin/perf
d3ca765a8ecf257d263801d7ad8c49c189082317 /usr/lib64/libdwarf.so.0.0
acme@parisc:~/git/linux-2.6-tip$
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm
The file [kernel.kallsyms] cannot be used, trying to use /proc/kallsyms...
^^^^ The problem related to vmlinux handling, it shouldn't be trying this
^^^^ rather alien /proc/kallsyms at all...
/lib64/libpthread-2.10.2.so with build id 5c68f7afeb33309c78037e374b0deee84dd441f6 not found, continuing without symbols
/lib64/libc-2.10.2.so with build id eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 not found, continuing without symbols
/home/acme/bin/perf with build id a83ecfb519a788774a84d5ddde633c9ba56c03ab not found, continuing without symbols
/usr/sbin/openvpn with build id f2037a091ef36b591187a858d75e203690ea9409 not found, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/e1000e/e1000e.ko, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko, continuing without symbols
<SNIP more complaints about not finding the right build-ids,
those will have to wait for 'perf archive' or plain
copying what was collected by 'perf record' on the x86_64,
source machine, see further below for an example of this >
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get when running the same command for the
same perf.data file on the F12, x86_64, source machine:
[root@doppio linux-2.6-tip]# perf report --sort comm
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
[root@doppio linux-2.6-tip]#
The other modes work as well, modulo the problem with vmlinux:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object
# ........ ............... .................................
#
35.11% find ffffffff81002b5a
18.25% perf ffffffff8102235f
16.17% find libc-2.10.2.so
9.07% find find
5.80% swapper ffffffff8102235f
3.95% perf libc-2.10.2.so
2.33% init ffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k
1.35% find [e1000e]
0.68% sleep libc-2.10.2.so
acme@parisc:~/git/linux-2.6-tip$
And the lack of the right buildids:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso,symbol 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object Symbol
# ........ ............... ................................. ......
#
35.11% find ffffffff81002b5a [k] 0xffffffff81002b5a
18.25% perf ffffffff8102235f [k] 0xffffffff8102235f
16.17% find libc-2.10.2.so [.] 0x00000000045782
9.07% find find [.] 0x0000000000fb0e
5.80% swapper ffffffff8102235f [k] 0xffffffff8102235f
3.95% perf libc-2.10.2.so [.] 0x0000000007f398
2.33% init ffffffff810091b9 [k] 0xffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k [.] 0x00000000105440
1.35% find [e1000e] [k] 0x00000000010948
0.68% sleep libc-2.10.2.so [.] 0x0000000011ad5b
acme@parisc:~/git/linux-2.6-tip$
But if we:
acme@parisc:~/git/linux-2.6-tip$ ls ~/.debug
ls: cannot access /home/acme/.debug: No such file or directory
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/lib64/libc-2.10.2.so/
acme@parisc:~/git/linux-2.6-tip$ scp doppio:.debug/lib64/libc-2.10.2.so/* ~/.debug/lib64/libc-2.10.2.so/
acme@doppio's password:
eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 100% 1783KB 714.7KB/s 00:02
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/.build-id/eb
acme@parisc:~/git/linux-2.6-tip$ ln -s ../../lib64/libc-2.10.2.so/eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 ~/.debug/.build-id/eb/4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1
acme@parisc:~/git/linux-2.6-tip$ perf report --dsos libc-2.10.2.so 2> /dev/null
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get on the source, F12, x86_64 machine:
[root@doppio linux-2.6-tip]# perf report --dsos libc-2.10.2.so
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[root@doppio linux-2.6-tip]#
So I think this is really, really nice in that it demonstrates
the portability of perf.data files and the use of build-ids
accross such aliens worlds :-)
There are some things to fix tho, like the bitmap on the header,
but things are looking good.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1263478990-8200-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-01-14 17:23:10 +03:00
|
|
|
mmap_prot = PROT_READ;
|
|
|
|
mmap_flags = MAP_SHARED;
|
|
|
|
|
2010-11-30 20:49:38 +03:00
|
|
|
if (session->header.needs_swap) {
|
perf tools: Cross platform perf.data analysis support
There are still some problems related to loading vmlinux files,
but those are unrelated to the feature implemented in this
patch, so will get fixed in the next patches, but here are some
results:
1. collect perf.data file on a Fedora 12 machine, x86_64, 64-bit
userland
2. transfer it to a Debian Testing machine, PARISC64, 32-bit
userland
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | head -5
74f9930ee94475b6b3238caf3725a50d59cb994b [kernel.kallsyms]
55fdd56670453ea66c011158c4b9d30179c1d049 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/ipt_MASQUERADE.ko
41adff63c730890480980d5d8ba513f1c216a858 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/iptable_nat.ko
90a33def1077bb8e97b8a78546dc96c2de62df46 /lib/modules/2.6.33-rc4-tip+/kernel/net/ipv4/netfilter/nf_nat.ko
984c7bea90ce1376d5c8e7ef43a781801286e62d /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/tun.ko
acme@parisc:~/git/linux-2.6-tip$ perf buildid-list | tail -5
22492f3753c6a67de5c7ccbd6b863390c92c0723 /usr/lib64/libXt.so.6.0.0
353802bb7e1b895ba43507cc678f951e778e4c6f /usr/lib64/libMagickCore.so.2.0.0
d10c2897558595efe7be8b0584cf7e6398bc776c /usr/lib64/libfprint.so.0.0.0
a83ecfb519a788774a84d5ddde633c9ba56c03ab /home/acme/bin/perf
d3ca765a8ecf257d263801d7ad8c49c189082317 /usr/lib64/libdwarf.so.0.0
acme@parisc:~/git/linux-2.6-tip$
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm
The file [kernel.kallsyms] cannot be used, trying to use /proc/kallsyms...
^^^^ The problem related to vmlinux handling, it shouldn't be trying this
^^^^ rather alien /proc/kallsyms at all...
/lib64/libpthread-2.10.2.so with build id 5c68f7afeb33309c78037e374b0deee84dd441f6 not found, continuing without symbols
/lib64/libc-2.10.2.so with build id eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 not found, continuing without symbols
/home/acme/bin/perf with build id a83ecfb519a788774a84d5ddde633c9ba56c03ab not found, continuing without symbols
/usr/sbin/openvpn with build id f2037a091ef36b591187a858d75e203690ea9409 not found, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/e1000e/e1000e.ko, continuing without symbols
Failed to open /lib/modules/2.6.33-rc4-tip+/kernel/drivers/net/wireless/iwlwifi/iwlcore.ko, continuing without symbols
<SNIP more complaints about not finding the right build-ids,
those will have to wait for 'perf archive' or plain
copying what was collected by 'perf record' on the x86_64,
source machine, see further below for an example of this >
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get when running the same command for the
same perf.data file on the F12, x86_64, source machine:
[root@doppio linux-2.6-tip]# perf report --sort comm
# Samples: 293085637
#
# Overhead Command
# ........ ...............
#
61.70% find
23.50% perf
5.86% swapper
3.12% sshd
2.39% init
0.87% bash
0.86% sleep
0.59% dbus-daemon
0.25% hald
0.24% NetworkManager
0.19% hald-addon-rfki
0.15% openvpn
0.07% phy0
0.07% events/0
0.05% iwl3945
0.05% events/1
0.03% kondemand/0
[root@doppio linux-2.6-tip]#
The other modes work as well, modulo the problem with vmlinux:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object
# ........ ............... .................................
#
35.11% find ffffffff81002b5a
18.25% perf ffffffff8102235f
16.17% find libc-2.10.2.so
9.07% find find
5.80% swapper ffffffff8102235f
3.95% perf libc-2.10.2.so
2.33% init ffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k
1.35% find [e1000e]
0.68% sleep libc-2.10.2.so
acme@parisc:~/git/linux-2.6-tip$
And the lack of the right buildids:
acme@parisc:~/git/linux-2.6-tip$ perf report --sort comm,dso,symbol 2> /dev/null | head -15
# Samples: 293085637
#
# Overhead Command Shared Object Symbol
# ........ ............... ................................. ......
#
35.11% find ffffffff81002b5a [k] 0xffffffff81002b5a
18.25% perf ffffffff8102235f [k] 0xffffffff8102235f
16.17% find libc-2.10.2.so [.] 0x00000000045782
9.07% find find [.] 0x0000000000fb0e
5.80% swapper ffffffff8102235f [k] 0xffffffff8102235f
3.95% perf libc-2.10.2.so [.] 0x0000000007f398
2.33% init ffffffff810091b9 [k] 0xffffffff810091b9
1.65% sshd libcrypto.so.0.9.8k [.] 0x00000000105440
1.35% find [e1000e] [k] 0x00000000010948
0.68% sleep libc-2.10.2.so [.] 0x0000000011ad5b
acme@parisc:~/git/linux-2.6-tip$
But if we:
acme@parisc:~/git/linux-2.6-tip$ ls ~/.debug
ls: cannot access /home/acme/.debug: No such file or directory
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/lib64/libc-2.10.2.so/
acme@parisc:~/git/linux-2.6-tip$ scp doppio:.debug/lib64/libc-2.10.2.so/* ~/.debug/lib64/libc-2.10.2.so/
acme@doppio's password:
eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 100% 1783KB 714.7KB/s 00:02
acme@parisc:~/git/linux-2.6-tip$ mkdir -p ~/.debug/.build-id/eb
acme@parisc:~/git/linux-2.6-tip$ ln -s ../../lib64/libc-2.10.2.so/eb4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1 ~/.debug/.build-id/eb/4ec8fa8b2a5eb18cad173c92f27ed8887ed1c1
acme@parisc:~/git/linux-2.6-tip$ perf report --dsos libc-2.10.2.so 2> /dev/null
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
acme@parisc:~/git/linux-2.6-tip$
Which matches what we get on the source, F12, x86_64 machine:
[root@doppio linux-2.6-tip]# perf report --dsos libc-2.10.2.so
# dso: libc-2.10.2.so
# Samples: 64281170
#
# Overhead Command Symbol
# ........ ............... ......
#
14.98% perf [.] __GI_strcmp
12.30% find [.] __GI_memmove
9.25% find [.] _int_malloc
7.60% find [.] _IO_vfprintf_internal
6.10% find [.] _IO_new_file_xsputn
6.02% find [.] __GI_close
3.08% find [.] _IO_file_overflow_internal
3.08% find [.] malloc_consolidate
3.08% find [.] _int_free
3.08% find [.] __strchrnul
3.08% find [.] __getdents64
3.08% find [.] __write_nocancel
3.08% sleep [.] __GI__dl_addr
3.08% sshd [.] __libc_select
3.08% find [.] _IO_new_file_write
3.07% find [.] _IO_new_do_write
3.06% find [.] __GI___errno_location
3.05% find [.] __GI___libc_malloc
3.04% perf [.] __GI_memcpy
1.71% find [.] __fprintf_chk
1.29% bash [.] __gconv_transform_utf8_internal
0.79% dbus-daemon [.] __GI_strlen
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[root@doppio linux-2.6-tip]#
So I think this is really, really nice in that it demonstrates
the portability of perf.data files and the use of build-ids
accross such aliens worlds :-)
There are some things to fix tho, like the bitmap on the header,
but things are looking good.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1263478990-8200-2-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2010-01-14 17:23:10 +03:00
|
|
|
mmap_prot |= PROT_WRITE;
|
|
|
|
mmap_flags = MAP_PRIVATE;
|
|
|
|
}
|
2009-12-28 02:36:59 +03:00
|
|
|
remap:
|
2013-10-15 18:27:34 +04:00
|
|
|
buf = mmap(NULL, mmap_size, mmap_prot, mmap_flags, fd,
|
2010-11-30 20:49:46 +03:00
|
|
|
file_offset);
|
2009-12-28 02:36:59 +03:00
|
|
|
if (buf == MAP_FAILED) {
|
|
|
|
pr_err("failed to mmap file\n");
|
|
|
|
err = -errno;
|
|
|
|
goto out_err;
|
|
|
|
}
|
2010-11-30 20:49:49 +03:00
|
|
|
mmaps[map_idx] = buf;
|
|
|
|
map_idx = (map_idx + 1) & (ARRAY_SIZE(mmaps) - 1);
|
2010-11-30 20:49:44 +03:00
|
|
|
file_pos = file_offset + head;
|
2009-12-28 02:36:59 +03:00
|
|
|
|
|
|
|
more:
|
2011-05-23 15:06:28 +04:00
|
|
|
event = fetch_mmaped_event(session, head, mmap_size, buf);
|
|
|
|
if (!event) {
|
2010-11-30 20:49:49 +03:00
|
|
|
if (mmaps[map_idx]) {
|
|
|
|
munmap(mmaps[map_idx], mmap_size);
|
|
|
|
mmaps[map_idx] = NULL;
|
|
|
|
}
|
2009-12-28 02:36:59 +03:00
|
|
|
|
2010-11-30 20:49:38 +03:00
|
|
|
page_offset = page_size * (head / page_size);
|
|
|
|
file_offset += page_offset;
|
|
|
|
head -= page_offset;
|
2009-12-28 02:36:59 +03:00
|
|
|
goto remap;
|
|
|
|
}
|
|
|
|
|
|
|
|
size = event->header.size;
|
|
|
|
|
2013-07-04 17:20:27 +04:00
|
|
|
if (size < sizeof(struct perf_event_header) ||
|
2011-11-28 14:30:20 +04:00
|
|
|
perf_session__process_event(session, event, tool, file_pos) < 0) {
|
2012-04-16 22:42:51 +04:00
|
|
|
pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n",
|
|
|
|
file_offset + head, event->header.size,
|
|
|
|
event->header.type);
|
|
|
|
err = -EINVAL;
|
|
|
|
goto out_err;
|
2009-12-28 02:36:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
head += size;
|
2010-11-30 20:49:44 +03:00
|
|
|
file_pos += size;
|
2009-12-28 02:36:59 +03:00
|
|
|
|
2013-10-23 22:40:38 +04:00
|
|
|
ui_progress__update(&prog, size);
|
2010-11-30 20:49:46 +03:00
|
|
|
|
2013-09-17 23:34:28 +04:00
|
|
|
if (session_done())
|
2013-10-18 16:29:02 +04:00
|
|
|
goto out;
|
2013-09-17 23:34:28 +04:00
|
|
|
|
2010-11-30 20:49:44 +03:00
|
|
|
if (file_pos < file_size)
|
2009-12-28 02:36:59 +03:00
|
|
|
goto more;
|
2010-11-30 20:49:44 +03:00
|
|
|
|
2013-10-18 16:29:02 +04:00
|
|
|
out:
|
2010-04-24 02:04:12 +04:00
|
|
|
/* do the final flush for ordered samples */
|
2010-11-30 20:49:38 +03:00
|
|
|
session->ordered_samples.next_flush = ULLONG_MAX;
|
2012-08-26 22:24:41 +04:00
|
|
|
err = flush_sample_queue(session, tool);
|
2009-12-28 02:36:59 +03:00
|
|
|
out_err:
|
2012-11-13 17:30:34 +04:00
|
|
|
ui_progress__finish();
|
2011-11-28 14:30:20 +04:00
|
|
|
perf_session__warn_about_errors(session, tool);
|
2010-11-30 20:49:53 +03:00
|
|
|
perf_session_free_sample_buffers(session);
|
2009-12-28 02:36:59 +03:00
|
|
|
return err;
|
|
|
|
}
|
2009-12-28 02:37:01 +03:00
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
int perf_session__process_events(struct perf_session *session,
|
2011-11-28 14:30:20 +04:00
|
|
|
struct perf_tool *tool)
|
2010-02-03 21:52:05 +03:00
|
|
|
{
|
2013-11-05 22:32:36 +04:00
|
|
|
u64 size = perf_data_file__size(session->file);
|
2010-02-03 21:52:05 +03:00
|
|
|
int err;
|
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
if (perf_session__register_idle_thread(session) == NULL)
|
2010-02-03 21:52:05 +03:00
|
|
|
return -ENOMEM;
|
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
if (!perf_data_file__is_pipe(session->file))
|
|
|
|
err = __perf_session__process_events(session,
|
|
|
|
session->header.data_offset,
|
|
|
|
session->header.data_size,
|
2013-10-15 18:27:34 +04:00
|
|
|
size, tool);
|
2010-04-02 08:59:15 +04:00
|
|
|
else
|
2013-11-05 22:32:36 +04:00
|
|
|
err = __perf_session__process_pipe_events(session, tool);
|
2010-07-27 18:46:12 +04:00
|
|
|
|
2010-02-03 21:52:05 +03:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2012-08-02 02:15:52 +04:00
|
|
|
bool perf_session__has_traces(struct perf_session *session, const char *msg)
|
2009-12-28 02:37:01 +03:00
|
|
|
{
|
2013-08-08 06:50:58 +04:00
|
|
|
struct perf_evsel *evsel;
|
|
|
|
|
|
|
|
list_for_each_entry(evsel, &session->evlist->entries, node) {
|
|
|
|
if (evsel->attr.type == PERF_TYPE_TRACEPOINT)
|
|
|
|
return true;
|
2009-12-28 02:37:01 +03:00
|
|
|
}
|
|
|
|
|
2013-08-08 06:50:58 +04:00
|
|
|
pr_err("No trace sample to read. Did you call 'perf %s'?\n", msg);
|
|
|
|
return false;
|
2009-12-28 02:37:01 +03:00
|
|
|
}
|
2010-01-05 21:50:31 +03:00
|
|
|
|
2011-11-28 13:56:39 +04:00
|
|
|
int maps__set_kallsyms_ref_reloc_sym(struct map **maps,
|
|
|
|
const char *symbol_name, u64 addr)
|
2010-01-05 21:50:31 +03:00
|
|
|
{
|
|
|
|
char *bracket;
|
2010-02-03 21:52:00 +03:00
|
|
|
enum map_type i;
|
2010-04-19 09:32:50 +04:00
|
|
|
struct ref_reloc_sym *ref;
|
|
|
|
|
|
|
|
ref = zalloc(sizeof(struct ref_reloc_sym));
|
|
|
|
if (ref == NULL)
|
|
|
|
return -ENOMEM;
|
2010-01-05 21:50:31 +03:00
|
|
|
|
2010-04-19 09:32:50 +04:00
|
|
|
ref->name = strdup(symbol_name);
|
|
|
|
if (ref->name == NULL) {
|
|
|
|
free(ref);
|
2010-01-05 21:50:31 +03:00
|
|
|
return -ENOMEM;
|
2010-04-19 09:32:50 +04:00
|
|
|
}
|
2010-01-05 21:50:31 +03:00
|
|
|
|
2010-04-19 09:32:50 +04:00
|
|
|
bracket = strchr(ref->name, ']');
|
2010-01-05 21:50:31 +03:00
|
|
|
if (bracket)
|
|
|
|
*bracket = '\0';
|
|
|
|
|
2010-04-19 09:32:50 +04:00
|
|
|
ref->addr = addr;
|
2010-02-03 21:52:00 +03:00
|
|
|
|
|
|
|
for (i = 0; i < MAP__NR_TYPES; ++i) {
|
2010-04-19 09:32:50 +04:00
|
|
|
struct kmap *kmap = map__kmap(maps[i]);
|
|
|
|
kmap->ref_reloc_sym = ref;
|
2010-02-03 21:52:00 +03:00
|
|
|
}
|
|
|
|
|
2010-01-05 21:50:31 +03:00
|
|
|
return 0;
|
|
|
|
}
|
2010-05-10 02:57:08 +04:00
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
size_t perf_session__fprintf_dsos(struct perf_session *session, FILE *fp)
|
2010-05-10 02:57:08 +04:00
|
|
|
{
|
2013-11-05 22:32:36 +04:00
|
|
|
return machines__fprintf_dsos(&session->machines, fp);
|
2010-05-10 02:57:08 +04:00
|
|
|
}
|
2010-05-19 20:41:23 +04:00
|
|
|
|
2013-11-05 22:32:36 +04:00
|
|
|
size_t perf_session__fprintf_dsos_buildid(struct perf_session *session, FILE *fp,
|
2012-12-07 16:53:58 +04:00
|
|
|
bool (skip)(struct dso *dso, int parm), int parm)
|
2010-05-19 20:41:23 +04:00
|
|
|
{
|
2013-11-05 22:32:36 +04:00
|
|
|
return machines__fprintf_dsos_buildid(&session->machines, fp, skip, parm);
|
2010-05-19 20:41:23 +04:00
|
|
|
}
|
2011-03-06 03:40:06 +03:00
|
|
|
|
|
|
|
size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp)
|
|
|
|
{
|
|
|
|
struct perf_evsel *pos;
|
|
|
|
size_t ret = fprintf(fp, "Aggregated stats:\n");
|
|
|
|
|
2012-12-18 23:24:46 +04:00
|
|
|
ret += events_stats__fprintf(&session->stats, fp);
|
2011-03-06 03:40:06 +03:00
|
|
|
|
|
|
|
list_for_each_entry(pos, &session->evlist->entries, node) {
|
2012-06-12 19:34:58 +04:00
|
|
|
ret += fprintf(fp, "%s stats:\n", perf_evsel__name(pos));
|
2012-12-18 23:02:17 +04:00
|
|
|
ret += events_stats__fprintf(&pos->hists.stats, fp);
|
2011-03-06 03:40:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2011-03-10 08:23:27 +03:00
|
|
|
|
2011-11-09 19:24:25 +04:00
|
|
|
size_t perf_session__fprintf(struct perf_session *session, FILE *fp)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* FIXME: Here we have to actually print all the machines in this
|
|
|
|
* session, not just the host...
|
|
|
|
*/
|
2012-12-19 02:15:48 +04:00
|
|
|
return machine__fprintf(&session->machines.host, fp);
|
2011-11-09 19:24:25 +04:00
|
|
|
}
|
|
|
|
|
2011-04-07 07:54:20 +04:00
|
|
|
struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session,
|
|
|
|
unsigned int type)
|
|
|
|
{
|
|
|
|
struct perf_evsel *pos;
|
|
|
|
|
|
|
|
list_for_each_entry(pos, &session->evlist->entries, node) {
|
|
|
|
if (pos->attr.type == type)
|
|
|
|
return pos;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-12-04 18:16:36 +04:00
|
|
|
void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample,
|
|
|
|
struct machine *machine, struct addr_location *al,
|
2013-08-08 06:50:53 +04:00
|
|
|
unsigned int print_opts, unsigned int stack_depth)
|
2011-03-10 08:23:27 +03:00
|
|
|
{
|
|
|
|
struct callchain_cursor_node *node;
|
2013-08-08 06:50:51 +04:00
|
|
|
int print_ip = print_opts & PRINT_IP_OPT_IP;
|
|
|
|
int print_sym = print_opts & PRINT_IP_OPT_SYM;
|
|
|
|
int print_dso = print_opts & PRINT_IP_OPT_DSO;
|
|
|
|
int print_symoffset = print_opts & PRINT_IP_OPT_SYMOFFSET;
|
2013-08-08 06:50:52 +04:00
|
|
|
int print_oneline = print_opts & PRINT_IP_OPT_ONELINE;
|
|
|
|
char s = print_oneline ? ' ' : '\t';
|
2011-03-10 08:23:27 +03:00
|
|
|
|
|
|
|
if (symbol_conf.use_callchain && sample->callchain) {
|
2013-12-04 18:16:36 +04:00
|
|
|
struct addr_location node_al;
|
2011-03-10 08:23:27 +03:00
|
|
|
|
2013-12-04 18:16:36 +04:00
|
|
|
if (machine__resolve_callchain(machine, evsel, al->thread,
|
perf report: Add --max-stack option to limit callchain stack scan
When callgraph data was included in the perf data file, it may take a
long time to scan all those data and merge them together especially if
the stored callchains are long and the perf data file itself is large,
like a Gbyte or so.
The callchain stack is currently limited to PERF_MAX_STACK_DEPTH (127).
This is a large value. Usually the callgraph data that developers are
most interested in are the first few levels, the rests are usually not
looked at.
This patch adds a new --max-stack option to perf-report to limit the
depth of callchain stack data to look at to reduce the time it takes for
perf-report to finish its processing. It trades the presence of trailing
stack information with faster speed.
The following table shows the elapsed time of doing perf-report on a
perf.data file of size 985,531,828 bytes.
--max_stack Elapsed Time Output data size
----------- ------------ ----------------
not set 88.0s 124,422,651
64 87.5s 116,303,213
32 87.2s 112,023,804
16 86.6s 94,326,380
8 59.9s 33,697,248
4 40.7s 10,116,637
-g none 27.1s 2,555,810
Signed-off-by: Waiman Long <Waiman.Long@hp.com>
Acked-by: David Ahern <dsahern@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Aswin Chandramouleeswaran <aswin@hp.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Scott J Norton <scott.norton@hp.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1382107129-2010-4-git-send-email-Waiman.Long@hp.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-10-18 18:38:48 +04:00
|
|
|
sample, NULL, NULL,
|
|
|
|
PERF_MAX_STACK_DEPTH) != 0) {
|
2011-03-10 08:23:27 +03:00
|
|
|
if (verbose)
|
|
|
|
error("Failed to resolve callchain. Skipping\n");
|
|
|
|
return;
|
|
|
|
}
|
2012-05-31 09:43:26 +04:00
|
|
|
callchain_cursor_commit(&callchain_cursor);
|
2011-03-10 08:23:27 +03:00
|
|
|
|
2013-12-04 18:16:36 +04:00
|
|
|
if (print_symoffset)
|
|
|
|
node_al = *al;
|
|
|
|
|
2013-08-08 06:50:53 +04:00
|
|
|
while (stack_depth) {
|
2012-05-31 09:43:26 +04:00
|
|
|
node = callchain_cursor_current(&callchain_cursor);
|
2011-03-10 08:23:27 +03:00
|
|
|
if (!node)
|
|
|
|
break;
|
|
|
|
|
2013-11-19 00:32:44 +04:00
|
|
|
if (node->sym && node->sym->ignore)
|
|
|
|
goto next;
|
|
|
|
|
2013-08-08 06:50:51 +04:00
|
|
|
if (print_ip)
|
2013-08-08 06:50:52 +04:00
|
|
|
printf("%c%16" PRIx64, s, node->ip);
|
2013-08-08 06:50:51 +04:00
|
|
|
|
2011-05-28 00:28:43 +04:00
|
|
|
if (print_sym) {
|
2012-01-30 08:42:57 +04:00
|
|
|
printf(" ");
|
2013-07-28 19:14:34 +04:00
|
|
|
if (print_symoffset) {
|
2013-12-04 18:16:36 +04:00
|
|
|
node_al.addr = node->ip;
|
|
|
|
node_al.map = node->map;
|
|
|
|
symbol__fprintf_symname_offs(node->sym, &node_al, stdout);
|
2013-07-28 19:14:34 +04:00
|
|
|
} else
|
|
|
|
symbol__fprintf_symname(node->sym, stdout);
|
2011-05-28 00:28:44 +04:00
|
|
|
}
|
2013-07-28 19:14:34 +04:00
|
|
|
|
2011-05-28 00:28:44 +04:00
|
|
|
if (print_dso) {
|
2012-01-30 08:42:57 +04:00
|
|
|
printf(" (");
|
2012-05-30 08:58:26 +04:00
|
|
|
map__fprintf_dsoname(node->map, stdout);
|
2012-01-30 08:42:57 +04:00
|
|
|
printf(")");
|
2011-05-28 00:28:43 +04:00
|
|
|
}
|
2013-08-08 06:50:52 +04:00
|
|
|
|
|
|
|
if (!print_oneline)
|
|
|
|
printf("\n");
|
2011-03-10 08:23:27 +03:00
|
|
|
|
2013-08-08 06:50:53 +04:00
|
|
|
stack_depth--;
|
2013-11-19 00:32:44 +04:00
|
|
|
next:
|
|
|
|
callchain_cursor_advance(&callchain_cursor);
|
2011-03-10 08:23:27 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
2013-12-04 18:16:36 +04:00
|
|
|
if (al->sym && al->sym->ignore)
|
2013-11-19 00:32:44 +04:00
|
|
|
return;
|
|
|
|
|
2013-08-08 06:50:51 +04:00
|
|
|
if (print_ip)
|
|
|
|
printf("%16" PRIx64, sample->ip);
|
|
|
|
|
2011-05-28 00:28:43 +04:00
|
|
|
if (print_sym) {
|
2012-01-30 08:42:57 +04:00
|
|
|
printf(" ");
|
2012-01-30 08:43:15 +04:00
|
|
|
if (print_symoffset)
|
2013-12-04 18:16:36 +04:00
|
|
|
symbol__fprintf_symname_offs(al->sym, al,
|
2012-01-30 08:43:15 +04:00
|
|
|
stdout);
|
|
|
|
else
|
2013-12-04 18:16:36 +04:00
|
|
|
symbol__fprintf_symname(al->sym, stdout);
|
2011-05-28 00:28:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (print_dso) {
|
2012-01-30 08:42:57 +04:00
|
|
|
printf(" (");
|
2013-12-04 18:16:36 +04:00
|
|
|
map__fprintf_dsoname(al->map, stdout);
|
2012-01-30 08:42:57 +04:00
|
|
|
printf(")");
|
2011-05-28 00:28:43 +04:00
|
|
|
}
|
2011-03-10 08:23:27 +03:00
|
|
|
}
|
|
|
|
}
|
2011-07-04 15:57:50 +04:00
|
|
|
|
|
|
|
int perf_session__cpu_bitmap(struct perf_session *session,
|
|
|
|
const char *cpu_list, unsigned long *cpu_bitmap)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
struct cpu_map *map;
|
|
|
|
|
|
|
|
for (i = 0; i < PERF_TYPE_MAX; ++i) {
|
|
|
|
struct perf_evsel *evsel;
|
|
|
|
|
|
|
|
evsel = perf_session__find_first_evtype(session, i);
|
|
|
|
if (!evsel)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (!(evsel->attr.sample_type & PERF_SAMPLE_CPU)) {
|
|
|
|
pr_err("File does not contain CPU events. "
|
|
|
|
"Remove -c option to proceed.\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
map = cpu_map__new(cpu_list);
|
2011-11-13 21:45:27 +04:00
|
|
|
if (map == NULL) {
|
|
|
|
pr_err("Invalid cpu_list\n");
|
|
|
|
return -1;
|
|
|
|
}
|
2011-07-04 15:57:50 +04:00
|
|
|
|
|
|
|
for (i = 0; i < map->nr; i++) {
|
|
|
|
int cpu = map->map[i];
|
|
|
|
|
|
|
|
if (cpu >= MAX_NR_CPUS) {
|
|
|
|
pr_err("Requested CPU %d too large. "
|
|
|
|
"Consider raising MAX_NR_CPUS\n", cpu);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
set_bit(cpu, cpu_bitmap);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
perf tools: Make perf.data more self-descriptive (v8)
The goal of this patch is to include more information about the host
environment into the perf.data so it is more self-descriptive. Overtime,
profiles are captured on various machines and it becomes hard to track
what was recorded, on what machine and when.
This patch provides a way to solve this by extending the perf.data file
with basic information about the host machine. To add those extensions,
we leverage the feature bits capabilities of the perf.data format. The
change is backward compatible with existing perf.data files.
We define the following useful new extensions:
- HEADER_HOSTNAME: the hostname
- HEADER_OSRELEASE: the kernel release number
- HEADER_ARCH: the hw architecture
- HEADER_CPUDESC: generic CPU description
- HEADER_NRCPUS: number of online/avail cpus
- HEADER_CMDLINE: perf command line
- HEADER_VERSION: perf version
- HEADER_TOPOLOGY: cpu topology
- HEADER_EVENT_DESC: full event description (attrs)
- HEADER_CPUID: easy-to-parse low level CPU identication
The small granularity for the entries is to make it easier to extend
without breaking backward compatiblity. Many entries are provided as
ASCII strings.
Perf report/script have been modified to print the basic information as
easy-to-parse ASCII strings. Extended information about CPU and NUMA
topology may be requested with the -I option.
Thanks to David Ahern for reviewing and testing the many versions of
this patch.
$ perf report --stdio
# ========
# captured on : Mon Sep 26 15:22:14 2011
# hostname : quad
# os release : 3.1.0-rc4-tip
# perf version : 3.1.0-rc4
# arch : x86_64
# nrcpus online : 4
# nrcpus avail : 4
# cpudesc : Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz
# cpuid : GenuineIntel,6,15,11
# total memory : 8105360 kB
# cmdline : /home/eranian/perfmon/official/tip/build/tools/perf/perf record date
# event : name = cycles, type = 0, config = 0x0, config1 = 0x0, config2 = 0x0, excl_usr = 0, excl_kern = 0, id = { 29, 30, 31,
# HEADER_CPU_TOPOLOGY info available, use -I to display
# HEADER_NUMA_TOPOLOGY info available, use -I to display
# ========
#
...
$ perf report --stdio -I
# ========
# captured on : Mon Sep 26 15:22:14 2011
# hostname : quad
# os release : 3.1.0-rc4-tip
# perf version : 3.1.0-rc4
# arch : x86_64
# nrcpus online : 4
# nrcpus avail : 4
# cpudesc : Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz
# cpuid : GenuineIntel,6,15,11
# total memory : 8105360 kB
# cmdline : /home/eranian/perfmon/official/tip/build/tools/perf/perf record date
# event : name = cycles, type = 0, config = 0x0, config1 = 0x0, config2 = 0x0, excl_usr = 0, excl_kern = 0, id = { 29, 30, 31,
# sibling cores : 0-3
# sibling threads : 0
# sibling threads : 1
# sibling threads : 2
# sibling threads : 3
# node0 meminfo : total = 8320608 kB, free = 7571024 kB
# node0 cpu list : 0-3
# ========
#
...
Reviewed-by: David Ahern <dsahern@gmail.com>
Tested-by: David Ahern <dsahern@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/20110930134040.GA5575@quad
Signed-off-by: Stephane Eranian <eranian@google.com>
[ committer notes: Use --show-info in the tools as was in the docs, rename
perf_header_fprintf_info to perf_file_section__fprintf_info, fixup
conflict with f69b64f7 "perf: Support setting the disassembler style" ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-09-30 17:40:40 +04:00
|
|
|
|
|
|
|
void perf_session__fprintf_info(struct perf_session *session, FILE *fp,
|
|
|
|
bool full)
|
|
|
|
{
|
2013-10-15 18:27:34 +04:00
|
|
|
int fd = perf_data_file__fd(session->file);
|
perf tools: Make perf.data more self-descriptive (v8)
The goal of this patch is to include more information about the host
environment into the perf.data so it is more self-descriptive. Overtime,
profiles are captured on various machines and it becomes hard to track
what was recorded, on what machine and when.
This patch provides a way to solve this by extending the perf.data file
with basic information about the host machine. To add those extensions,
we leverage the feature bits capabilities of the perf.data format. The
change is backward compatible with existing perf.data files.
We define the following useful new extensions:
- HEADER_HOSTNAME: the hostname
- HEADER_OSRELEASE: the kernel release number
- HEADER_ARCH: the hw architecture
- HEADER_CPUDESC: generic CPU description
- HEADER_NRCPUS: number of online/avail cpus
- HEADER_CMDLINE: perf command line
- HEADER_VERSION: perf version
- HEADER_TOPOLOGY: cpu topology
- HEADER_EVENT_DESC: full event description (attrs)
- HEADER_CPUID: easy-to-parse low level CPU identication
The small granularity for the entries is to make it easier to extend
without breaking backward compatiblity. Many entries are provided as
ASCII strings.
Perf report/script have been modified to print the basic information as
easy-to-parse ASCII strings. Extended information about CPU and NUMA
topology may be requested with the -I option.
Thanks to David Ahern for reviewing and testing the many versions of
this patch.
$ perf report --stdio
# ========
# captured on : Mon Sep 26 15:22:14 2011
# hostname : quad
# os release : 3.1.0-rc4-tip
# perf version : 3.1.0-rc4
# arch : x86_64
# nrcpus online : 4
# nrcpus avail : 4
# cpudesc : Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz
# cpuid : GenuineIntel,6,15,11
# total memory : 8105360 kB
# cmdline : /home/eranian/perfmon/official/tip/build/tools/perf/perf record date
# event : name = cycles, type = 0, config = 0x0, config1 = 0x0, config2 = 0x0, excl_usr = 0, excl_kern = 0, id = { 29, 30, 31,
# HEADER_CPU_TOPOLOGY info available, use -I to display
# HEADER_NUMA_TOPOLOGY info available, use -I to display
# ========
#
...
$ perf report --stdio -I
# ========
# captured on : Mon Sep 26 15:22:14 2011
# hostname : quad
# os release : 3.1.0-rc4-tip
# perf version : 3.1.0-rc4
# arch : x86_64
# nrcpus online : 4
# nrcpus avail : 4
# cpudesc : Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz
# cpuid : GenuineIntel,6,15,11
# total memory : 8105360 kB
# cmdline : /home/eranian/perfmon/official/tip/build/tools/perf/perf record date
# event : name = cycles, type = 0, config = 0x0, config1 = 0x0, config2 = 0x0, excl_usr = 0, excl_kern = 0, id = { 29, 30, 31,
# sibling cores : 0-3
# sibling threads : 0
# sibling threads : 1
# sibling threads : 2
# sibling threads : 3
# node0 meminfo : total = 8320608 kB, free = 7571024 kB
# node0 cpu list : 0-3
# ========
#
...
Reviewed-by: David Ahern <dsahern@gmail.com>
Tested-by: David Ahern <dsahern@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/20110930134040.GA5575@quad
Signed-off-by: Stephane Eranian <eranian@google.com>
[ committer notes: Use --show-info in the tools as was in the docs, rename
perf_header_fprintf_info to perf_file_section__fprintf_info, fixup
conflict with f69b64f7 "perf: Support setting the disassembler style" ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-09-30 17:40:40 +04:00
|
|
|
struct stat st;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (session == NULL || fp == NULL)
|
|
|
|
return;
|
|
|
|
|
2013-10-15 18:27:34 +04:00
|
|
|
ret = fstat(fd, &st);
|
perf tools: Make perf.data more self-descriptive (v8)
The goal of this patch is to include more information about the host
environment into the perf.data so it is more self-descriptive. Overtime,
profiles are captured on various machines and it becomes hard to track
what was recorded, on what machine and when.
This patch provides a way to solve this by extending the perf.data file
with basic information about the host machine. To add those extensions,
we leverage the feature bits capabilities of the perf.data format. The
change is backward compatible with existing perf.data files.
We define the following useful new extensions:
- HEADER_HOSTNAME: the hostname
- HEADER_OSRELEASE: the kernel release number
- HEADER_ARCH: the hw architecture
- HEADER_CPUDESC: generic CPU description
- HEADER_NRCPUS: number of online/avail cpus
- HEADER_CMDLINE: perf command line
- HEADER_VERSION: perf version
- HEADER_TOPOLOGY: cpu topology
- HEADER_EVENT_DESC: full event description (attrs)
- HEADER_CPUID: easy-to-parse low level CPU identication
The small granularity for the entries is to make it easier to extend
without breaking backward compatiblity. Many entries are provided as
ASCII strings.
Perf report/script have been modified to print the basic information as
easy-to-parse ASCII strings. Extended information about CPU and NUMA
topology may be requested with the -I option.
Thanks to David Ahern for reviewing and testing the many versions of
this patch.
$ perf report --stdio
# ========
# captured on : Mon Sep 26 15:22:14 2011
# hostname : quad
# os release : 3.1.0-rc4-tip
# perf version : 3.1.0-rc4
# arch : x86_64
# nrcpus online : 4
# nrcpus avail : 4
# cpudesc : Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz
# cpuid : GenuineIntel,6,15,11
# total memory : 8105360 kB
# cmdline : /home/eranian/perfmon/official/tip/build/tools/perf/perf record date
# event : name = cycles, type = 0, config = 0x0, config1 = 0x0, config2 = 0x0, excl_usr = 0, excl_kern = 0, id = { 29, 30, 31,
# HEADER_CPU_TOPOLOGY info available, use -I to display
# HEADER_NUMA_TOPOLOGY info available, use -I to display
# ========
#
...
$ perf report --stdio -I
# ========
# captured on : Mon Sep 26 15:22:14 2011
# hostname : quad
# os release : 3.1.0-rc4-tip
# perf version : 3.1.0-rc4
# arch : x86_64
# nrcpus online : 4
# nrcpus avail : 4
# cpudesc : Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz
# cpuid : GenuineIntel,6,15,11
# total memory : 8105360 kB
# cmdline : /home/eranian/perfmon/official/tip/build/tools/perf/perf record date
# event : name = cycles, type = 0, config = 0x0, config1 = 0x0, config2 = 0x0, excl_usr = 0, excl_kern = 0, id = { 29, 30, 31,
# sibling cores : 0-3
# sibling threads : 0
# sibling threads : 1
# sibling threads : 2
# sibling threads : 3
# node0 meminfo : total = 8320608 kB, free = 7571024 kB
# node0 cpu list : 0-3
# ========
#
...
Reviewed-by: David Ahern <dsahern@gmail.com>
Tested-by: David Ahern <dsahern@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/20110930134040.GA5575@quad
Signed-off-by: Stephane Eranian <eranian@google.com>
[ committer notes: Use --show-info in the tools as was in the docs, rename
perf_header_fprintf_info to perf_file_section__fprintf_info, fixup
conflict with f69b64f7 "perf: Support setting the disassembler style" ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-09-30 17:40:40 +04:00
|
|
|
if (ret == -1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
fprintf(fp, "# ========\n");
|
|
|
|
fprintf(fp, "# captured on: %s", ctime(&st.st_ctime));
|
|
|
|
perf_header__fprintf_info(session, fp, full);
|
|
|
|
fprintf(fp, "# ========\n#\n");
|
|
|
|
}
|
2012-06-27 20:08:42 +04:00
|
|
|
|
|
|
|
|
|
|
|
int __perf_session__set_tracepoints_handlers(struct perf_session *session,
|
|
|
|
const struct perf_evsel_str_handler *assocs,
|
|
|
|
size_t nr_assocs)
|
|
|
|
{
|
|
|
|
struct perf_evsel *evsel;
|
|
|
|
size_t i;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
for (i = 0; i < nr_assocs; i++) {
|
2013-09-06 22:19:01 +04:00
|
|
|
/*
|
|
|
|
* Adding a handler for an event not in the session,
|
|
|
|
* just ignore it.
|
|
|
|
*/
|
|
|
|
evsel = perf_evlist__find_tracepoint_by_name(session->evlist, assocs[i].name);
|
2012-06-27 20:08:42 +04:00
|
|
|
if (evsel == NULL)
|
2013-09-06 22:19:01 +04:00
|
|
|
continue;
|
2012-06-27 20:08:42 +04:00
|
|
|
|
|
|
|
err = -EEXIST;
|
2013-11-06 17:17:38 +04:00
|
|
|
if (evsel->handler != NULL)
|
2013-09-06 22:19:01 +04:00
|
|
|
goto out;
|
2013-11-06 17:17:38 +04:00
|
|
|
evsel->handler = assocs[i].handler;
|
2012-06-27 20:08:42 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
err = 0;
|
|
|
|
out:
|
|
|
|
return err;
|
|
|
|
}
|