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
check_target_maps(), so we can make the conditional bit simpler.
Signed-off-by: Namhyung Kim <[email protected]>
---
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 3d763c95fd62..b444f311897c 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -602,8 +602,9 @@ int perf_evlist__create_maps(struct perf_evlist *evlist,
if (evlist->threads == NULL)
return -1;
- if (maps->uid != UINT_MAX ||
- (maps->cpu_list == NULL && maps->target_tid != -1))
+ if (maps->uid != UINT_MAX || maps->target_tid != -1)
+ evlist->cpus = cpu_map__dummy_new();
+ else if (!maps->system_wide && maps->cpu_list == NULL)
evlist->cpus = cpu_map__dummy_new();
else
evlist->cpus = cpu_map__new(maps->cpu_list);
--
1.7.9