topdown.c (cbecf716ca618fd44feda6bd9a64a8179d031fc5) topdown.c (e0e14cdff31d326f81e0edbd5140f788c870756c)
1// SPDX-License-Identifier: GPL-2.0
2#include <stdio.h>
3#include "api/fs/fs.h"
4#include "util/pmu.h"
5#include "util/topdown.h"
1// SPDX-License-Identifier: GPL-2.0
2#include <stdio.h>
3#include "api/fs/fs.h"
4#include "util/pmu.h"
5#include "util/topdown.h"
6#include "topdown.h"
6
7
8/* Check whether there is a PMU which supports the perf metrics. */
9bool topdown_sys_has_perf_metrics(void)
10{
11 static bool has_perf_metrics;
12 static bool cached;
13 struct perf_pmu *pmu;
14
15 if (cached)
16 return has_perf_metrics;
17
18 /*
19 * The perf metrics feature is a core PMU feature.
20 * The PERF_TYPE_RAW type is the type of a core PMU.
21 * The slots event is only available when the core PMU
22 * supports the perf metrics feature.
23 */
24 pmu = perf_pmu__find_by_type(PERF_TYPE_RAW);
25 if (pmu && pmu_have_event(pmu->name, "slots"))
26 has_perf_metrics = true;
27
28 cached = true;
29 return has_perf_metrics;
30}
31
7/*
8 * Check whether we can use a group for top down.
9 * Without a group may get bad results due to multiplexing.
10 */
11bool arch_topdown_check_group(bool *warn)
12{
13 int n;
14

--- 49 unchanged lines hidden ---
32/*
33 * Check whether we can use a group for top down.
34 * Without a group may get bad results due to multiplexing.
35 */
36bool arch_topdown_check_group(bool *warn)
37{
38 int n;
39

--- 49 unchanged lines hidden ---