From 211179bb75e04449fcde1446e2fc81a78ffa8eaa Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Sun, 19 Jun 2016 20:50:09 +0300 Subject: [PATCH] Randomize append order --- fsqual.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fsqual.cc b/fsqual.cc index 39e4048..976608d 100644 --- a/fsqual.cc +++ b/fsqual.cc @@ -15,6 +15,7 @@ #include #include #include +#include #include template @@ -50,12 +51,14 @@ void test_concurrent_append(io_context_t ioctx, int fd, unsigned iodepth, std::s auto iocbps = std::vector(iodepth); std::iota(iocbps.begin(), iocbps.end(), iocbs.data()); auto ioevs = std::vector(iodepth); + std::random_device random_device; while (completed < nr) { auto i = unsigned(0); while (initiated < nr && current_depth < iodepth) { io_prep_pwrite(&iocbs[i++], fd, buf, bufsize, bufsize*initiated++); ++current_depth; } + std::shuffle(iocbs.begin(), iocbs.begin() + i, random_device); if (i) { with_ctxsw_counting(ctxsw, [&] { io_submit(ioctx, i, iocbps.data()); -- 2.50.1