1 /* 2 * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include <OS.h> 8 #include <stdio.h> 9 10 #ifdef __HAIKU__ 11 # include <syscalls.h> 12 #else 13 extern "C" void _kclose_(int fd); 14 #endif 15 16 17 int 18 main(int argc, char **argv) 19 { 20 const int32 loops = 100000; 21 bigtime_t startTime = system_time(); 22 23 for (int32 i = 0; i < loops; i++) { 24 #ifdef __HAIKU__ 25 // _kern_null(); 26 _kern_close(-1); 27 #else 28 _kclose_(-1); 29 #endif 30 } 31 32 bigtime_t runTime = system_time() - startTime; 33 34 // empty loop time 35 36 startTime = system_time(); 37 38 for (int32 i = 0; i < loops; i++) 39 ; 40 41 runTime -= system_time() - startTime; 42 43 printf("%f usecs/syscall\n", 1.0 * runTime / loops); 44 return 0; 45 } 46