blob: 187abf2fc0f2438562f8ae1d4b82b0e506d2d0e3 [file] [log] [blame]
Jens Axboe8055e412012-11-26 08:43:47 +01001#ifndef FIO_LFSR_H
2#define FIO_LFSR_H
3
4#include <inttypes.h>
5
Alex Pyrgiotisd474cbc2013-03-08 14:37:03 +02006#define FIO_MAX_TAPS 6
Jens Axboe8055e412012-11-26 08:43:47 +01007
8struct lfsr_taps {
9 unsigned int length;
10 unsigned int taps[FIO_MAX_TAPS];
11};
12
13
14struct fio_lfsr {
Alex Pyrgiotisd474cbc2013-03-08 14:37:03 +020015 uint64_t xormask;
Jens Axboe8055e412012-11-26 08:43:47 +010016 uint64_t last_val;
Alex Pyrgiotisd474cbc2013-03-08 14:37:03 +020017 uint64_t cached_bit;
Jens Axboe8055e412012-11-26 08:43:47 +010018 uint64_t max_val;
19 uint64_t num_vals;
Alex Pyrgiotisd474cbc2013-03-08 14:37:03 +020020 uint64_t cycle_length;
Alex Pyrgiotisd0f85362013-03-12 10:28:35 +020021 uint64_t cached_cycle_length;
Alex Pyrgiotisd474cbc2013-03-08 14:37:03 +020022 unsigned int spin;
Jens Axboe8055e412012-11-26 08:43:47 +010023};
24
Jens Axboe74776732013-01-11 14:03:25 +010025int lfsr_next(struct fio_lfsr *fl, uint64_t *off, uint64_t);
Alex Pyrgiotisd474cbc2013-03-08 14:37:03 +020026int lfsr_init(struct fio_lfsr *fl, uint64_t size,
27 unsigned long seed, unsigned int spin);
28int lfsr_reset(struct fio_lfsr *fl, unsigned long seed);
Jens Axboe8055e412012-11-26 08:43:47 +010029
30#endif