diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2012-04-15 06:01:44 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2012-04-15 06:01:44 +0200 |
commit | 133aa259230f293e59b8b013f9fd2ac8b1c03b05 (patch) | |
tree | 44ca4ebf737b72d22f0f89711221614bb4f020c3 | |
parent | 434198173720c2e8f5c79e8c00790b250e5a1942 (diff) | |
download | fwbench-133aa259230f293e59b8b013f9fd2ac8b1c03b05.tar.gz fwbench-133aa259230f293e59b8b013f9fd2ac8b1c03b05.tar.bz2 fwbench-133aa259230f293e59b8b013f9fd2ac8b1c03b05.tar.xz fwbench-133aa259230f293e59b8b013f9fd2ac8b1c03b05.zip |
Use O_DIRECT mode in seqreader
-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 |