Pre-2.0 release, MFC firewire disk changes to properly detach SIMs.
[dragonfly.git] / test / sysperf / loop2.c
blob4aa356e77a8d12c32880238f17b51d665def3ba7
1 /*
2 * loop2.c
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.
7 * $DragonFly: src/test/sysperf/loop2.c,v 1.2 2006/04/22 22:32:52 dillon Exp $
8 */
10 #include "blib.h"
12 #define LOOP 1000000
13 #define INNER 100
15 int
16 main(int ac, char **av)
18 int i;
19 int j;
20 int count = LOOP;
21 pid_t pid;
23 if (ac > 1)
24 count = strtoul(av[1], NULL, 0);
26 printf("SMP contention, userland-only loop, duel-forks. Run just one\n");
28 start_timing();
29 if (fork() == 0) {
30 for (i = count; i > 0; --i) {
31 for (j = INNER; j > 0; --j)
32 nop();
34 _exit(1);
35 } else {
36 for (i = count; i > 0; --i) {
37 for (j = INNER; j > 0; --j)
38 nop();
40 while (wait(NULL) > 0)
42 stop_timing(LOOP, "loop2/2xfork");
44 return(0);