xref: /isa-l/igzip/igzip_build_hash_table_perf.c (revision 55fbfabfc60f1002bc8133b730a59f6abd22cfce)
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <assert.h>
4 #include <string.h>
5 #include <getopt.h>
6 #include "igzip_lib.h"
7 #include "test.h"
8 #include "huff_codes.h"
9 
10 #define DICT_LEN 32 * 1024
11 
12 extern void
13 isal_deflate_hash(struct isal_zstream *stream, uint8_t *dict, int dict_len);
14 
15 void
create_rand_data(uint8_t * data,uint32_t size)16 create_rand_data(uint8_t *data, uint32_t size)
17 {
18         int i;
19         for (i = 0; i < size; i++) {
20                 data[i] = rand() % 256;
21         }
22 }
23 
24 int
main(int argc,char * argv[])25 main(int argc, char *argv[])
26 {
27         int time = BENCHMARK_TIME;
28         struct isal_zstream stream;
29         uint8_t dict[DICT_LEN];
30         uint32_t dict_len = DICT_LEN;
31 
32         stream.level = 0;
33         stream.internal_state.hash_mask = LVL0_HASH_MASK;
34         create_rand_data(dict, dict_len);
35 
36         struct perf start;
37         BENCHMARK(&start, time, isal_deflate_hash(&stream, dict, dict_len));
38 
39         printf("igzip_build_hash_table_perf: in_size=%u ", dict_len);
40         perf_print(start, (long long) dict_len);
41 
42         return 0;
43 }
44