Skip to contentSkip to conversation

perf tools: Don' t stop synthesizing threads when one vanishes

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Oct 26, 2012 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  ba361c92e73c771fcbbbd24c2c03c322e2de2e31
Gitweb:     http://git.kernel.org/tip/ba361c92e73c771fcbbbd24c2c03c322e2de2e31
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Wed, 17 Oct 2012 18:50:13 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 25 Oct 2012 10:37:15 -0200

perf tools: Don't stop synthesizing threads when one vanishes

The perf_event__synthesize_threads routine synthesizes all the existing threads in the system, because we don't have any kernel facilities to ask for PERF_RECORD_{FORK,MMAP,COMM} for existing threads.

It was returning an error as soon as one thread couldn't be synthesized, which is a bit extreme when, for instance, a forkish workload is running, like a kernel compile.

Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/util/event.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
tools/perf/util/event.c +6 -7
index 0ae444e..ca9ca28 100644
@@ -405,16 +405,15 @@ int perf_event__synthesize_threads(struct perf_tool *tool,
 
 		if (*end) /* only interested in proper numerical dirents */
 			continue;
-
-		if (__event__synthesize_thread(comm_event, mmap_event, pid, 1,
-					   process, tool, machine) != 0) {
-			err = -1;
-			goto out_closedir;
-		}
+		/*
+ 		 * We may race with exiting thread, so don't stop just because
+ 		 * one thread couldn't be synthesized.
+ 		 */
+		__event__synthesize_thread(comm_event, mmap_event, pid, 1,
+					   process, tool, machine);
 	}
 
 	err = 0;
-out_closedir:
 	closedir(proc);
 out_free_mmap:
 	free(mmap_event);