at v6.19 31 lines 514 B view raw
1// SPDX-License-Identifier: GPL-2.0 2#include <stdlib.h> 3#include "../tests.h" 4 5#define BENCH_RUNS 999999 6 7#ifdef __aarch64__ 8static void trap_bench(void) 9{ 10 unsigned long val; 11 12 asm("mrs %0, ID_AA64ISAR0_EL1" : "=r" (val)); /* TRAP + ERET */ 13} 14#else 15static void trap_bench(void) { } 16#endif 17 18static int traploop(int argc, const char **argv) 19{ 20 int num_loops = BENCH_RUNS; 21 22 if (argc > 0) 23 num_loops = atoi(argv[0]); 24 25 for (int i = 0; i < num_loops; i++) 26 trap_bench(); 27 28 return 0; 29} 30 31DEFINE_WORKLOAD(traploop);