Add pareto distribution randomizer
[fio.git] / options.c
index 05a6a5081fa576810c9071506e634077ec27a401..ea1ffb13dd8bf95dd0f8c0bb1bbb0a8f257921c0 100644 (file)
--- a/options.c
+++ b/options.c
@@ -734,19 +734,25 @@ static int str_random_distribution_cb(void *data, const char *str)
        double val;
        char *nr;
 
-       if (td->o.random_distribution == FIO_RAND_DIST_RANDOM)
+       if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
+               val = 1.1;
+       else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
+               val = 0.2;
+       else
                return 0;
 
        nr = get_opt_postfix(str);
-       if (!nr)
-               val = 0.6;
-       else if (!str_to_float(nr, &val)) {
+       if (nr && !str_to_float(nr, &val)) {
                log_err("fio: random postfix parsing failed\n");
                free(nr);
                return 1;
        }
 
-       td->o.zipf_theta = val;
+       if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
+               td->o.zipf_theta = val;
+       else
+               td->o.pareto_h = val;
+
        free(nr);
        return 0;
 }
@@ -1511,6 +1517,10 @@ static struct fio_option options[FIO_MAX_OPTS] = {
                            .oval = FIO_RAND_DIST_ZIPF,
                            .help = "Zipf distribution",
                          },
+                         { .ival = "pareto",
+                           .oval = FIO_RAND_DIST_PARETO,
+                           .help = "Pareto distribution",
+                         },
                },
        },
        {