axmap.c revision ad1f90aa84ba96916d02043958ee416a499f3f25
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 10struct axmap; 11void axmap_set(struct axmap *, uint64_t); 12struct axmap *axmap_new(uint64_t size); 13 14void *smalloc(size_t size) 15{ 16 return malloc(size); 17} 18 19void sfree(void *ptr) 20{ 21 free(ptr); 22} 23 24int 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} 47