Skip to contentSkip to conversation

perf record/report: Fix PID/COMM handling

tip:perfcounters/core tip-bot for Ingo Molnar 1 participant 1 message Jun 4, 2009 Documentation

lore
Share & tools
lore
#0 lore raw
Commit-ID:  df97992c6e25ffc66c549c8bc59262dc627c6d17
Gitweb:     http://git.kernel.org/tip/df97992c6e25ffc66c549c8bc59262dc627c6d17
Author:     Ingo Molnar <[email protected]>
AuthorDate: Thu, 4 Jun 2009 13:41:22 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 4 Jun 2009 13:41:37 +0200

perf record/report: Fix PID/COMM handling

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 <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Corey Ashford <[email protected]>
Cc: Marcelo Tosatti <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Thomas Gleixner <[email protected]>
LKML-Reference: <new-submission>

---
 Documentation/perf_counter/builtin-record.c |    2 +-
 Documentation/perf_counter/builtin-report.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Documentation/perf_counter/builtin-record.c +1 -1
index efa2eb4..bf59df5 100644
@@ -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);
 
Documentation/perf_counter/builtin-report.c +1 -1
index 86f23f0..ff6f657 100644
@@ -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);