+#include "../flist.h"
+#include "../hash.h"
+
+#define DEF_NR 1000000
+#define DEF_NR_OUTPUT 23
+
+struct node {
+ struct flist_head list;
+ unsigned long long val;
+ unsigned long hits;
+};
+
+static struct flist_head *hash;
+static unsigned long hash_bits = 24;
+static unsigned long hash_size = 1 << 24;
+
+enum {
+ TYPE_NONE = 0,
+ TYPE_ZIPF,
+ TYPE_PARETO,
+};
+static const char *dist_types[] = { "None", "Zipf", "Pareto" };
+
+static int dist_type = TYPE_ZIPF;
+static unsigned long gb_size = 500;
+static unsigned long block_size = 4096;
+static unsigned long output_nranges = DEF_NR_OUTPUT;
+static double percentage;
+static double dist_val;
+static int output_csv = 0;
+
+#define DEF_ZIPF_VAL 1.2
+#define DEF_PARETO_VAL 0.3
+
+static struct node *hash_lookup(unsigned long long val)
+{
+ struct flist_head *l = &hash[hash_long(val, hash_bits)];
+ struct flist_head *entry;
+ struct node *n;
+
+ flist_for_each(entry, l) {
+ n = flist_entry(entry, struct node, list);
+ if (n->val == val)
+ return n;
+ }
+
+ return NULL;
+}
+
+static struct node *hash_insert(struct node *n, unsigned long long val)
+{
+ struct flist_head *l = &hash[hash_long(val, hash_bits)];