1 // SPDX-License-Identifier: GPL-2.0
4 #include "util/evlist.h"
5 #include "util/parse-events.h"
7 #define TOPDOWN_L1_EVENTS "{slots,topdown-retiring,topdown-bad-spec,topdown-fe-bound,topdown-be-bound}"
8 #define TOPDOWN_L2_EVENTS "{slots,topdown-retiring,topdown-bad-spec,topdown-fe-bound,topdown-be-bound,topdown-heavy-ops,topdown-br-mispredict,topdown-fetch-lat,topdown-mem-bound}"
10 int arch_evlist__add_default_attrs(struct evlist *evlist)
12 if (!pmu_have_event("cpu", "slots"))
15 if (pmu_have_event("cpu", "topdown-heavy-ops"))
16 return parse_events(evlist, TOPDOWN_L2_EVENTS, NULL);
18 return parse_events(evlist, TOPDOWN_L1_EVENTS, NULL);
21 struct evsel *arch_evlist__leader(struct list_head *list)
23 struct evsel *evsel, *first, *slots = NULL;
24 bool has_topdown = false;
26 first = list_first_entry(list, struct evsel, core.node);
28 if (!pmu_have_event("cpu", "slots"))
31 /* If there is a slots event and a topdown event then the slots event comes first. */
32 __evlist__for_each_entry(list, evsel) {
33 if (evsel->pmu_name && !strcmp(evsel->pmu_name, "cpu") && evsel->name) {
34 if (strcasestr(evsel->name, "slots")) {
39 if (!strncasecmp(evsel->name, "topdown", 7))
41 if (slots && has_topdown)