diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2010-05-31 17:38:44 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2010-05-31 17:59:50 -0400 |
commit | 13eb04fdbeb9d21dfe4696630daefe18ef6a1a84 (patch) | |
tree | 47edb43ab193dfc99227f760ee70bb9c393d14c4 /tools | |
parent | 546cf44a1b507c1cbb5cf42bbe6169780567f36f (diff) |
perf: Process comm events by tid
When we synthetize the existing running tasks though procfs,
we walk through every threads of a process, queuing one comm
events per tid.
But then on report time, event__process_comm() only creates and
sets the comm on a per process granularity. This is the right
thing for comm events that came from the kernel, as they are
only created on exec. Sub-threads then inherit their comm
from fork events. But that doesn't work with our synthetized
comm events taken from procfs informations as the per thread
granularity is done on comm events directly there.
Hence we need event__process_comm() to work with the tid rather
than the pid. It won't change anything for comm events coming
from the kernel but this will fix the synthetized ones.
Before:
$ ./perf report -D | grep COMM | grep firefox
0x2c7b8 [0x18]: PERF_RECORD_COMM: firefox:5297
0x2c7d0 [0x18]: PERF_RECORD_COMM: firefox:5297
0x2c7e8 [0x18]: PERF_RECORD_COMM: firefox:5297
0x2c800 [0x18]: PERF_RECORD_COMM: firefox:5297
0x2c818 [0x18]: PERF_RECORD_COMM: firefox:5297
0x2c830 [0x18]: PERF_RECORD_COMM: firefox:5297
After:
$ ./perf report -D | grep COMM | grep firefox
0x2c7b8 [0x18]: PERF_RECORD_COMM: firefox:5297
0x2c7d0 [0x18]: PERF_RECORD_COMM: firefox:5299
0x2c7e8 [0x18]: PERF_RECORD_COMM: firefox:5300
0x2c800 [0x18]: PERF_RECORD_COMM: firefox:5308
0x2c818 [0x18]: PERF_RECORD_COMM: firefox:5309
0x2c830 [0x18]: PERF_RECORD_COMM: firefox:5312
This fixes various unresolved pid on perf sched.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/event.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 50771b5813ee..d28d80968f36 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -370,9 +370,9 @@ static int thread__set_comm_adjust(struct thread *self, const char *comm) | |||
370 | 370 | ||
371 | int event__process_comm(event_t *self, struct perf_session *session) | 371 | int event__process_comm(event_t *self, struct perf_session *session) |
372 | { | 372 | { |
373 | struct thread *thread = perf_session__findnew(session, self->comm.pid); | 373 | struct thread *thread = perf_session__findnew(session, self->comm.tid); |
374 | 374 | ||
375 | dump_printf(": %s:%d\n", self->comm.comm, self->comm.pid); | 375 | dump_printf(": %s:%d\n", self->comm.comm, self->comm.tid); |
376 | 376 | ||
377 | if (thread == NULL || thread__set_comm_adjust(thread, self->comm.comm)) { | 377 | if (thread == NULL || thread__set_comm_adjust(thread, self->comm.comm)) { |
378 | dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n"); | 378 | dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n"); |