5 struct timeval tp1,tp2;
7 static void start_timer()
9 gettimeofday(&tp1,NULL);
12 static double end_timer()
14 gettimeofday(&tp2,NULL);
15 return((tp2.tv_sec - tp1.tv_sec) +
16 (tp2.tv_usec - tp1.tv_usec)*1.0e-6);
22 int main(int argc, char *argv[])
24 char *fname = argv[1];
28 fd = open(fname,O_RDONLY);
37 ret = read(fd, buf, sizeof(buf));
39 lseek(fd, 0, SEEK_SET);
42 printf("%g MB/sec\n", count*ret/(1.0e6*end_timer()));