Skip to contentSkip to conversation

perf tools: Allow multiple cpus record for -p option

PATCH In review Jiri Olsa 2 participants 2 messages Nov 1, 2013 – Nov 5, 2013 perf events

lore
Share & tools
lore

Jiri Olsa

author
#0 lore raw

PATCH 1/1 perf tools: Allow multiple cpus record for -p option

Currently we don't create default CPU map for task related target, like:

  $ perf record -p <pid>

This makes record command to disable inherited events. which is not desired behaviour (we have special option for that (-i) anyway).

Fixing this by creating default CPU map for task related processes.

Cc Adrian Hunter <[email protected]>
Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/util/evlist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/evlist.c +1 -1
index 0582f67..52bb127 100644
@@ -804,7 +804,7 @@ int perf_evlist__create_maps(struct perf_evlist *evlist,
 		return -1;
 
 	if (perf_target__has_task(target))
-		evlist->cpus = cpu_map__dummy_new();
+		evlist->cpus = cpu_map__new(target->cpu_list);
 	else if (!perf_target__has_cpu(target) && !target->uses_mmap)
 		evlist->cpus = cpu_map__dummy_new();
 	else
Signature · 1 line
1.7.11.7
maintainer
#1 lore raw
Quoted 31 lines · Jiri Olsa

Currently we don't create default CPU map for task related target, like:

  $ perf record -p <pid>

This makes record command to disable inherited events. which is not desired behaviour (we have special option for that (-i) anyway).

Fixing this by creating default CPU map for task related processes.

Cc Adrian Hunter <[email protected]>
Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/util/evlist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/evlist.c +0 -0
index 0582f67..52bb127 100644

tools/perf/util/evlist.c int perf_evlist__create_maps(struct perf_evlist *evlist, · line 807

Quoted 5 lines
tools/perf/util/evlist.c +1 -1
@@ -804,7 +804,7 @@ int perf_evlist__create_maps(struct perf_evlist *evlist,
 		return -1;
 
 	if (perf_target__has_task(target))
-		evlist->cpus = cpu_map__dummy_new();
+		evlist->cpus = cpu_map__new(target->cpu_list);

Just a side note, if the target has task, the cpu list should be NULL as task target has a precedence. Please see perf_target__validate().

But I'm fine with the change itself. :)

Thanks,
Namhyung

Quoted 3 lines
tools/perf/util/evlist.c +0 -0
 	else if (!perf_target__has_cpu(target) && !target->uses_mmap)
 		evlist->cpus = cpu_map__dummy_new();
 	else