From bee597ebfb94f22dad1c0c7ef78247222cdc2087 Mon Sep 17 00:00:00 2001 From: Travis Geiselbrecht Date: Sun, 4 Feb 2007 21:12:54 +0000 Subject: [PATCH] Rewrote the syscallbench app. It now will figure the overhead of a simple test loop, then the overhead of a call into libroot, and finally the overhead of a syscall (using is_computer_on). The numbers are totally abysmal right now. :( git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20070 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/system/benchmarks/syscallbench.c | 58 ++++++++++++++-------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/src/tests/system/benchmarks/syscallbench.c b/src/tests/system/benchmarks/syscallbench.c index 79f295efc3..fd4a7540df 100644 --- a/src/tests/system/benchmarks/syscallbench.c +++ b/src/tests/system/benchmarks/syscallbench.c @@ -9,7 +9,9 @@ #include #include -#define ITERATIONS 1000000 +#include + +#define ITERATIONS 500000 static void usage(void) @@ -18,34 +20,50 @@ usage(void) exit(1); } +static int null_func(void) +{ + return 0; +} + +static unsigned long test_func(int (*func)(void)) +{ + struct timeval before, after; + unsigned long elapsed; + int i; + + gettimeofday(&before, NULL); + for (i=0; i 1) usage(); - gettimeofday(&before, NULL); - for (i=0; i