summaryrefslogtreecommitdiff
path: root/lib/zipf.h
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2012-11-06 10:49:42 +0100
committerJens Axboe <axboe@kernel.dk>2012-11-06 10:49:42 +0100
commite25839d4cb5fefcb5ffce76128a4faedb177e7af (patch)
tree7082c9f9ab2c18c3092effaf74dfd10c22d3b221 /lib/zipf.h
parent155015351132ad00e2e21cb63f52fee91e56e92a (diff)
downloadfio-e25839d4cb5fefcb5ffce76128a4faedb177e7af.tar.gz
fio-e25839d4cb5fefcb5ffce76128a4faedb177e7af.tar.bz2
Add sample zipf distribution randomizer
Instead of just doing purely random IO where each block is touched exactly (or close to, depending on random map) once, add a zipf distribution scheme where a selectable theta defines the spread and frequency of blocks read/written. Committing this so I don't lose it. Needs a few changes, for instance we need to hash the zipf output so that the spread doesn't always just favor the lower LBA range. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'lib/zipf.h')
-rw-r--r--lib/zipf.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/zipf.h b/lib/zipf.h
new file mode 100644
index 00000000..6578ef1c
--- /dev/null
+++ b/lib/zipf.h
@@ -0,0 +1,17 @@
+#ifndef FIO_ZIPF_H
+#define FIO_ZIPF_H
+
+#include "rand.h"
+
+struct zipf_state {
+ uint64_t nranges;
+ double theta;
+ double zeta2;
+ double zetan;
+ struct frand_state rand;
+};
+
+void zipf_init(struct zipf_state *zs, unsigned long nranges, double theta);
+unsigned long long zipf_next(struct zipf_state *zs);
+
+#endif