6 static struct timeval tp1,tp2;
10 gettimeofday(&tp1,NULL);
15 gettimeofday(&tp2,NULL);
16 return((tp2.tv_sec - tp1.tv_sec) +
17 (tp2.tv_usec - tp1.tv_usec)*1.0e-6);
22 const char *name1 = "test1.dat";
23 const char *name2 = "test2.dat";
26 fd = open(name1, O_CREAT|O_RDWR|O_TRUNC, 0644);
38 if (rename(name1, name2) != 0 ||
39 rename(name2, name1) != 0) {
44 if (end_timer() >= 1.0) {
45 printf("%.1f ops/sec\n", (2*ops) / end_timer());