Skip to content

Commit ec5257d

Browse files
captain5050acmel
authored andcommitted
perf x86 test: Add hybrid test for conflicting legacy/sysfs event
The cpu-cycles event is both a legacy event and declared in /sys/devices/cpu_core/events/cpu-cycles. The cycles event is a legacy event but with no sysfs version. Add a test that the sysfs version is preferred to the legacy for cpu-cycles, while for cycles we use the legacy version. Suggested-by: Kan Liang <[email protected]> Signed-off-by: Ian Rogers <[email protected]> Tested-by: Arnaldo Carvalho de Melo <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent eb00697 commit ec5257d

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tools/perf/arch/x86/tests/hybrid.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,24 @@ static int test__checkevent_pmu(struct evlist *evlist)
163163
return TEST_OK;
164164
}
165165

166+
static int test__hybrid_hw_group_event_2(struct evlist *evlist)
167+
{
168+
struct evsel *evsel, *leader;
169+
170+
evsel = leader = evlist__first(evlist);
171+
TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
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));
176+
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));
181+
return TEST_OK;
182+
}
183+
166184
struct evlist_test {
167185
const char *name;
168186
bool (*valid)(void);
@@ -215,6 +233,11 @@ static const struct evlist_test test__hybrid_events[] = {
215233
.check = test__hybrid_cache_event,
216234
/* 8 */
217235
},
236+
{
237+
.name = "{cpu_core/cycles/,cpu_core/cpu-cycles/}",
238+
.check = test__hybrid_hw_group_event_2,
239+
/* 9 */
240+
},
218241
};
219242

220243
static int test_event(const struct evlist_test *e)

0 commit comments

Comments
 (0)