Commit | Line | Data |
---|---|---|
ad1f90aa JA |
1 | #include <stdio.h> |
2 | #include <stdlib.h> | |
3 | #include <fcntl.h> | |
4 | #include <string.h> | |
5 | #include <unistd.h> | |
6 | #include <inttypes.h> | |
7 | ||
8 | #include "../lib/lfsr.h" | |
9 | ||
10 | struct axmap; | |
11 | void axmap_set(struct axmap *, uint64_t); | |
12 | struct axmap *axmap_new(uint64_t size); | |
13 | ||
14 | void *smalloc(size_t size) | |
15 | { | |
16 | return malloc(size); | |
17 | } | |
18 | ||
19 | void sfree(void *ptr) | |
20 | { | |
21 | free(ptr); | |
22 | } | |
23 | ||
24 | int main(int argc, char *argv[]) | |
25 | { | |
26 | struct fio_lfsr lfsr; | |
27 | size_t size = (1UL << 28) - 200; | |
28 | struct axmap *map; | |
4e59017d | 29 | int seed = 1; |
ad1f90aa | 30 | |
4e59017d | 31 | if (argc > 1) { |
ad1f90aa | 32 | size = strtoul(argv[1], NULL, 10); |
4e59017d JA |
33 | if (argc > 2) |
34 | seed = strtoul(argv[2], NULL, 10); | |
35 | } | |
ad1f90aa JA |
36 | |
37 | printf("Using %llu entries\n", (unsigned long long) size); | |
38 | ||
4e59017d | 39 | lfsr_init(&lfsr, size, seed); |
ad1f90aa JA |
40 | map = axmap_new(size); |
41 | ||
42 | while (size--) { | |
43 | uint64_t val; | |
44 | ||
45 | lfsr_next(&lfsr, &val); | |
46 | axmap_set(map, val); | |
47 | } | |
48 | ||
49 | return 0; | |
50 | } |