xref: /dflybsd-src/test/sysperf/syscall7.c (revision be0376cc2e1b9c6fa70c63a5412197e1eb08d5c5)
1*179efaf0SMatthew Dillon /*
2*179efaf0SMatthew Dillon  * syscall1.c
3*179efaf0SMatthew Dillon  *
4*179efaf0SMatthew Dillon  * $DragonFly: src/test/sysperf/syscall5.c,v 1.1 2005/03/28 03:13:24 dillon Exp $
5*179efaf0SMatthew Dillon  */
6*179efaf0SMatthew Dillon 
7*179efaf0SMatthew Dillon #include "blib.h"
8*179efaf0SMatthew Dillon 
9*179efaf0SMatthew Dillon int
main(int ac,char ** av)10*179efaf0SMatthew Dillon main(int ac, char **av)
11*179efaf0SMatthew Dillon {
12*179efaf0SMatthew Dillon     long long count = 0;
13*179efaf0SMatthew Dillon     long long max;
14*179efaf0SMatthew Dillon     struct timespec ts;
15*179efaf0SMatthew Dillon     int j;
16*179efaf0SMatthew Dillon 
17*179efaf0SMatthew Dillon     printf("timing standard clock_gettime() syscall\n");
18*179efaf0SMatthew Dillon 
19*179efaf0SMatthew Dillon     start_timing();
20*179efaf0SMatthew Dillon     while (stop_timing(0, NULL) == 0) {
21*179efaf0SMatthew Dillon 	for (j = 0; j < 100; ++j)
22*179efaf0SMatthew Dillon 	    clock_gettime(CLOCK_REALTIME_FAST, &ts);
23*179efaf0SMatthew Dillon 	count += 100;
24*179efaf0SMatthew Dillon     }
25*179efaf0SMatthew Dillon     max = count;
26*179efaf0SMatthew Dillon     start_timing();
27*179efaf0SMatthew Dillon     for (count = 0; count < max; count += 100) {
28*179efaf0SMatthew Dillon 	for (j = 0; j < 100; ++j)
29*179efaf0SMatthew Dillon 	    clock_gettime(CLOCK_REALTIME_FAST, &ts);
30*179efaf0SMatthew Dillon     }
31*179efaf0SMatthew Dillon     stop_timing(count, "getuid()");
32*179efaf0SMatthew Dillon     return(0);
33*179efaf0SMatthew Dillon }
34