Lines Matching refs:evsel

5 #include "evsel.h"
10 static bool test_config(const struct evsel *evsel, __u64 expected_config)
12 return (evsel->core.attr.config & PERF_HW_EVENT_MASK) == expected_config;
15 static bool test_perf_config(const struct perf_evsel *evsel, __u64 expected_config)
17 return (evsel->attr.config & PERF_HW_EVENT_MASK) == expected_config;
20 static bool test_hybrid_type(const struct evsel *evsel, __u64 expected_config)
22 return (evsel->core.attr.config >> PERF_PMU_TYPE_SHIFT) == expected_config;
27 struct evsel *evsel = evlist__first(evlist);
30 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
31 TEST_ASSERT_VAL("wrong hybrid type", test_hybrid_type(evsel, PERF_TYPE_RAW));
32 TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
38 struct evsel *evsel, *leader;
40 evsel = leader = evlist__first(evlist);
42 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
43 TEST_ASSERT_VAL("wrong hybrid type", test_hybrid_type(evsel, PERF_TYPE_RAW));
44 TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
45 TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
47 evsel = evsel__next(evsel);
48 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
49 TEST_ASSERT_VAL("wrong hybrid type", test_hybrid_type(evsel, PERF_TYPE_RAW));
50 TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_BRANCH_INSTRUCTIONS));
51 TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
57 struct evsel *evsel, *leader;
59 evsel = leader = evlist__first(evlist);
61 TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type);
62 TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
64 evsel = evsel__next(evsel);
65 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
66 TEST_ASSERT_VAL("wrong hybrid type", test_hybrid_type(evsel, PERF_TYPE_RAW));
67 TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
68 TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
74 struct evsel *evsel, *leader;
76 evsel = leader = evlist__first(evlist);
78 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
79 TEST_ASSERT_VAL("wrong hybrid type", test_hybrid_type(evsel, PERF_TYPE_RAW));
80 TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
81 TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
83 evsel = evsel__next(evsel);
84 TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type);
85 TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
91 struct evsel *evsel, *leader;
93 evsel = leader = evlist__first(evlist);
95 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
96 TEST_ASSERT_VAL("wrong hybrid type", test_hybrid_type(evsel, PERF_TYPE_RAW));
97 TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
98 TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
99 TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
100 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
102 evsel = evsel__next(evsel);
103 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
104 TEST_ASSERT_VAL("wrong hybrid type", test_hybrid_type(evsel, PERF_TYPE_RAW));
105 TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_BRANCH_INSTRUCTIONS));
106 TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
107 TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
108 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
114 struct perf_evsel *evsel;
116 perf_evlist__for_each_evsel(&evlist->core, evsel) {
117 struct perf_pmu *pmu = perf_pmus__find_by_type(evsel->attr.type);
121 TEST_ASSERT_VAL("wrong config", test_perf_config(evsel, 0x1a));
128 struct evsel *evsel = evlist__first(evlist);
131 TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
132 TEST_ASSERT_VAL("wrong config", test_config(evsel, 0x1a));
138 struct evsel *evsel = evlist__first(evlist);
141 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HW_CACHE == evsel->core.attr.type);
142 TEST_ASSERT_VAL("wrong config", 0x2 == (evsel->core.attr.config & 0xffffffff));
149 struct evsel *evsel = evlist__first(evlist);
152 TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
153 TEST_ASSERT_VAL("wrong config", 10 == evsel->core.attr.config);
154 TEST_ASSERT_VAL("wrong config1", 1 == evsel->core.attr.config1);
155 TEST_ASSERT_VAL("wrong config2", 3 == evsel->core.attr.config2);
156 TEST_ASSERT_VAL("wrong config3", 0 == evsel->core.attr.config3);
161 TEST_ASSERT_VAL("wrong period", 0 == evsel->core.attr.sample_period);
168 struct evsel *evsel, *leader;
170 evsel = leader = evlist__first(evlist);
172 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
173 TEST_ASSERT_VAL("wrong hybrid type", test_hybrid_type(evsel, PERF_TYPE_RAW));
174 TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
175 TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
177 evsel = evsel__next(evsel);
178 TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
179 TEST_ASSERT_VAL("wrong config", evsel->core.attr.config == 0x3c);
180 TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));