diff --git a/src/tests/kernel/core/Jamfile b/src/tests/kernel/core/Jamfile index ed0cb51173..c46189c2c9 100644 --- a/src/tests/kernel/core/Jamfile +++ b/src/tests/kernel/core/Jamfile @@ -2,10 +2,20 @@ SubDir OBOS_TOP src tests kernel core ; UsePrivateHeaders kernel ; +if $(TARGET_PLATFORM) = r5 { + LIBROOT = root ; +} else { + LIBROOT = libroot.so ; +} + SimpleTest transfer_area_test : transfer_area_test.cpp : libroot.so ; +SimpleTest syscall_time : + syscall_time.cpp + : $(LIBROOT) ; + SubInclude OBOS_TOP src tests kernel core cache ; #SubInclude OBOS_TOP src tests kernel core disk_device_manager ; SubInclude OBOS_TOP src tests kernel core util ; diff --git a/src/tests/kernel/core/syscall_time.cpp b/src/tests/kernel/core/syscall_time.cpp new file mode 100644 index 0000000000..2d3541dea4 --- /dev/null +++ b/src/tests/kernel/core/syscall_time.cpp @@ -0,0 +1,45 @@ +/* + * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ + + +#include +#include + +#ifdef __HAIKU__ +# include +#else +extern "C" void _kclose_(int fd); +#endif + + +int +main(int argc, char **argv) +{ + const int32 loops = 100000; + bigtime_t startTime = system_time(); + + for (int32 i = 0; i < loops; i++) { +#ifdef __HAIKU__ +// _kern_null(); + _kern_close(-1); +#else + _kclose_(-1); +#endif + } + + bigtime_t runTime = system_time() - startTime; + + // empty loop time + + startTime = system_time(); + + for (int32 i = 0; i < loops; i++) + ; + + runTime -= system_time() - startTime; + + printf("%f usecs/syscall\n", 1.0 * runTime / loops); + return 0; +}