ca96a3cafb08e7b5bfd8f5a482d32cc92c2a2542
[dpdk.git] / app / test-compress-perf / comp_perf_options.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 Intel Corporation
3  */
4
5 #ifndef _COMP_PERF_OPS_
6 #define _COMP_PERF_OPS_
7
8 #define MAX_DRIVER_NAME         64
9 #define MAX_INPUT_FILE_NAME     64
10 #define MAX_LIST                32
11
12 enum comp_operation {
13         COMPRESS_ONLY,
14         DECOMPRESS_ONLY,
15         COMPRESS_DECOMPRESS
16 };
17
18 struct range_list {
19         uint8_t min;
20         uint8_t max;
21         uint8_t inc;
22         uint8_t count;
23         uint8_t list[MAX_LIST];
24 };
25
26 struct comp_test_data {
27         char driver_name[64];
28         char input_file[64];
29         struct rte_mbuf **comp_bufs;
30         struct rte_mbuf **decomp_bufs;
31         uint32_t total_bufs;
32         uint8_t *input_data;
33         size_t input_data_sz;
34         uint8_t *compressed_data;
35         uint8_t *decompressed_data;
36         struct rte_mempool *comp_buf_pool;
37         struct rte_mempool *decomp_buf_pool;
38         struct rte_mempool *op_pool;
39         int8_t cdev_id;
40         uint16_t seg_sz;
41         uint16_t burst_sz;
42         uint32_t pool_sz;
43         uint32_t num_iter;
44         uint16_t max_sgl_segs;
45         enum rte_comp_huffman huffman_enc;
46         enum comp_operation test_op;
47         int window_sz;
48         struct range_list level;
49         /* Store TSC duration for all levels (including level 0) */
50         uint64_t comp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
51         uint64_t decomp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];
52         size_t comp_data_sz;
53         size_t decomp_data_sz;
54         double ratio;
55         double comp_gbps;
56         double decomp_gbps;
57         double comp_tsc_byte;
58         double decomp_tsc_byte;
59 };
60
61 int
62 comp_perf_options_parse(struct comp_test_data *test_data, int argc,
63                         char **argv);
64
65 void
66 comp_perf_options_default(struct comp_test_data *test_data);
67
68 int
69 comp_perf_options_check(struct comp_test_data *test_data);
70
71 #endif