Skip to content

Commit e74dd9c

Browse files
captain5050acmel
authored andcommitted
perf test: TSC test, remove is_supported use
Migrate the is_supported functionality to returning TEST_SKIP. Motivation is kunit has no is_supported function. Signed-off-by: Ian Rogers <[email protected]> Tested-by: Sohaib Mohamed <[email protected]> Acked-by: Jiri Olsa <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Brendan Higgins <[email protected]> Cc: Daniel Latypov <[email protected]> Cc: David Gow <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jin Yao <[email protected]> Cc: John Garry <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 4935e2c commit e74dd9c

File tree

1 file changed

+16
-23
lines changed

1 file changed

+16
-23
lines changed

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

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@
2323
#include "pmu.h"
2424
#include "pmu-hybrid.h"
2525

26+
/*
27+
* Except x86_64/i386 and Arm64, other archs don't support TSC in perf. Just
28+
* enable the test for x86_64/i386 and Arm64 archs.
29+
*/
30+
#if defined(__x86_64__) || defined(__i386__) || defined(__aarch64__)
31+
#define TSC_IS_SUPPORTED 1
32+
#else
33+
#define TSC_IS_SUPPORTED 0
34+
#endif
35+
2636
#define CHECK__(x) { \
2737
while ((x) < 0) { \
2838
pr_debug(#x " failed!\n"); \
@@ -69,6 +79,11 @@ static int test__perf_time_to_tsc(struct test_suite *test __maybe_unused, int su
6979
u64 test_time, comm1_time = 0, comm2_time = 0;
7080
struct mmap *md;
7181

82+
if (!TSC_IS_SUPPORTED) {
83+
pr_debug("Test not supported on this architecture");
84+
return TEST_SKIP;
85+
}
86+
7287
threads = thread_map__new(-1, getpid(), UINT_MAX);
7388
CHECK_NOT_NULL__(threads);
7489

@@ -185,26 +200,4 @@ static int test__perf_time_to_tsc(struct test_suite *test __maybe_unused, int su
185200
return err;
186201
}
187202

188-
static bool test__tsc_is_supported(void)
189-
{
190-
/*
191-
* Except x86_64/i386 and Arm64, other archs don't support TSC in perf.
192-
* Just enable the test for x86_64/i386 and Arm64 archs.
193-
*/
194-
#if defined(__x86_64__) || defined(__i386__) || defined(__aarch64__)
195-
return true;
196-
#else
197-
return false;
198-
#endif
199-
}
200-
201-
static struct test_case perf_time_to_tsc_tests[] = {
202-
TEST_CASE("Convert perf time to TSC", perf_time_to_tsc),
203-
{ .name = NULL, }
204-
};
205-
206-
struct test_suite suite__perf_time_to_tsc = {
207-
.desc = "Convert perf time to TSC",
208-
.test_cases = perf_time_to_tsc_tests,
209-
.is_supported = test__tsc_is_supported,
210-
};
203+
DEFINE_SUITE("Convert perf time to TSC", perf_time_to_tsc);

0 commit comments

Comments
 (0)