From 6f25cd6a9e7bd1127383892199753691e1b7d6d6 Mon Sep 17 00:00:00 2001 From: sageweil Date: Wed, 5 Dec 2007 22:55:38 +0000 Subject: [PATCH] short seek test git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@2178 29311d96-e01e-0410-9327-a35deaab8ce9 --- trunk/ceph/test/test_short_seek_read.c | 70 ++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 trunk/ceph/test/test_short_seek_read.c diff --git a/trunk/ceph/test/test_short_seek_read.c b/trunk/ceph/test/test_short_seek_read.c new file mode 100644 index 0000000000000..01e6999680047 --- /dev/null +++ b/trunk/ceph/test/test_short_seek_read.c @@ -0,0 +1,70 @@ +#include "include/types.h" +#include "common/Clock.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char **argv) +{ + char *fn = argv[1]; + + int fd = ::open(fn, O_RDWR|O_DIRECT);//|O_SYNC|O_DIRECT); + if (fd < 0) return 1; + + uint64_t bytes = 0; + int r = ioctl(fd, BLKGETSIZE64, &bytes); + uint64_t numblocks = bytes / 4096; + + //uint64_t numblocks = atoll(argv[2]) * 4;// / 4096; + int count = 400; + + cout << "fn " << fn << endl; + cout << "numblocks " << numblocks << endl; + + int blocks = 1; + while (blocks <= 1024) { + //cout << "fd is " << fd << endl; + + void *buf; + ::posix_memalign(&buf, 4096, 4096*blocks); + + int s = blocks*4096; + + double timeper = 0.0; + for (int i=0; i