--- seeker.c 2007-12-18 02:38:33.000000000 +0100 +++ seekerNat.c 2007-12-18 02:38:27.000000000 +0100 @@ -16,6 +16,9 @@ int count; time_t start; +off64_t maxoffset=0; +off64_t minoffset=249994674176000; + void done() { time_t end; @@ -29,8 +32,8 @@ } if (count) { - printf(".\nResults: %d seeks/second, %.2f ms random access time\n", - count / TIMEOUT, 1000.0 * TIMEOUT / count); + printf(".\nResults: %d seeks/second, %.2f ms random access time (%lu < offsets < %lu)\n", + count / TIMEOUT, 1000.0 * TIMEOUT / count, minoffset, maxoffset); } exit(EXIT_SUCCESS); } @@ -47,12 +50,12 @@ { char buffer[BLOCKSIZE]; int fd, retval; - unsigned long numblocks; + unsigned long numblocks, numbytes; off64_t offset; setvbuf(stdout, NULL, _IONBF, 0); - printf("Seeker v2.0, 2007-01-15, " + printf("Seeker v2.0(Nat1), 2007-12-18, " "http://www.linuxinsight.com/how_fast_is_your_disk.html\n"); if (argc != 2) { @@ -60,13 +63,14 @@ exit(EXIT_SUCCESS); } - fd = open(argv[1], O_RDONLY); + fd = open(argv[1], O_RDONLY | O_LARGEFILE); handle("open", fd < 0); retval = ioctl(fd, BLKGETSIZE, &numblocks); handle("ioctl", retval == -1); - printf("Benchmarking %s [%luMB], wait %d seconds", - argv[1], numblocks / 2048, TIMEOUT); + numbytes=numblocks*BLOCKSIZE; + printf("Benchmarking %s [%lu blocks, %lu bytes, %lu GiB], wait %d seconds\n", + argv[1], numblocks, numbytes, numbytes/1000000000L, TIMEOUT); time(&start); srand(start); @@ -74,12 +78,21 @@ alarm(1); for (;;) { - offset = (off64_t) numblocks * random() / RAND_MAX; - retval = lseek64(fd, BLOCKSIZE * offset, SEEK_SET); + offset = (off64_t) ( (unsigned long) numbytes * (random() / (RAND_MAX + 1.0) )); + //printf("DEBUG: go %lu\n", offset); + retval = lseek64(fd, offset, SEEK_SET); handle("lseek64", retval == (off64_t) -1); retval = read(fd, buffer, BLOCKSIZE); handle("read", retval < 0); count++; + if (offset>maxoffset) + { + maxoffset=offset; + } + else if(offset