mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 10:04:04 +02:00
perf evsel: Improvements to __evsel__match
Ensure both the perf_event_attr and alternate_hw_config are checked in the match. Don't mask the config if the perf_event_attr isn't a HARDWARE or HW_CACHE event. Add common early exit cases. Signed-off-by: Ian Rogers <irogers@google.com> Tested-by: James Clark <james.clark@linaro.org> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
5bf6291113
commit
787bd57817
|
|
@ -1940,16 +1940,19 @@ bool __evsel__match(const struct evsel *evsel, u32 type, u64 config)
|
|||
u32 e_type = evsel->core.attr.type;
|
||||
u64 e_config = evsel->core.attr.config;
|
||||
|
||||
if (e_type != type) {
|
||||
return type == PERF_TYPE_HARDWARE && evsel->pmu && evsel->pmu->is_core &&
|
||||
evsel->alternate_hw_config == config;
|
||||
}
|
||||
|
||||
if ((type == PERF_TYPE_HARDWARE || type == PERF_TYPE_HW_CACHE) &&
|
||||
perf_pmus__supports_extended_type())
|
||||
if (e_type == type && e_config == config)
|
||||
return true;
|
||||
if (type != PERF_TYPE_HARDWARE && type != PERF_TYPE_HW_CACHE)
|
||||
return false;
|
||||
if ((e_type == PERF_TYPE_HARDWARE || e_type == PERF_TYPE_HW_CACHE) &&
|
||||
perf_pmus__supports_extended_type())
|
||||
e_config &= PERF_HW_EVENT_MASK;
|
||||
|
||||
return e_config == config;
|
||||
if (e_type == type && e_config == config)
|
||||
return true;
|
||||
if (type == PERF_TYPE_HARDWARE && evsel->pmu && evsel->pmu->is_core &&
|
||||
evsel->alternate_hw_config == config)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int evsel__read_counter(struct evsel *evsel, int cpu_map_idx, int thread)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user