diff options
Diffstat (limited to 'seqreader.c')
-rw-r--r-- | seqreader.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/seqreader.c b/seqreader.c index 68bcdca..f2128e2 100644 --- a/seqreader.c +++ b/seqreader.c @@ -11,8 +11,10 @@ #include <string.h> #include <errno.h> -#define BUFSIZE 65536 -#define BLOCK_SIZE 16384 +#define FASTWRITER_SYNCIO_ALIGN 512 + +#define BUFSIZE 2097152 +#define BLOCK_SIZE 2097152 #define WRITE_INTERVAL 1 @@ -29,16 +31,18 @@ int main(int argc, char *argv[]) { size_t skip; size_t run; ssize_t res; - char buffer[BUFSIZE]; + char *buffer;//[BUFSIZE]; long double mcoef = 1000000. / (1024 * 1024); + posix_memalign((void**)&buffer, FASTWRITER_SYNCIO_ALIGN, BUFSIZE); + if (argc < 2) { printf("Usage: %s <directory|device> [skip]\n", argv[0]); exit(0); } if (strstr(argv[1], "/dev/")) { - int fd = open(argv[1], O_RDONLY|O_NOATIME|O_LARGEFILE/*|O_DIRECT*/, 0); + int fd = open(argv[1], O_RDONLY|O_NOATIME|O_LARGEFILE|O_DIRECT, 0); if (fd < 0) { printf("Unable to open device %s\n", argv[1]); exit(1); @@ -72,6 +76,8 @@ int main(int argc, char *argv[]) { exit(-1); } + free(buffer); + return 0; } @@ -124,5 +130,7 @@ int main(int argc, char *argv[]) { } closedir(dir); } + + free(buffer); }
\ No newline at end of file |