From: Jens Axboe Date: Wed, 8 Apr 2015 17:24:58 +0000 (-0600) Subject: Make normal distribution takes deviations as a percentage X-Git-Tag: fio-2.2.7~7 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=3cdb8cf38198d5cea73074d427ae310320e1d65f;p=fio.git Make normal distribution takes deviations as a percentage This makes it independent of the address range generated. Signed-off-by: Jens Axboe --- diff --git a/lib/gauss.c b/lib/gauss.c index cd8b6e3e..5c3203c0 100644 --- a/lib/gauss.c +++ b/lib/gauss.c @@ -47,7 +47,9 @@ void gauss_init(struct gauss_state *gs, unsigned long nranges, unsigned int d, memset(gs, 0, sizeof(*gs)); init_rand_seed(&gs->r, seed); gs->nranges = nranges; - gs->stddev = d; - if (gs->stddev > nranges / 2) - gs->stddev = nranges / 2; + if (d) { + gs->stddev = (nranges * 100) / d; + if (gs->stddev > nranges / 2) + gs->stddev = nranges / 2; + } } diff --git a/options.c b/options.c index 1857d411..fbb291b7 100644 --- a/options.c +++ b/options.c @@ -744,8 +744,13 @@ static int str_random_distribution_cb(void *data, const char *str) return 1; } td->o.pareto_h.u.f = val; - } else + } else { + if (val <= 0.00 || val >= 100.0) { + log_err("fio: normal deviation out of range (0 < input < 100.0)\n"); + return 1; + } td->o.gauss_dev = val; + } return 0; }