nrelease - fix/improve livecd
[dragonfly.git] / test / sysperf / lockmgr1.c
1 /*
2  * varsym..c
3  *
4  * varsym [threads]
5  *
6  * tests shared lock using varsym_get()
7  */
8
9 #include "blib.h"
10 #include <sys/varsym.h>
11
12 int
13 main(int ac, char **av)
14 {
15         long long count = 0;
16         long long max;
17         char c;
18         int n;
19         int i;
20         int j;
21         int status;
22         char buf[256];
23
24         printf("timing standard varsym_get() syscall, VARSYM_SYS\n");
25
26         start_timing();
27         while (stop_timing(0, NULL) == 0) {
28                 varsym_get(VARSYM_SYS_MASK, "fubar", buf, sizeof(buf));
29                 ++count;
30         }
31         max = count * 4;
32
33         if (ac > 1)
34                 n = strtol(av[1], NULL, 0);
35         else
36                 n = 1;
37
38         start_timing();
39         for (i = 0; i < n; ++i) {
40                 if (fork() == 0) {
41                         for (count = 0; count < max; ++count) {
42                                 varsym_get(VARSYM_SYS_MASK, "fubar",
43                                            buf, sizeof(buf));
44                         }
45                         _exit(0);
46                 }
47         }
48         while (wait3(&status, 0, NULL) >= 0 || errno == EINTR)
49                 ;
50         stop_timing(max * n, "varsym1");
51
52         return(0);
53 }