[PATCH 07/11] perf tools: Fix creation of cpu map

From: Namhyung Kim
Date: Mon Feb 13 2012 - 02:13:53 EST


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 <namhyung.kim@xxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/