]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: initialize random number generator for bench-write
authorJosh Durgin <josh.durgin@inktank.com>
Sun, 31 Mar 2013 00:27:25 +0000 (17:27 -0700)
committerJosh Durgin <josh.durgin@inktank.com>
Mon, 1 Apr 2013 15:56:07 +0000 (08:56 -0700)
Without this, the same seed is used each time, so multiple runs
of bench-write with the same parameters have the same I/O pattern.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
src/rbd.cc

index d776ef018cdf6fbda6f50576172b63ff0849c9b6..453ab4ec8944e1eca9d92e64ee1f9ffff46b8cb2 100644 (file)
@@ -879,6 +879,8 @@ static int do_bench_write(librbd::Image& image, uint64_t io_size,
   if (pattern != "rand" && pattern != "seq")
     return -EINVAL;
 
+  srand(time(NULL) % (unsigned long) -1);
+
   bufferptr bp(io_size);
   memset(bp.c_str(), rand() & 0xff, io_size);
   bufferlist bl;