16dd7c9c5SMatthew Dillon /* 26dd7c9c5SMatthew Dillon * syscall1.c 36dd7c9c5SMatthew Dillon * 46dd7c9c5SMatthew Dillon * $DragonFly: src/test/sysperf/syscall4.c,v 1.1 2003/11/19 00:59:19 dillon Exp $ 56dd7c9c5SMatthew Dillon */ 66dd7c9c5SMatthew Dillon 76dd7c9c5SMatthew Dillon #include "blib.h" 86dd7c9c5SMatthew Dillon 96dd7c9c5SMatthew Dillon int main(int ac,char ** av)106dd7c9c5SMatthew Dillonmain(int ac, char **av) 116dd7c9c5SMatthew Dillon { 12*879d1a9eSMatthew Dillon const char *path; 136dd7c9c5SMatthew Dillon long long count = 0; 146dd7c9c5SMatthew Dillon long long max; 156dd7c9c5SMatthew Dillon struct stat st; 16*879d1a9eSMatthew Dillon int j; 176dd7c9c5SMatthew Dillon 186dd7c9c5SMatthew Dillon printf("timing standard stat() syscall\n"); 19*879d1a9eSMatthew Dillon if (ac > 1) 20*879d1a9eSMatthew Dillon path = av[1]; 21*879d1a9eSMatthew Dillon else 22*879d1a9eSMatthew Dillon path = "."; 236dd7c9c5SMatthew Dillon 246dd7c9c5SMatthew Dillon start_timing(); 256dd7c9c5SMatthew Dillon while (stop_timing(0, NULL) == 0) { 266dd7c9c5SMatthew Dillon for (j = 0; j < 100; ++j) 27*879d1a9eSMatthew Dillon stat(path, &st); 286dd7c9c5SMatthew Dillon count += 100; 296dd7c9c5SMatthew Dillon } 306dd7c9c5SMatthew Dillon max = count; 316dd7c9c5SMatthew Dillon start_timing(); 326dd7c9c5SMatthew Dillon for (count = 0; count < max; count += 100) { 336dd7c9c5SMatthew Dillon for (j = 0; j < 100; ++j) 34*879d1a9eSMatthew Dillon stat(path, &st); 356dd7c9c5SMatthew Dillon } 366dd7c9c5SMatthew Dillon stop_timing(count, "stat()"); 376dd7c9c5SMatthew Dillon return(0); 386dd7c9c5SMatthew Dillon } 396dd7c9c5SMatthew Dillon 40