From: Avi Kivity Date: Sun, 19 Jun 2016 17:50:09 +0000 (+0300) Subject: Randomize append order X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=211179bb75e04449fcde1446e2fc81a78ffa8eaa;p=users%2Fhch%2Ffsqual.git Randomize append order --- 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());