Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Apr 9, 2015

Subsystems (2)
lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit 16ada7542f32b38c1189390a97b595948079b100:

sg: don't return success if non bdev/char is used (2015-03-31 13:41:18 -0600)

are available in the git repository at:

git://git.kernel.dk/fio.git master

for you to fetch changes up to 87f5fce38c1b8fc979cea10c926973c2f2a76217:

genzip: switch to jenkins hash (2015-04-08 16:25:49 -0600)

----------------------------------------------------------------
Fabrice Bacchella (1):
fio-genzipf results output are slightly wrong, it doesn't help to understand how to use it: * The last row was not displayed * some useless variables were used * the calculation for the output table missed a few events, so the sum of 'No Hits' column was wrong * Wrong sample in genzipf.c header, used old style arguments * the help message for -o options was misleading. * useless define of DEF_NR. * default of default row number to a more common value of 20, instead of 23.

Jens Axboe (8):
Add support for normal/gaussian random distributions Merge branch 'master' of ssh://git.kernel.dk/data/git/fio Make normal distribution takes deviations as a percentage
genzipf: add support for normal distribution
genzip: add summed hit percentages
genzip: cleanups
Unify gauss and zipf/pareto input values
genzip: switch to jenkins hash

 Makefile         |    4 +-
 cconv.c          |    2 +
 file.h           |    6 +-
 filesetup.c      |    4 +-
 fio.h            |    1 +
 io_u.c           |   11 +++
 lib/gauss.c      |   56 ++++++++++++
 lib/gauss.h      |   17 ++++
 options.c        |   14 ++-
 t/genzipf.c      |  251 ++++++++++++++++++++++++++++++------------------------
 thread_options.h |    3 +
 11 files changed, 252 insertions(+), 117 deletions(-)
 create mode 100644 lib/gauss.c
 create mode 100644 lib/gauss.h

---

Diff of recent changes:

Makefile +2 -2
index 52e515b..50f7468 100644
@@ -36,7 +36,7 @@ SOURCE := gettime.c ioengines.c init.c stat.c log.c time.c filesetup.c \
 		lib/lfsr.c gettime-thread.c helpers.c lib/flist_sort.c \
 		lib/hweight.c lib/getrusage.c idletime.c td_error.c \
 		profiles/tiobench.c profiles/act.c io_u_queue.c filelock.c \
-		lib/tp.c lib/bloom.c
+		lib/tp.c lib/bloom.c lib/gauss.c
 
 ifdef CONFIG_LIBHDFS
   HDFSFLAGS= -I $(JAVA_HOME)/include -I $(JAVA_HOME)/include/linux -I $(FIO_LIBHDFS_INCLUDE)
@@ -182,7 +182,7 @@ T_IEEE_OBJS += lib/ieee754.o
 T_IEEE_PROGS = t/ieee754
 
 T_ZIPF_OBS = t/genzipf.o
-T_ZIPF_OBJS += t/log.o lib/ieee754.o lib/rand.o lib/zipf.o t/genzipf.o
+T_ZIPF_OBJS += t/log.o lib/ieee754.o lib/rand.o lib/zipf.o lib/gauss.o t/genzipf.o
 T_ZIPF_PROGS = t/fio-genzipf
 
 T_AXMAP_OBJS = t/axmap.o
cconv.c +2 -0
index 0fca764..68f119f 100644
@@ -165,6 +165,7 @@ void convert_thread_options_to_cpu(struct thread_options *o,
 	o->random_distribution = le32_to_cpu(top->random_distribution);
 	o->zipf_theta.u.f = fio_uint64_to_double(le64_to_cpu(top->zipf_theta.u.i));
 	o->pareto_h.u.f = fio_uint64_to_double(le64_to_cpu(top->pareto_h.u.i));
+	o->gauss_dev.u.f = fio_uint64_to_double(le64_to_cpu(top->gauss_dev.u.i));
 	o->random_generator = le32_to_cpu(top->random_generator);
 	o->hugepage_size = le32_to_cpu(top->hugepage_size);
 	o->rw_min_bs = le32_to_cpu(top->rw_min_bs);
@@ -339,6 +340,7 @@ void convert_thread_options_to_net(struct thread_options_pack *top,
 	top->random_distribution = cpu_to_le32(o->random_distribution);
 	top->zipf_theta.u.i = __cpu_to_le64(fio_double_to_uint64(o->zipf_theta.u.f));
 	top->pareto_h.u.i = __cpu_to_le64(fio_double_to_uint64(o->pareto_h.u.f));
+	top->gauss_dev.u.i = __cpu_to_le64(fio_double_to_uint64(o->gauss_dev.u.f));
 	top->random_generator = cpu_to_le32(o->random_generator);
 	top->hugepage_size = cpu_to_le32(o->hugepage_size);
 	top->rw_min_bs = cpu_to_le32(o->rw_min_bs);
file.h +5 -1
index fc47310..22ec742 100644
@@ -8,6 +8,7 @@
 #include "lib/zipf.h"
 #include "lib/axmap.h"
 #include "lib/lfsr.h"
+#include "lib/gauss.h"
 
 /*
  * The type of object we are working on
@@ -119,7 +120,10 @@ struct fio_file {
 	/*
 	 * Used for zipf random distribution
 	 */
-	struct zipf_state zipf;
+	union {
+		struct zipf_state zipf;
+		struct gauss_state gauss;
+	};
 
 	int references;
 	enum fio_file_flags flags;
filesetup.c +3 -1
index 0fb5589..09e877f 100644
@@ -998,8 +998,10 @@ static int __init_rand_distribution(struct thread_data *td, struct fio_file *f)
 
 	if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
 		zipf_init(&f->zipf, nranges, td->o.zipf_theta.u.f, seed);
-	else
+	else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
 		pareto_init(&f->zipf, nranges, td->o.pareto_h.u.f, seed);
+	else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
+		gauss_init(&f->gauss, nranges, td->o.gauss_dev.u.f, seed);
 
 	return 1;
 }
fio.h +1 -0
index f688084..0fb86ea 100644
@@ -649,6 +649,7 @@ enum {
 	FIO_RAND_DIST_RANDOM	= 0,
 	FIO_RAND_DIST_ZIPF,
 	FIO_RAND_DIST_PARETO,
+	FIO_RAND_DIST_GAUSS,
 };
 
 #define FIO_DEF_ZIPF		1.1
io_u.c +11 -0
index 975d242..1606512 100644
@@ -149,6 +149,15 @@ static int __get_next_rand_offset_pareto(struct thread_data *td,
 	return 0;
 }
 
+static int __get_next_rand_offset_gauss(struct thread_data *td,
+					struct fio_file *f, enum fio_ddir ddir,
+					uint64_t *b)
+{
+	*b = gauss_next(&f->gauss);
+	return 0;
+}
+
+
 static int flist_cmp(void *data, struct flist_head *a, struct flist_head *b)
 {
 	struct rand_off *r1 = flist_entry(a, struct rand_off, list);
@@ -166,6 +175,8 @@ static int get_off_from_method(struct thread_data *td, struct fio_file *f,
 		return __get_next_rand_offset_zipf(td, f, ddir, b);
 	else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
 		return __get_next_rand_offset_pareto(td, f, ddir, b);
+	else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
+		return __get_next_rand_offset_gauss(td, f, ddir, b);
 
 	log_err("fio: unknown random distribution: %d\n", td->o.random_distribution);
 	return 1;
lib/gauss.c new file +56 -0

56 lines not on this page · raw message

lib/gauss.h new file +17 -0
new file mode 100644
index 0000000..a76df3f
@@ -0,0 +1,17 @@
+#ifndef FIO_GAUSS_H
+#define FIO_GAUSS_H
+
+#include <inttypes.h>
+#include "rand.h"
+
+struct gauss_state {
+	struct frand_state r;
+	uint64_t nranges;
+	unsigned int stddev;
+};
+
+void gauss_init(struct gauss_state *gs, unsigned long nranges, double dev,
+		unsigned int seed);
+unsigned long long gauss_next(struct gauss_state *gs);
+
+#endif
options.c +13 -1
index 337fecd..95e0e0c 100644
@@ -718,6 +718,8 @@ static int str_random_distribution_cb(void *data, const char *str)
 		val = FIO_DEF_ZIPF;
 	else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
 		val = FIO_DEF_PARETO;
+	else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
+		val = 0.0;
 	else
 		return 0;
 
@@ -736,12 +738,18 @@ static int str_random_distribution_cb(void *data, const char *str)
 			return 1;
 		}
 		td->o.zipf_theta.u.f = val;
-	} else {
+	} else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
 		if (val <= 0.00 || val >= 1.00) {
 			log_err("fio: pareto input out of range (0 < input < 1.0)\n");
 			return 1;
 		}
 		td->o.pareto_h.u.f = val;
+	} 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.u.f = val;
 	}
 
 	return 0;
@@ -1875,6 +1883,10 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
 			    .oval = FIO_RAND_DIST_PARETO,
 			    .help = "Pareto distribution",
 			  },
+			  { .ival = "normal",
+			    .oval = FIO_RAND_DIST_GAUSS,
+			    .help = "Normal (gaussian) distribution",
+			  },
 		},
 		.category = FIO_OPT_C_IO,
 		.group	= FIO_OPT_G_RANDOM,
t/genzipf.c +139 -112

368 lines not on this page · raw message

thread_options.h +3 -0
index 5a2428a..ee1114d 100644
@@ -129,6 +129,7 @@ struct thread_options {
 
 	fio_fp64_t zipf_theta;
 	fio_fp64_t pareto_h;
+	fio_fp64_t gauss_dev;
 
 	unsigned int random_generator;
 
@@ -355,8 +356,10 @@ struct thread_options_pack {
 
 	uint32_t random_distribution;
 	uint32_t pad;
+
 	fio_fp64_t zipf_theta;
 	fio_fp64_t pareto_h;
+	fio_fp64_t gauss_dev;
 
 	uint32_t random_generator;