Added test for kernel crossing time
authorAndrew Waterman <waterman@ros-dev.(none)>
Fri, 9 Apr 2010 22:31:13 +0000 (15:31 -0700)
committerKevin Klues <klueska@cs.berkeley.edu>
Thu, 3 Nov 2011 00:35:41 +0000 (17:35 -0700)
tests/syscall_speed.c [new file with mode: 0644]

diff --git a/tests/syscall_speed.c b/tests/syscall_speed.c
new file mode 100644 (file)
index 0000000..7895732
--- /dev/null
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <parlib.h>
+#include <arch/arch.h>
+
+int main()
+{
+       int N = 8192;
+
+       long long tsc0 = read_tsc();
+       for(int i = 0; i < N; i++)
+               ros_syscall(SYS_null,0,0,0,0,0);
+       long long tsc1 = read_tsc();
+
+       printf("tsc0 = %lld\n",tsc0);
+       printf("syscall time = %lld\n",(tsc1-tsc0)/N);
+
+       return 0;
+}