#include <unistd.h>
#include "../lib/zipf.h"
+#include "../lib/gauss.h"
#include "../flist.h"
#include "../hash.h"
TYPE_NONE = 0,
TYPE_ZIPF,
TYPE_PARETO,
+ TYPE_NORMAL,
};
-static const char *dist_types[] = { "None", "Zipf", "Pareto" };
+static const char *dist_types[] = { "None", "Zipf", "Pareto", "Normal" };
static int dist_type = TYPE_ZIPF;
static unsigned long gb_size = 500;
printf("genzipf: test zipf/pareto values for fio input\n");
printf("\t-h\tThis help screen\n");
printf("\t-p\tGenerate size of data set that are hit by this percentage\n");
- printf("\t-t\tDistribution type (zipf or pareto)\n");
- printf("\t-i\tDistribution algorithm input (zipf theta or pareto power)\n");
+ printf("\t-t\tDistribution type (zipf, pareto, or normal)\n");
+ printf("\t-i\tDistribution algorithm input (zipf theta, pareto power,\n"
+ "\t\tor normal %% deviation)\n");
printf("\t-b\tBlock size of a given range (in bytes)\n");
printf("\t-g\tSize of data set (in gigabytes)\n");
printf("\t-o\tNumber of output rows\n");
dist_type = TYPE_ZIPF;
else if (!strncmp(optarg, "pareto", 6))
dist_type = TYPE_PARETO;
+ else if (!strncmp(optarg, "normal", 6))
+ dist_type = TYPE_NORMAL;
else {
printf("wrong dist type: %s\n", optarg);
return 1;
struct node *nodes;
double perc, perc_i;
struct zipf_state zs;
+ struct gauss_state gs;
if (parse_options(argc, argv))
return 1;
if (dist_type == TYPE_ZIPF)
zipf_init(&zs, nranges, dist_val, 1);
- else
+ else if (dist_type == TYPE_PARETO)
pareto_init(&zs, nranges, dist_val, 1);
+ else
+ gauss_init(&gs, nranges, dist_val, 1);
hash_bits = 0;
hash_size = nranges;
if (dist_type == TYPE_ZIPF)
offset = zipf_next(&zs);
- else
+ else if (dist_type == TYPE_PARETO)
offset = pareto_next(&zs);
+ else
+ offset = gauss_next(&gs);
n = hash_lookup(offset);
if (n)