Skip to content

Commit

Permalink
perf record/report: Fix PID/COMM handling
Browse files Browse the repository at this point in the history
Fix two bugs causing lost comm mappings:

 - initial PID is not 0 but getpid()

 - when we are unable to handle an mmap event, dont assume the event
   itself is broken - try to parse the stream. This way we wont lose
   comm events.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Ingo Molnar committed Jun 4, 2009
1 parent 3aff27c commit df97992
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Documentation/perf_counter/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ static int __cmd_record(int argc, const char **argv)
}

if (!system_wide) {
open_counters(-1, target_pid != -1 ? target_pid : 0);
open_counters(-1, target_pid != -1 ? target_pid : getpid());
} else for (i = 0; i < nr_cpus; i++)
open_counters(i, target_pid);

Expand Down
2 changes: 1 addition & 1 deletion Documentation/perf_counter/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ process_mmap_event(event_t *event, unsigned long offset, unsigned long head)

if (thread == NULL || map == NULL) {
dprintf("problem processing PERF_EVENT_MMAP, skipping event.\n");
return -1;
return 0;
}

thread__insert_map(thread, map);
Expand Down

0 comments on commit df97992

Please sign in to comment.