/alps/fwbench

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/fwbench

« back to all changes in this revision

Viewing changes to seqreader.c

  • Committer: Suren A. Chilingaryan
  • Date: 2012-04-15 04:01:44 UTC
  • Revision ID: csa@dside.dyndns.org-20120415040144-adpwnitwqr1sqttd
Use O_DIRECT mode in seqreader

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
#include <string.h>
12
12
#include <errno.h>
13
13
 
14
 
#define BUFSIZE 65536
15
 
#define BLOCK_SIZE 16384
 
14
#define FASTWRITER_SYNCIO_ALIGN 512
 
15
 
 
16
#define BUFSIZE 2097152
 
17
#define BLOCK_SIZE 2097152
16
18
#define WRITE_INTERVAL 1
17
19
 
18
20
 
29
31
    size_t skip;
30
32
    size_t run;
31
33
    ssize_t res;
32
 
    char buffer[BUFSIZE];
 
34
    char *buffer;//[BUFSIZE];
33
35
    long double mcoef = 1000000. / (1024 * 1024);
34
36
    
 
37
    posix_memalign((void**)&buffer, FASTWRITER_SYNCIO_ALIGN, BUFSIZE);
 
38
    
35
39
    if (argc < 2) {
36
40
        printf("Usage: %s <directory|device> [skip]\n", argv[0]);
37
41
        exit(0);
38
42
    }
39
43
    
40
44
    if (strstr(argv[1], "/dev/")) {
41
 
        int fd = open(argv[1], O_RDONLY|O_NOATIME|O_LARGEFILE/*|O_DIRECT*/, 0);
 
45
        int fd = open(argv[1], O_RDONLY|O_NOATIME|O_LARGEFILE|O_DIRECT, 0);
42
46
        if (fd < 0) {
43
47
            printf("Unable to open device %s\n", argv[1]);
44
48
            exit(1);
72
76
            exit(-1);
73
77
        }
74
78
 
 
79
        free(buffer);
 
80
        
75
81
        return 0;
76
82
    }
77
83
 
124
130
      }
125
131
      closedir(dir);
126
132
    }
 
133
    
 
134
    free(buffer);
127
135
 
128
136
}
 
 
b'\\ No newline at end of file'