Skip to content

Commit

Permalink
perf record: Intercept all events
Browse files Browse the repository at this point in the history
The event interception we need to do in 'perf record' to create
a list of all DSOs in PERF_RECORD_MMAP events wasn't seeing all
events, make sure that happens by checking size agains
event_t->header.size.

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: <1263586107-1756-1-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Arnaldo Carvalho de Melo authored and Ingo Molnar committed Jan 16, 2010
1 parent 2c58517 commit f5a2c3d
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,24 @@ static void write_output(void *buf, size_t size)

static void write_event(event_t *buf, size_t size)
{
/*
* Add it to the list of DSOs, so that when we finish this
* record session we can pick the available build-ids.
*/
if (buf->header.type == PERF_RECORD_MMAP) {
struct list_head *head = &dsos__user;
if (buf->mmap.header.misc == 1)
head = &dsos__kernel;
__dsos__findnew(head, buf->mmap.filename);
}
size_t processed_size = buf->header.size;
event_t *ev = buf;

do {
/*
* Add it to the list of DSOs, so that when we finish this
* record session we can pick the available build-ids.
*/
if (ev->header.type == PERF_RECORD_MMAP) {
struct list_head *head = &dsos__user;
if (ev->header.misc == 1)
head = &dsos__kernel;
__dsos__findnew(head, ev->mmap.filename);
}

ev = ((void *)ev) + ev->header.size;
processed_size += ev->header.size;
} while (processed_size < size);

write_output(buf, size);
}
Expand Down

0 comments on commit f5a2c3d

Please sign in to comment.