diff options
author | Arnaldo Carvalho de Melo <[email protected]> | 2014-10-10 14:29:49 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <[email protected]> | 2014-10-14 17:32:53 -0300 |
commit | 1aaf63b1ee912abd7675681f9d6ffaaf2ffc0451 (patch) | |
tree | 65e3dc7602b1437498e02d237c0c53576db225da | |
parent | 641556c98c821922a9a2121247b5fa25e4407d11 (diff) |
perf evlist: Check that there is a thread_map when preparing a workload
The perf_evlist__prepare_workload expects a thread map to be in place
so that it can store the pid of the workload being started, so check it
and tell the developer about it instead of segfaulting.
Cc: Adrian Hunter <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Don Zickus <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Jean Pihet <[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]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r-- | tools/perf/util/evlist.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 3cebc9a8d52e..5fc7bd42c803 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -1276,8 +1276,14 @@ int perf_evlist__prepare_workload(struct perf_evlist *evlist, struct target *tar sigaction(SIGUSR1, &act, NULL); } - if (target__none(target)) + if (target__none(target)) { + if (evlist->threads == NULL) { + fprintf(stderr, "FATAL: evlist->threads need to be set at this point (%s:%d).\n", + __func__, __LINE__); + goto out_close_pipes; + } evlist->threads->map[0] = evlist->workload.pid; + } close(child_ready_pipe[1]); close(go_pipe[0]); |