1 // SPDX-License-Identifier: GPL-2.0
5 #include "util/topdown.h"
8 * Check whether we can use a group for top down.
9 * Without a group may get bad results due to multiplexing.
11 bool arch_topdown_check_group(bool *warn)
15 if (sysctl__read_int("kernel/nmi_watchdog", &n) < 0)
24 void arch_topdown_group_warn(void)
27 "nmi_watchdog enabled with topdown. May give wrong results.\n"
28 "Disable with echo 0 > /proc/sys/kernel/nmi_watchdog\n");
31 #define TOPDOWN_SLOTS 0x0400
33 static bool is_topdown_slots_event(struct evsel *counter)
35 if (!counter->pmu_name)
38 if (strcmp(counter->pmu_name, "cpu"))
41 if (counter->core.attr.config == TOPDOWN_SLOTS)
48 * Check whether a topdown group supports sample-read.
50 * Only Topdown metic supports sample-read. The slots
51 * event must be the leader of the topdown group.
54 bool arch_topdown_sample_read(struct evsel *leader)
56 if (!pmu_have_event("cpu", "slots"))
59 if (is_topdown_slots_event(leader))