drm - Fix memory leak in broadwell or later GPUs
[dragonfly.git] / test / sysperf / syscall1.c
blobba623d106d20e01915f04bdb439a7e855a827d0e
1 /*
2 * syscall1.c
4 * N thread getuid timing test (default 1)
5 */
7 #include "blib.h"
9 int
10 main(int ac, char **av)
12 long long count = 0;
13 long long max;
14 char c;
15 int n;
16 int i;
17 int j;
18 int status;
20 printf("timing standard getuid() syscall, single thread\n");
21 printf("if using powerd, run several times\n");
23 start_timing();
24 while (stop_timing(0, NULL) == 0) {
25 for (j = 0; j < 100; ++j)
26 getuid();
27 count += 100;
29 max = count;
31 if (ac > 1)
32 n = strtol(av[1], NULL, 0);
33 else
34 n = 1;
36 start_timing();
37 for (i = 0; i < n; ++i) {
38 if (fork() == 0) {
39 for (count = 0; count < max; count += 100) {
40 for (j = 0; j < 100; ++j)
41 getuid();
43 _exit(0);
46 while (wait3(&status, 0, NULL) >= 0 || errno == EINTR)
48 stop_timing(count * n, "getuid()");
50 return(0);