1f8c3e9a90f6855878f37c0fb574217f6363094e
[fio.git] / t / axmap.c
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;
29
30         if (argc > 1)
31                 size = strtoul(argv[1], NULL, 10);
32
33         printf("Using %llu entries\n", (unsigned long long) size);
34
35         lfsr_init(&lfsr, size);
36         map = axmap_new(size);
37
38         while (size--) {
39                 uint64_t val;
40
41                 lfsr_next(&lfsr, &val);
42                 axmap_set(map, val);
43         }
44
45         return 0;
46 }