diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2012-05-07 01:08:59 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-05-07 15:46:21 -0400 |
commit | 55261f46702cec96911a81aacfb3cba13434d304 (patch) | |
tree | a0f36a640a30aba2c00a6f95e0ee79263ed7f937 /tools | |
parent | 10b47d54154ce711e4c4438aff10f0215b2ab8eb (diff) |
perf evlist: Fix creation of cpu map
Currently, 'perf record -- sleep 1' creates a cpu map for all online
cpus since it turns out calling cpu_map__new(NULL). Fix it.
Also it is guaranteed that cpu_list is NULL if PID/TID is given by
calling perf_target__validate(), so we can make the conditional bit
simpler.
This also fixes perf test 7 (Validate) failure on my 6 core machine:
$ cat /sys/devices/system/cpu/online
0-11
$ ./perf test -v 7
7: Validate PERF_RECORD_* events & perf_sample fields:
--- start ---
perf_evlist__mmap: Operation not permitted
---- end ----
Validate PERF_RECORD_* events & perf_sample fields: FAILED!
Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1336367344-28071-3-git-send-email-namhyung.kim@lge.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/evlist.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 30328623cae6..183b199b0d09 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -609,8 +609,9 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, | |||
609 | if (evlist->threads == NULL) | 609 | if (evlist->threads == NULL) |
610 | return -1; | 610 | return -1; |
611 | 611 | ||
612 | if (target->uid != UINT_MAX || | 612 | if (target->uid != UINT_MAX || target->tid) |
613 | (target->cpu_list == NULL && target->tid)) | 613 | evlist->cpus = cpu_map__dummy_new(); |
614 | else if (!target->system_wide && target->cpu_list == NULL) | ||
614 | evlist->cpus = cpu_map__dummy_new(); | 615 | evlist->cpus = cpu_map__dummy_new(); |
615 | else | 616 | else |
616 | evlist->cpus = cpu_map__new(target->cpu_list); | 617 | evlist->cpus = cpu_map__new(target->cpu_list); |