Skip to content

Commit d9da6f7

Browse files
Jin Yaoacmel
authored andcommitted
perf tests: Support 'Convert perf time to TSC' test for hybrid
Since for "cycles:u' on hybrid platform, it creates two "cycles". So the second evsel in evlist also needs initialization. With this patch, # ./perf test 71 71: Convert perf time to TSC : Ok Signed-off-by: Jin Yao <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Kan Liang <[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 c102038 commit d9da6f7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tools/perf/tests/perf-time-to-tsc.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "tsc.h"
2121
#include "mmap.h"
2222
#include "tests.h"
23+
#include "pmu.h"
2324

2425
#define CHECK__(x) { \
2526
while ((x) < 0) { \
@@ -88,6 +89,17 @@ int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybe
8889
evsel->core.attr.disabled = 1;
8990
evsel->core.attr.enable_on_exec = 0;
9091

92+
/*
93+
* For hybrid "cycles:u", it creates two events.
94+
* Init the second evsel here.
95+
*/
96+
if (perf_pmu__has_hybrid()) {
97+
evsel = evsel__next(evsel);
98+
evsel->core.attr.comm = 1;
99+
evsel->core.attr.disabled = 1;
100+
evsel->core.attr.enable_on_exec = 0;
101+
}
102+
91103
CHECK__(evlist__open(evlist));
92104

93105
CHECK__(evlist__mmap(evlist, UINT_MAX));

0 commit comments

Comments
 (0)