test/compress: add cycle-count mode to the perf tool
PATCH 1/1 test/compress: add cycle-count mode to the perf tool
This commit adds cycle-count mode to the compression perf tool. The new mode enhances the compression performance tool to allow cycle-count measurement of both hardware and softwate PMDs.
---
app/test-compress-perf/Makefile | 3 +-
app/test-compress-perf/comp_perf.h | 6 +-
app/test-compress-perf/comp_perf_options.h | 7 +-
.../comp_perf_options_parse.c | 35 +-
.../comp_perf_test_common.c | 23 +-
.../comp_perf_test_common.h | 2 +-
.../comp_perf_test_cyclecount.c | 614 ++++++++++++++++++
.../comp_perf_test_cyclecount.h | 24 +
...enchmark.c => comp_perf_test_throughput.c} | 10 +-
...enchmark.h => comp_perf_test_throughput.h} | 6 +-
.../comp_perf_test_verify.c | 4 +-
app/test-compress-perf/main.c | 65 +-
app/test-compress-perf/meson.build | 3 +-
13 files changed, 755 insertions(+), 47 deletions(-)
create mode 100644 app/test-compress-perf/comp_perf_test_cyclecount.c
create mode 100644 app/test-compress-perf/comp_perf_test_cyclecount.h
rename app/test-compress-perf/{comp_perf_test_benchmark.c => comp_perf_test_throughput.c} (97%)
rename app/test-compress-perf/{comp_perf_test_benchmark.h => comp_perf_test_throughput.h} (80%)app/test-compress-perf/Makefile +2 -1
@@ -13,7 +13,8 @@ CFLAGS += -O3 SRCS-y := main.c SRCS-y += comp_perf_options_parse.c SRCS-y += comp_perf_test_verify.c -SRCS-y += comp_perf_test_benchmark.c +SRCS-y += comp_perf_test_throughput.c +SRCS-y += comp_perf_test_cyclecount.c SRCS-y += comp_perf_test_common.c include $(RTE_SDK)/mk/rte.app.mk
app/test-compress-perf/comp_perf.h +3 -3
@@ -26,15 +26,15 @@ struct cperf_test {/* Needed for weak functions*/ void * -cperf_benchmark_test_constructor(uint8_t dev_id __rte_unused, +cperf_throughput_test_constructor(uint8_t dev_id __rte_unused, uint16_t qp_id __rte_unused, struct comp_test_data *options __rte_unused);void -cperf_benchmark_test_destructor(void *arg __rte_unused); +cperf_throughput_test_destructor(void *arg __rte_unused);int -cperf_benchmark_test_runner(void *test_ctx __rte_unused); +cperf_throughput_test_runner(void *test_ctx __rte_unused);void * cperf_verify_test_constructor(uint8_t dev_id __rte_unused,
app/test-compress-perf/comp_perf_options.h +5 -2
@@ -24,8 +24,9 @@ enum cleanup_st { };enum cperf_test_type { -CPERF_TEST_TYPE_BENCHMARK , -CPERF_TEST_TYPE_VERIFY +CPERF_TEST_TYPE_THROUGHPUT , +CPERF_TEST_TYPE_VERIFY , +CPERF_TEST_TYPE_PMDCC };enum comp_operation {
@@ -68,6 +69,8 @@ struct comp_test_data {double ratio;enum cleanup_st cleanup;int perf_comp_force_stop; + +uint32_t cyclecount_delay; };int
app/test-compress-perf/comp_perf_options_parse.c +29 -6
@@ -30,6 +30,9 @@#define CPERF_WINDOW_SIZE ("window-sz")#define CPERF_EXTERNAL_MBUFS ("external-mbufs") +/* cyclecount-specific options */ +#define CPERF_CYCLECOUNT_DELAY_US ("cc-delay-us") +struct name_id_map {const char *name;uint32_t id;
@@ -39,7 +42,7 @@ static void usage(char *progname) {printf ("%s [EAL options] --\n" -" --ptest benchmark / verify :" +" --ptest throughput / verify / pmd-cyclecount\n" " --driver-name NAME: compress driver to use\n" " --input-file NAME: file to compress and decompress\n" " --extended-input-sz N: extend file data up to this size (default: no extension)\n"
@@ -61,6 +64,8 @@ usage(char *progname)" (e.g.: 15 => 32k, default: max supported by PMD)\n" " --external-mbufs: use memzones as external buffers instead of\n" " keeping the data directly in mbuf area\n" +" --cc-delay-us N: delay between enqueue and dequeue operations in microseconds\n" +" valid only for cyclecount perf test (default: 500 us)\n" " -h: prints this help\n" , progname); }
@@ -85,12 +90,16 @@ parse_cperf_test_type(struct comp_test_data *test_data, const char *arg) {struct name_id_map cperftest_namemap[] = { { - comp_perf_test_type_strs[CPERF_TEST_TYPE_BENCHMARK ], -CPERF_TEST_TYPE_BENCHMARK + comp_perf_test_type_strs[CPERF_TEST_TYPE_THROUGHPUT ], +CPERF_TEST_TYPE_THROUGHPUT }, { comp_perf_test_type_strs[CPERF_TEST_TYPE_VERIFY ],CPERF_TEST_TYPE_VERIFY + }, + { + comp_perf_test_type_strs[CPERF_TEST_TYPE_PMDCC ], +CPERF_TEST_TYPE_PMDCC } };
@@ -531,17 +540,28 @@ parse_external_mbufs(struct comp_test_data *test_data,return 0 ; } +static int +parse_cyclecount_delay_us (struct comp_test_data *test_data, +const char *arg) +{ +int ret =parse_uint32_t (&(test_data->cyclecount_delay), arg); + +if (ret) { +RTE_LOG (ERR ,USER1 ,"Failed to parse cyclecount delay\n" ); +return -1 ; + } +return 0 ; +} +typedef int (*option_parser_t )(struct comp_test_data *test_data,const char *arg);struct long_opt_parser {const char *lgopt_name;option_parser_t parser_fn; - };static struct option lgopts[] = { - {CPERF_PTEST_TYPE , required_argument,0 ,0 }, {CPERF_DRIVER_NAME , required_argument,0 ,0 }, {CPERF_TEST_FILE , required_argument,0 ,0 },
@@ -556,6 +576,7 @@ static struct option lgopts[] = { { CPERF_LEVEL, required_argument, 0, 0 }, { CPERF_WINDOW_SIZE, required_argument, 0, 0 }, { CPERF_EXTERNAL_MBUFS, 0, 0, 0 }, + { CPERF_CYCLECOUNT_DELAY_US, required_argument, 0, 0 }, { NULL, 0, 0, 0 } };
@@ -577,6 +598,7 @@ comp_perf_opts_parse_long(int opt_idx, struct comp_test_data *test_data) { CPERF_LEVEL, parse_level }, { CPERF_WINDOW_SIZE, parse_window_sz }, { CPERF_EXTERNAL_MBUFS, parse_external_mbufs }, + { CPERF_CYCLECOUNT_DELAY_US, parse_cyclecount_delay_us }, };unsigned int i;
@@ -631,8 +653,9 @@ comp_perf_options_default(struct comp_test_data *test_data) test_data->level_lst.min =RTE_COMP_LEVEL_MIN ; test_data->level_lst.max =RTE_COMP_LEVEL_MAX ; test_data->level_lst.inc =1 ; - test_data->test =CPERF_TEST_TYPE_BENCHMARK ; + test_data->test =CPERF_TEST_TYPE_THROUGHPUT ; test_data->use_external_mbufs =0 ; + test_data->cyclecount_delay =500 ; }int
app/test-compress-perf/comp_perf_test_common.c +15 -8
@@ -9,7 +9,8 @@#include "comp_perf.h" #include "comp_perf_options.h" -#include "comp_perf_test_benchmark.h" +#include "comp_perf_test_throughput.h" +#include "comp_perf_test_cyclecount.h" #include "comp_perf_test_common.h" #include "comp_perf_test_verify.h"
@@ -276,9 +277,11 @@ comp_perf_allocate_memory(struct comp_test_data *test_data,snprintf (pool_name,sizeof (pool_name),"op_pool_%u_qp_%u" , mem->dev_id, mem->qp_id); + +/* one mempool for both src and dst mbufs */ mem->op_pool =rte_comp_op_pool_create (pool_name, - mem->total_bufs, -0 ,0 ,rte_socket_id ()); + mem->total_bufs *2 , +0 ,0 ,rte_socket_id ());if (mem->op_pool ==NULL ) {RTE_LOG (ERR ,USER1 ,"Comp op mempool could not be created\n" );return -1 ;
@@ -495,20 +498,24 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem) }void -print_test_dynamics (void ) +print_test_dynamics (const struct comp_test_data *test_data) {uint32_t opt_total_segs =DIV_CEIL (buffer_info.input_data_sz,MAX_SEG_SIZE );if (buffer_info.total_buffs >1 ) { -printf ("\nWarning: for the current input parameters, number" +if (test_data->test ==CPERF_TEST_TYPE_THROUGHPUT ) { +printf ("\nWarning: for the current input parameters, number" " of ops is higher than one, which may result" " in sub-optimal performance.\n" ); -printf ("To improve the performance (for the current" +printf ("To improve the performance (for the current" " input data) following parameters are" " suggested:\n" ); -printf (" * Segment size: %d\n" ,MAX_SEG_SIZE ); -printf (" * Number of segments: %u\n" , opt_total_segs); +printf (" * Segment size: %d\n" , +MAX_SEG_SIZE ); +printf (" * Number of segments: %u\n" , + opt_total_segs); + } }else if (buffer_info.total_buffs ==1 ) { printf("\nInfo: there is only one op with %u segments -" " the compression ratio is the best.\n",
app/test-compress-perf/comp_perf_test_common.h +1 -1
@@ -49,6 +49,6 @@ int prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem);void -print_test_dynamics (void ); +print_test_dynamics (const struct comp_test_data *test_data);#endif /* _COMP_PERF_TEST_COMMON_H_ */
app/test-compress-perf/comp_perf_test_cyclecount.c new file +614 -0
614 lines not on this page · raw message
app/test-compress-perf/comp_perf_test_cyclecount.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2019 Intel Corporation +*/ + +#ifndef _COMP_PERF_TEST_CYCLECOUNT_ +#define _COMP_PERF_TEST_CYCLECOUNT_ + +#include <stdint.h> + +#include "comp_perf_options.h" +#include "comp_perf_test_common.h" +#include "comp_perf_test_verify.h" + +void +cperf_cyclecount_test_destructor (void *arg); + +int +cperf_cyclecount_test_runner (void *test_ctx); + +void * +cperf_cyclecount_test_constructor (uint8_t dev_id,uint16_t qp_id, +struct comp_test_data *options); + +#endif
app/test-compress-perf/comp_perf_test_throughput.c renamed from app/test-compress-perf/comp_perf_test_benchmark.c +5 -5
@@ -8,10 +8,10 @@#include <rte_cycles.h> #include <rte_compressdev.h> -#include "comp_perf_test_benchmark.h" +#include "comp_perf_test_throughput.h" void -cperf_benchmark_test_destructor (void *arg) +cperf_throughput_test_destructor (void *arg) {if (arg) { comp_perf_free_memory(
@@ -22,7 +22,7 @@ cperf_benchmark_test_destructor(void *arg) }void * -cperf_benchmark_test_constructor (uint8_t dev_id,uint16_t qp_id, +cperf_throughput_test_constructor (uint8_t dev_id,uint16_t qp_id,struct comp_test_data *options) {struct cperf_benchmark_ctx *ctx =NULL ;
@@ -41,7 +41,7 @@ cperf_benchmark_test_constructor(uint8_t dev_id, uint16_t qp_id, && !prepare_bufs(ctx->ver.options, &ctx->ver.mem))return ctx; -cperf_benchmark_test_destructor (ctx); +cperf_throughput_test_destructor (ctx);return NULL ; }
@@ -324,7 +324,7 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type) }int -cperf_benchmark_test_runner (void *test_ctx) +cperf_throughput_test_runner (void *test_ctx) {struct cperf_benchmark_ctx *ctx = test_ctx;struct comp_test_data *test_data = ctx->ver.options;
app/test-compress-perf/comp_perf_test_throughput.h renamed from app/test-compress-perf/comp_perf_test_benchmark.h +3 -3
@@ -24,13 +24,13 @@ struct cperf_benchmark_ctx { };void -cperf_benchmark_test_destructor (void *arg); +cperf_throughput_test_destructor (void *arg);int -cperf_benchmark_test_runner (void *test_ctx); +cperf_throughput_test_runner (void *test_ctx);void * -cperf_benchmark_test_constructor (uint8_t dev_id,uint16_t qp_id, +cperf_throughput_test_constructor (uint8_t dev_id,uint16_t qp_id,struct comp_test_data *options);#endif
app/test-compress-perf/comp_perf_test_verify.c +2 -2
@@ -48,8 +48,8 @@ static int main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type) {struct comp_test_data *test_data = ctx->options; -uint8_t *output_data_ptr; -size_t *output_data_sz; +uint8_t *output_data_ptr =NULL ; +size_t *output_data_sz =NULL ;struct cperf_mem_resources *mem = &ctx->mem;uint8_t dev_id = mem->dev_id;
app/test-compress-perf/main.c +50 -15
131 lines not on this page · raw message
app/test-compress-perf/meson.build +2 -1
@@ -5,6 +5,7 @@ allow_experimental_apis = true sources = files('comp_perf_options_parse.c', 'main.c', 'comp_perf_test_verify.c', - 'comp_perf_test_benchmark.c', + 'comp_perf_test_throughput.c', + 'comp_perf_test_cyclecount.c', 'comp_perf_test_common.c') deps = ['compressdev']
Signature · 1 line
2.17.1
Quoted 10 lines
-----Original Message-----
From: Trybula, ArturX <[email protected]>
Sent: Wednesday, December 11, 2019 3:50 PM
To: [email protected]; Trahe, Fiona <[email protected]>; [email protected]; Dybkowski, AdamX <[email protected]>; Danilewicz, MarcinX <[email protected]>; Trybula, ArturX <[email protected]>; [email protected]
Subject: [PATCH] test/compress: add cycle-count mode to the perf tool
Quoted 5 lines
This commit adds cycle-count mode to the compression perf tool. The new mode enhances the compression performance tool to allow cycle-count measurement of both hardware and softwate PMDs.
Signed-off-by Artur Trybula <[email protected]>
Akhil Goyal
AppliedQuoted 7 lines
Quoted 6 lines
This commit adds cycle-count mode to the compression perf tool. The new mode enhances the compression performance tool to allow cycle-count measurement of both hardware and softwate PMDs.
Signed-off-by Artur Trybula <[email protected]>Acked-by Fiona Trahe <[email protected]>
Applied to dpdk-next-crypto
Thanks.