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>
diff --git a/parse.c b/parse.c
index 1a686e4..0bbb0b3 100644
--- a/parse.c
+++ b/parse.c
@@ -14,6 +14,7 @@
#include "parse.h"
#include "debug.h"
#include "options.h"
+#include "minmax.h"
static struct fio_option *fio_options;
extern unsigned int fio_get_kb_base(void *);
@@ -220,7 +221,7 @@
/*
* Convert string into a floating number. Return 1 for success and 0 otherwise.
*/
-static int str_to_float(const char *str, double *val)
+int str_to_float(const char *str, double *val)
{
return (1 == sscanf(str, "%lf", val));
}
@@ -505,7 +506,7 @@
o->maxlen);
return 1;
}
- if(!str_to_float(ptr, &uf)){
+ if (!str_to_float(ptr, &uf)){
log_err("not a floating point value: %s\n", ptr);
return 1;
}