hybrid.c (dd64647ecbba7572e41489c9bc54980aeb434bc2) hybrid.c (1eaf496ed386934f1c2439a120fe84a05194f91a)
1// SPDX-License-Identifier: GPL-2.0
2#include "arch-tests.h"
3#include "debug.h"
4#include "evlist.h"
5#include "evsel.h"
6#include "pmu.h"
1// SPDX-License-Identifier: GPL-2.0
2#include "arch-tests.h"
3#include "debug.h"
4#include "evlist.h"
5#include "evsel.h"
6#include "pmu.h"
7#include "pmus.h"
7#include "tests/tests.h"
8
9static bool test_config(const struct evsel *evsel, __u64 expected_config)
10{
11 return (evsel->core.attr.config & PERF_HW_EVENT_MASK) == expected_config;
12}
13
14static bool test_perf_config(const struct perf_evsel *evsel, __u64 expected_config)

--- 93 unchanged lines hidden (view full) ---

108 return TEST_OK;
109}
110
111static int test__hybrid_raw1(struct evlist *evlist)
112{
113 struct perf_evsel *evsel;
114
115 perf_evlist__for_each_evsel(&evlist->core, evsel) {
8#include "tests/tests.h"
9
10static bool test_config(const struct evsel *evsel, __u64 expected_config)
11{
12 return (evsel->core.attr.config & PERF_HW_EVENT_MASK) == expected_config;
13}
14
15static bool test_perf_config(const struct perf_evsel *evsel, __u64 expected_config)

--- 93 unchanged lines hidden (view full) ---

109 return TEST_OK;
110}
111
112static int test__hybrid_raw1(struct evlist *evlist)
113{
114 struct perf_evsel *evsel;
115
116 perf_evlist__for_each_evsel(&evlist->core, evsel) {
116 struct perf_pmu *pmu = perf_pmu__find_by_type(evsel->attr.type);
117 struct perf_pmu *pmu = perf_pmus__find_by_type(evsel->attr.type);
117
118 TEST_ASSERT_VAL("missing pmu", pmu);
119 TEST_ASSERT_VAL("unexpected pmu", !strncmp(pmu->name, "cpu_", 4));
120 TEST_ASSERT_VAL("wrong config", test_perf_config(evsel, 0x1a));
121 }
122 return TEST_OK;
123}
124

--- 150 unchanged lines hidden (view full) ---

275 }
276 }
277
278 return ret;
279}
280
281int test__hybrid(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
282{
118
119 TEST_ASSERT_VAL("missing pmu", pmu);
120 TEST_ASSERT_VAL("unexpected pmu", !strncmp(pmu->name, "cpu_", 4));
121 TEST_ASSERT_VAL("wrong config", test_perf_config(evsel, 0x1a));
122 }
123 return TEST_OK;
124}
125

--- 150 unchanged lines hidden (view full) ---

276 }
277 }
278
279 return ret;
280}
281
282int test__hybrid(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
283{
283 if (!perf_pmu__has_hybrid())
284 if (!perf_pmus__has_hybrid())
284 return TEST_SKIP;
285
286 return test_events(test__hybrid_events, ARRAY_SIZE(test__hybrid_events));
287}
285 return TEST_SKIP;
286
287 return test_events(test__hybrid_events, ARRAY_SIZE(test__hybrid_events));
288}