Skip to contentSkip to conversation

test/compress: add cycle-count mode to the perf tool

PATCH Applied Artur Trybula 3 participants 3 messages Dec 11, 2019 – Jan 28, 2020 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

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
index d1a6820e6..ad3b91d0a 100644
@@ -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
index 57289b07a..997d46b59 100644
@@ -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
index 2c26511ef..0b777521c 100644
@@ -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
index 12d0a6caf..04a8d2fbe 100644
@@ -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
index 1b8985b43..b402a0d83 100644
@@ -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
index 920642888..72705c6a2 100644
@@ -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
new file mode 100644
index 000000000..8e1b4d9e9
@@ -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
similarity index 97%
rename from app/test-compress-perf/comp_perf_test_benchmark.c
rename to app/test-compress-perf/comp_perf_test_throughput.c
index 0c6bb9b45..13922b658 100644
@@ -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
similarity index 80%
rename from app/test-compress-perf/comp_perf_test_benchmark.h
rename to app/test-compress-perf/comp_perf_test_throughput.h
index d9b2694b8..467e3aa78 100644
@@ -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
index 758a22ff5..5e13257b7 100644
@@ -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
index 1136f04bc..1fe26cc14 100644
@@ -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
Acked-by on v1 1/1
#1 lore raw
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.