kernel: Replace the remaining __amd64__ with __x86_64__ for consistency.
[dragonfly.git] / test / sysperf / call3.c
blobdea220bced4871965c4e2250845e50a8f635e637
1 /*
2 * call3.c
4 * Test a standard function call to a function which does nothing much.
6 * $DragonFly: src/test/sysperf/call3.c,v 1.3 2005/08/02 17:11:04 hmp Exp $
7 */
9 #include "blib.h"
11 #define LOOP 500000000
13 __asm(".p2align 6");
14 static void xnop1(void) { }
15 __asm(".p2align 6");
16 static void xnop2(void) { }
17 __asm(".p2align 6");
18 static void xnop(void (*func)(void)) { func(); }
20 int
21 main(int ac, char **av)
23 int i;
25 printf("call nop() function through function pointer in loop\n");
26 start_timing();
27 for (i = 0; i < LOOP; ++i) {
28 xnop(xnop1);
29 xnop(xnop1);
31 stop_timing(LOOP * 2, "call3/nop1-1");
32 start_timing();
33 for (i = 0; i < LOOP; ++i) {
34 xnop(xnop1);
35 xnop(xnop2);
37 stop_timing(LOOP * 2, "call3/nop1-2");
38 start_timing();
39 for (i = 0; i < LOOP; ++i) {
40 xnop(xnop2);
41 xnop(xnop2);
43 stop_timing(LOOP * 2, "call3/nop2-2");
44 return(0);