perf: periodic: add cpumask processing
Cpumask is used to limit the processors being profiled
on a multi-core processor. Cpumask was being set but not
being used. Add support to use cpumask when creating
a counter.
Change-Id: I3a3aab581e9e925507da5d319328ed6a2460328f
Signed-off-by: Neil Leeder <nleeder@codeaurora.org>
diff --git a/tools/perf/builtin-periodic.c b/tools/perf/builtin-periodic.c
index 70a0e2b..060e909 100644
--- a/tools/perf/builtin-periodic.c
+++ b/tools/perf/builtin-periodic.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -194,6 +194,8 @@
if (p == NULL)
return PERF_PERIODIC_ERROR;
for (cpu = 0; cpu < cpus->nr; cpu++) {
+ if (((1 << cpu) & cpumask) == 0)
+ continue;
p->perf_fd[cpu] = sys_perf_event_open(p->attr, target_pid, cpu,
-1, 0);
if (p->perf_fd[cpu] < 0)