1 /* 2 * call3.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.3 2005/08/02 17:11:04 hmp Exp $ 7 */ 8 9 #include "blib.h" 10 11 #define LOOP 500000000 12 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(); } 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 xnop(xnop1); 29 xnop(xnop1); 30 } 31 stop_timing(LOOP * 2, "call3/nop1-1"); 32 start_timing(); 33 for (i = 0; i < LOOP; ++i) { 34 xnop(xnop1); 35 xnop(xnop2); 36 } 37 stop_timing(LOOP * 2, "call3/nop1-2"); 38 start_timing(); 39 for (i = 0; i < LOOP; ++i) { 40 xnop(xnop2); 41 xnop(xnop2); 42 } 43 stop_timing(LOOP * 2, "call3/nop2-2"); 44 return(0); 45 } 46 47