summaryrefslogtreecommitdiff
path: root/lib/rand.h
diff options
context:
space:
mode:
authorJens Axboe <jaxboe@fusionio.com>2011-03-28 09:35:09 +0200
committerJens Axboe <jaxboe@fusionio.com>2011-03-28 09:35:09 +0200
commit2615cc4b28e7d0e436a625dff92e6a71ccc6c49b (patch)
treece47bafcfe149d32dd3ad4c89313f209eccb8c53 /lib/rand.h
parent55ed9636e82b8dee419b5a76c07098bff4d980b6 (diff)
downloadfio-2615cc4b28e7d0e436a625dff92e6a71ccc6c49b.tar.gz
Switch to using our internal Tausworthe based random generator for offsets
It's both faster and more exhaustive than what is available on glibc on my test systems. So no downsides, and the upside of having the same offset generator across all platforms. This will change the random series, so could alter performance for your workload since the pattern will be different in sequence. There's an option to revert to the OS generator, you can add use_us_rand=1 on your job files to retain the old generator offsets. Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'lib/rand.h')
-rw-r--r--lib/rand.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/rand.h b/lib/rand.h
index 02e68585..f80c111a 100644
--- a/lib/rand.h
+++ b/lib/rand.h
@@ -1,6 +1,8 @@
#ifndef FIO_RAND_H
#define FIO_RAND_H
+#define FRAND_MAX (-1U)
+
struct frand_state {
unsigned int s1, s2, s3;
};
@@ -19,6 +21,7 @@ static inline unsigned int __rand(struct frand_state *state)
}
extern void init_rand(struct frand_state *);
+extern void init_rand_seed(struct frand_state *, unsigned int seed);
extern void __fill_random_buf(void *buf, unsigned int len, unsigned long seed);
extern unsigned long fill_random_buf(void *buf, unsigned int len);