# Pastebin crO3zEhX #include #include #include #include #ifdef __HAIKU__ #define TEST_SYSCALL() _kern_is_computer_on() #else #include #define TEST_SYSCALL() syscall(__NR_getuid) #endif #define TEST_COUNT 1000000 int main(int argc, char **argv) { struct timespec tp, t1; uint64_t delta = 0; // warm-up clock_gettime(CLOCK_MONOTONIC, &t1); for (int i = 0; i < TEST_COUNT; i++) { TEST_SYSCALL(); } clock_gettime(CLOCK_MONOTONIC, &tp); clock_gettime(CLOCK_MONOTONIC, &t1); for (int i = 0; i < TEST_COUNT; i++) { TEST_SYSCALL(); } clock_gettime(CLOCK_MONOTONIC, &tp); delta += (1000000000 * tp.tv_sec + tp.tv_nsec) - (1000000000 * t1.tv_sec + t1.tv_nsec); printf("avg: %fns\n", (double) delta / TEST_COUNT); return 0; }