dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
From: Adam Dybkowski <adamx.dybkowski@intel.com>
To: dev@dpdk.org, fiona.trahe@intel.com
Cc: Artur Trybula <arturx.trybula@intel.com>,
	Adam Dybkowski <adamx.dybkowski@intel.com>
Subject: [dpdk-dev] [PATCH v6 1/1] app/test-compress-perf: provide more detailed report
Date: Wed, 24 Jul 2019 14:53:23 +0200	[thread overview]
Message-ID: <20190724125323.15654-2-adamx.dybkowski@intel.com> (raw)
In-Reply-To: <20190724125323.15654-1-adamx.dybkowski@intel.com>

From: Artur Trybula <arturx.trybula@intel.com>

This patch adds extra features to the compress performance
test. Some important parameters (memory allocation,
number of ops, number of segments) are calculated and
printed out.
Information about threads, cores, devices and queue-pairs
is also printed.

Signed-off-by: Artur Trybula <arturx.trybula@intel.com>
Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
---
 .../comp_perf_test_benchmark.c                | 21 ++++-
 .../comp_perf_test_common.c                   | 94 ++++++++++++++++++-
 .../comp_perf_test_common.h                   |  6 ++
 app/test-compress-perf/main.c                 |  4 +-
 4 files changed, 120 insertions(+), 5 deletions(-)

diff --git a/app/test-compress-perf/comp_perf_test_benchmark.c b/app/test-compress-perf/comp_perf_test_benchmark.c
index aa1f8eea2..887459449 100644
--- a/app/test-compress-perf/comp_perf_test_benchmark.c
+++ b/app/test-compress-perf/comp_perf_test_benchmark.c
@@ -329,9 +329,26 @@ cperf_benchmark_test_runner(void *test_ctx)
 	struct comp_test_data *test_data = ctx->ver.options;
 	uint32_t lcore = rte_lcore_id();
 	static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
+	int i, ret = EXIT_SUCCESS;
 
 	ctx->ver.mem.lcore_id = lcore;
-	int i, ret = EXIT_SUCCESS;
+
+	/*
+	 * printing information about current compression thread
+	 */
+	if (rte_atomic16_test_and_set(&ctx->ver.mem.print_info_once))
+		printf("    lcore: %u,"
+				" driver name: %s,"
+				" device name: %s,"
+				" device id: %u,"
+				" socket id: %u,"
+				" queue pair id: %u\n",
+			lcore,
+			ctx->ver.options->driver_name,
+			rte_compressdev_name_get(ctx->ver.mem.dev_id),
+			ctx->ver.mem.dev_id,
+			rte_compressdev_socket_id(ctx->ver.mem.dev_id),
+			ctx->ver.mem.qp_id);
 
 	/*
 	 * First the verification part is needed
@@ -374,7 +391,7 @@ cperf_benchmark_test_runner(void *test_ctx)
 			1000000000;
 
 	if (rte_atomic16_test_and_set(&display_once)) {
-		printf("%12s%6s%12s%17s%15s%16s\n",
+		printf("\n%12s%6s%12s%17s%15s%16s\n",
 			"lcore id", "Level", "Comp size", "Comp ratio [%]",
 			"Comp [Gbps]", "Decomp [Gbps]");
 	}
diff --git a/app/test-compress-perf/comp_perf_test_common.c b/app/test-compress-perf/comp_perf_test_common.c
index 472c76686..bfecbf166 100644
--- a/app/test-compress-perf/comp_perf_test_common.c
+++ b/app/test-compress-perf/comp_perf_test_common.c
@@ -16,6 +16,18 @@
 
 #define DIV_CEIL(a, b)  ((a) / (b) + ((a) % (b) != 0))
 
+struct cperf_buffer_info {
+	uint16_t total_segments;
+	uint16_t segment_sz;
+	uint16_t last_segment_sz;
+	uint32_t total_buffs;	      /*number of buffers = number of ops*/
+	uint16_t segments_per_buff;
+	uint16_t segments_per_last_buff;
+	size_t input_data_sz;
+};
+
+static struct cperf_buffer_info buffer_info;
+
 int
 param_range_check(uint16_t size, const struct rte_param_log2_range *range)
 {
@@ -170,6 +182,13 @@ comp_perf_allocate_memory(struct comp_test_data *test_data,
 				" could not be allocated\n");
 		return -1;
 	}
+
+	buffer_info.total_segments = total_segs;
+	buffer_info.segment_sz = test_data->seg_sz;
+	buffer_info.total_buffs = mem->total_bufs;
+	buffer_info.segments_per_buff = test_data->max_sgl_segs;
+	buffer_info.input_data_sz = test_data->input_data_sz;
+
 	return 0;
 }
 
@@ -178,9 +197,10 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
 {
 	uint32_t remaining_data = test_data->input_data_sz;
 	uint8_t *input_data_ptr = test_data->input_data;
-	size_t data_sz;
+	size_t data_sz = 0;
 	uint8_t *data_addr;
 	uint32_t i, j;
+	uint16_t segs_per_mbuf = 0;
 
 	for (i = 0; i < mem->total_bufs; i++) {
 		/* Allocate data in input mbuf and copy data from input file */
@@ -204,7 +224,7 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
 		remaining_data -= data_sz;
 
 		/* Already one segment in the mbuf */
-		uint16_t segs_per_mbuf = 1;
+		segs_per_mbuf = 1;
 
 		/* Chain mbufs if needed for input mbufs */
 		while (segs_per_mbuf < test_data->max_sgl_segs
@@ -281,5 +301,75 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
 		}
 	}
 
+	buffer_info.segments_per_last_buff = segs_per_mbuf;
+	buffer_info.last_segment_sz = data_sz;
+
 	return 0;
 }
+
+void
+print_test_dynamics(void)
+{
+	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"
+				" of ops is higher than one, which may result"
+				" in sub-optimal performance.\n");
+		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);
+	} else if (buffer_info.total_buffs == 1) {
+		printf("\nInfo: there is only one op with %u segments –"
+				" the compression ratio is the best.\n",
+			buffer_info.segments_per_last_buff);
+		if (buffer_info.segment_sz < MAX_SEG_SIZE)
+			printf("To reduce compression time, please use"
+					" bigger segment size: %d.\n",
+				MAX_SEG_SIZE);
+		else if (buffer_info.segment_sz == MAX_SEG_SIZE)
+			printf("Segment size is optimal for the best"
+					" performance.\n");
+	} else
+		printf("Warning: something wrong happened!!\n");
+
+	printf("\nFor the current input parameters (segment size = %u,"
+			" maximum segments per SGL = %u):\n",
+		buffer_info.segment_sz,
+		buffer_info.segments_per_buff);
+	printf("	* Total number of buffers: %d\n",
+		buffer_info.total_segments);
+	printf("	* %u buffer(s) %u bytes long, last buffer %u"
+			" byte(s) long\n",
+		buffer_info.total_segments - 1,
+		buffer_info.segment_sz,
+		buffer_info.last_segment_sz);
+	printf("	* Number of ops: %u\n", buffer_info.total_buffs);
+	printf("	* Total memory allocation: %u\n",
+		(buffer_info.total_segments - 1) * buffer_info.segment_sz
+		+ buffer_info.last_segment_sz);
+	if (buffer_info.total_buffs > 1)
+		printf("	* %u ops: %u segment(s) in each,"
+				" segment size %u\n",
+			buffer_info.total_buffs - 1,
+			buffer_info.segments_per_buff,
+			buffer_info.segment_sz);
+	if (buffer_info.segments_per_last_buff > 1) {
+		printf("	* 1 op %u segments:\n",
+				buffer_info.segments_per_last_buff);
+		printf("		o %u segment size %u\n",
+			buffer_info.segments_per_last_buff - 1,
+			buffer_info.segment_sz);
+		printf("		o last segment size %u\n",
+			buffer_info.last_segment_sz);
+	} else if (buffer_info.segments_per_last_buff == 1) {
+		printf("	* 1 op (the last one): %u segment %u"
+				" byte(s) long\n\n",
+			buffer_info.segments_per_last_buff,
+			buffer_info.last_segment_sz);
+	}
+	printf("\n");
+}
diff --git a/app/test-compress-perf/comp_perf_test_common.h b/app/test-compress-perf/comp_perf_test_common.h
index 9c11e3a00..c9e0c9081 100644
--- a/app/test-compress-perf/comp_perf_test_common.h
+++ b/app/test-compress-perf/comp_perf_test_common.h
@@ -13,6 +13,9 @@ struct cperf_mem_resources {
 	uint8_t dev_id;
 	uint16_t qp_id;
 	uint8_t lcore_id;
+
+	rte_atomic16_t print_info_once;
+
 	uint32_t total_bufs;
 	uint8_t *compressed_data;
 	uint8_t *decompressed_data;
@@ -38,4 +41,7 @@ comp_perf_allocate_memory(struct comp_test_data *test_data,
 int
 prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem);
 
+void
+print_test_dynamics(void);
+
 #endif /* _COMP_PERF_TEST_COMMON_H_ */
diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index e746e4708..e7ac412e6 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -363,7 +363,7 @@ main(int argc, char **argv)
 
 	printf("App uses socket: %u\n", rte_socket_id());
 	printf("Burst size = %u\n", test_data->burst_sz);
-	printf("File size = %zu\n", test_data->input_data_sz);
+	printf("Input data size = %zu\n", test_data->input_data_sz);
 
 	test_data->cleanup = ST_DURING_TEST;
 	total_nb_qps = nb_compressdevs * test_data->nb_qps;
@@ -390,6 +390,8 @@ main(int argc, char **argv)
 		i++;
 	}
 
+	print_test_dynamics(); /* constructors must be executed first */
+
 	while (test_data->level <= test_data->level_lst.max) {
 
 		i = 0;
-- 
2.17.1


  reply	other threads:[~2019-07-24 13:09 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03 10:24 [dpdk-dev] [PATCH] app/test-compress-perf: report header improvement Artur Trybula
2019-06-26 17:04 ` Shally Verma
2019-06-27  8:58   ` Trybula, ArturX
2019-06-27 11:00     ` Shally Verma
2019-06-27 11:46       ` Trybula, ArturX
2019-06-27 14:38         ` Shally Verma
2019-06-28  9:52           ` Trybula, ArturX
2019-07-05  6:30 ` [dpdk-dev] [PATCH v2 0/1] add extra features to test-compress-perf Artur Trybula
2019-07-05  6:30   ` [dpdk-dev] [PATCH v2 1/1] app/test-compress-perf: report header improvement Artur Trybula
2019-07-05  6:53     ` Jerin Jacob Kollanukkaran
2019-07-05  7:40   ` [dpdk-dev] [PATCH v3 0/1] add extra features to test-compress-perf Artur Trybula
2019-07-05  7:40     ` [dpdk-dev] [PATCH v3 1/1] app/test-compress-perf: report header improvement Artur Trybula
2019-07-12 10:43     ` [dpdk-dev] [PATCH v4 0/1] add extra features to test-compress-perf Artur Trybula
2019-07-12 10:43       ` [dpdk-dev] [PATCH v4 1/1] app/test-compress-perf: report header improvement Artur Trybula
2019-07-15 12:47         ` [dpdk-dev] [EXT] " Shally Verma
2019-07-15 14:01           ` Trybula, ArturX
2019-07-16 13:49             ` Trahe, Fiona
2019-07-17  7:21               ` Shally Verma
2019-07-17 11:02       ` [dpdk-dev] [PATCH v5 0/1] add extra features to test-compress-perf Artur Trybula
2019-07-17 11:02         ` [dpdk-dev] [PATCH v5 1/1] app/test-compress-perf: report header improvement Artur Trybula
2019-07-17 11:15           ` [dpdk-dev] [EXT] " Shally Verma
2019-07-17 11:26             ` Trybula, ArturX
2019-07-19 13:17               ` Akhil Goyal
2019-07-19 16:21                 ` Thomas Monjalon
2019-07-19 17:37                   ` Trahe, Fiona
2019-07-24 12:53           ` [dpdk-dev] [PATCH v6 0/1] add extra features to test-compress-perf Adam Dybkowski
2019-07-24 12:53             ` Adam Dybkowski [this message]
2019-07-24 13:55               ` [dpdk-dev] [PATCH v7 " Adam Dybkowski
2019-07-24 13:55                 ` [dpdk-dev] [PATCH v7 1/1] app/test-compress-perf: provide more detailed report Adam Dybkowski
2019-07-25 12:39                   ` Trahe, Fiona
2019-07-26 12:41                     ` Akhil Goyal
2019-07-17 11:16         ` [dpdk-dev] [EXT] [PATCH v5 0/1] add extra features to test-compress-perf Shally Verma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190724125323.15654-2-adamx.dybkowski@intel.com \
    --to=adamx.dybkowski@intel.com \
    --cc=arturx.trybula@intel.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).