Jens Axboe | e25839d | 2012-11-06 10:49:42 +0100 | [diff] [blame] | 1 | #ifndef FIO_ZIPF_H |
| 2 | #define FIO_ZIPF_H |
| 3 | |
Jens Axboe | b83da9b | 2012-11-06 16:05:50 +0100 | [diff] [blame] | 4 | #include <inttypes.h> |
Jens Axboe | e25839d | 2012-11-06 10:49:42 +0100 | [diff] [blame] | 5 | #include "rand.h" |
| 6 | |
| 7 | struct zipf_state { |
| 8 | uint64_t nranges; |
| 9 | double theta; |
| 10 | double zeta2; |
| 11 | double zetan; |
Jens Axboe | 925fee3 | 2012-11-06 13:50:32 +0100 | [diff] [blame] | 12 | double pareto_pow; |
Jens Axboe | e25839d | 2012-11-06 10:49:42 +0100 | [diff] [blame] | 13 | struct frand_state rand; |
Jens Axboe | a5a4fdf | 2012-11-11 08:27:24 +0100 | [diff] [blame] | 14 | uint64_t rand_off; |
Jens Axboe | e25839d | 2012-11-06 10:49:42 +0100 | [diff] [blame] | 15 | }; |
| 16 | |
Jens Axboe | 2316296 | 2012-11-07 19:47:47 +0100 | [diff] [blame] | 17 | void zipf_init(struct zipf_state *zs, unsigned long nranges, double theta, unsigned int seed); |
Jens Axboe | e25839d | 2012-11-06 10:49:42 +0100 | [diff] [blame] | 18 | unsigned long long zipf_next(struct zipf_state *zs); |
| 19 | |
Jens Axboe | 2316296 | 2012-11-07 19:47:47 +0100 | [diff] [blame] | 20 | void pareto_init(struct zipf_state *zs, unsigned long nranges, double h, unsigned int seed); |
Jens Axboe | 925fee3 | 2012-11-06 13:50:32 +0100 | [diff] [blame] | 21 | unsigned long long pareto_next(struct zipf_state *zs); |
| 22 | |
Jens Axboe | e25839d | 2012-11-06 10:49:42 +0100 | [diff] [blame] | 23 | #endif |