19
27
size_t total_size = 0;
28
size_t last_write = 0;
25
printf("Usage: %s <directory> [skip]\n", argv[0]);
34
printf("Usage: %s <directory|device> [skip]\n", argv[0]);
38
if (!strstr(argv[0], "/dev/")) {
39
int fd = open(argv[1], O_RDONLY|O_NOATIME|O_LARGEFILE/*|O_DIRECT*/, 0);
41
printf("Unable to open device %s\n", argv[1]);
45
int size = BLOCK_SIZE;
47
gettimeofday(&start, NULL);
49
err = read(fd, buffer, size);
53
gettimeofday(&tv, NULL);
54
us = (tv.tv_sec - start.tv_sec) * 1000000 + (tv.tv_usec - start.tv_usec);
55
if ((us - last_write) > WRITE_INTERVAL * 1000000) {
57
printf("Reading: %s (%lu GB), Measured speed: %lu mB/s\n", argv[0], total_size / 1024 / 1024 / 1024, total_size / us);
59
err = read(fd, buffer, size);
32
71
SKIP = atoi(argv[2]);
34
printf("Skip %i\n", SKIP);
73
printf("Skip %zu\n", SKIP);
37
76
gettimeofday(&start, NULL);
38
77
for (run = 0; run < SKIP; run++) {
40
79
dir = opendir(".");
41
while (ent = readdir(dir)) {
80
while ((ent = readdir(dir))) {
44
83
if (((skip++)%SKIP) != run) continue;