Tweak the context data a bit and do some code cleanup. Save %edx as well
[dragonfly.git] / test / sysperf / loop2.c
1 /*
2  * loop2.c
3  *
4  * Used as a helper to test AST delivery.  Loops in user mode for a few
5  * seconds.  This one forks and runs the loop in two processes.
6  *
7  * $DragonFly: src/test/sysperf/loop2.c,v 1.1 2003/08/12 02:29:44 dillon Exp $
8  */
9
10 #include "blib.h"
11
12 #define LOOP 100000000
13
14 static void nop() { }
15
16 int
17 main(int ac, char **av)
18 {
19     int i;
20     pid_t pid;
21
22     printf("SMP contention, userland-only loop, duel-forks.  Run just one\n");
23
24     start_timing();
25     if (fork() == 0) {
26         for (i = 0; i < LOOP; ++i)
27             nop();
28         _exit(1);
29     } else {
30         for (i = 0; i < LOOP; ++i)
31             nop();
32         while (wait(NULL) > 0);
33         stop_timing(LOOP, "loop2/2xfork");
34     }
35     return(0);
36 }
37