The recent file descriptor work is significant enough to deserve a
[dragonfly.git] / test / sysperf / call3.c
1 /*
2  * call1.c
3  *
4  * Test a standard function call to a function which does nothing much.
5  *
6  * $DragonFly: src/test/sysperf/call3.c,v 1.2 2004/03/20 02:04:28 dillon Exp $
7  */
8
9 #include "blib.h"
10
11 #define LOOP 500000000
12
13 __asm(".p2align 6");
14 static void nop1(void) { }
15 __asm(".p2align 6");
16 static void nop2(void) { }
17 __asm(".p2align 6");
18 static void nop(void (*func)(void)) { func(); }
19
20 int
21 main(int ac, char **av)
22 {
23     int i;
24
25     printf("call nop() function through function pointer in loop\n");
26     start_timing();
27     for (i = 0; i < LOOP; ++i) {
28         nop(nop1);
29         nop(nop1);
30     }
31     stop_timing(LOOP * 2, "call3/nop1-1");
32     start_timing();
33     for (i = 0; i < LOOP; ++i) {
34         nop(nop1);
35         nop(nop2);
36     }
37     stop_timing(LOOP * 2, "call3/nop1-2");
38     start_timing();
39     for (i = 0; i < LOOP; ++i) {
40         nop(nop2);
41         nop(nop2);
42     }
43     stop_timing(LOOP * 2, "call3/nop2-2");
44     return(0);
45 }
46