perf stat: Check PMU cpumask file

If user doesn't explicitly specify CPU list, perf-stat only collects
events on CPUs listed in the PMU cpumask file.

Signed-off-by: "Yah, Zheng" <zheng.z.yan@intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1347263631-23175-3-git-send-email-zheng.z.yan@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Yan, Zheng
2012-09-10 15:53:50 +08:00
committed by Arnaldo Carvalho de Melo
parent 314d9f63f3
commit 7ae92e744e
7 changed files with 82 additions and 22 deletions

View File

@@ -239,8 +239,11 @@ const char *event_type(int type)
return "unknown";
}
static int add_event(struct list_head **_list, int *idx,
struct perf_event_attr *attr, char *name)
static int __add_event(struct list_head **_list, int *idx,
struct perf_event_attr *attr,
char *name, struct cpu_map *cpus)
{
struct perf_evsel *evsel;
struct list_head *list = *_list;
@@ -260,6 +263,7 @@ static int add_event(struct list_head **_list, int *idx,
return -ENOMEM;
}
evsel->cpus = cpus;
if (name)
evsel->name = strdup(name);
list_add_tail(&evsel->node, list);
@@ -267,6 +271,12 @@ static int add_event(struct list_head **_list, int *idx,
return 0;
}
static int add_event(struct list_head **_list, int *idx,
struct perf_event_attr *attr, char *name)
{
return __add_event(_list, idx, attr, name, NULL);
}
static int parse_aliases(char *str, const char *names[][PERF_EVSEL__MAX_ALIASES], int size)
{
int i, j;
@@ -607,8 +617,8 @@ int parse_events_add_pmu(struct list_head **list, int *idx,
if (perf_pmu__config(pmu, &attr, head_config))
return -EINVAL;
return add_event(list, idx, &attr,
pmu_event_name(head_config));
return __add_event(list, idx, &attr, pmu_event_name(head_config),
pmu->cpus);
}
int parse_events__modifier_group(struct list_head *list,