a4aa163c80bc1dde7ad46e2f8ae85f32935d3456
[fio.git] / lib / zipf.h
1 #ifndef FIO_ZIPF_H
2 #define FIO_ZIPF_H
3
4 #include <inttypes.h>
5 #include "rand.h"
6 #include "types.h"
7
8 struct zipf_state {
9         uint64_t nranges;
10         double theta;
11         double zeta2;
12         double zetan;
13         double pareto_pow;
14         struct frand_state rand;
15         uint64_t rand_off;
16         bool disable_hash;
17 };
18
19 void zipf_init(struct zipf_state *zs, unsigned long nranges, double theta, unsigned int seed);
20 unsigned long long zipf_next(struct zipf_state *zs);
21
22 void pareto_init(struct zipf_state *zs, unsigned long nranges, double h, unsigned int seed);
23 unsigned long long pareto_next(struct zipf_state *zs);
24 void zipf_disable_hash(struct zipf_state *zs);
25
26 #endif