DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/crypto-perf: fix display once detection
@ 2019-06-14 22:28 Tomasz Jozwiak
  2019-07-01 11:35 ` Akhil Goyal
  0 siblings, 1 reply; 2+ messages in thread
From: Tomasz Jozwiak @ 2019-06-14 22:28 UTC (permalink / raw)
  To: dev, fiona.trahe, tjozwiakgm, pablo.de.lara.guarch, stable

This patch changes 'only_once' variable to 'display_once',
which should be atomic type due to fact, that all runner functions
can be executed in paraller way on different lcores.

Fixes: df52cb3b6e13 ("app/crypto-perf: move verify as single test type")
Cc: stable@dpdk.org

Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
---
 app/test-crypto-perf/cperf_test_latency.c        | 5 ++---
 app/test-crypto-perf/cperf_test_pmd_cyclecount.c | 8 +++-----
 app/test-crypto-perf/cperf_test_throughput.c     | 8 +++-----
 app/test-crypto-perf/cperf_test_verify.c         | 8 +++-----
 4 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c
index 0fc3a66..62478a2 100644
--- a/app/test-crypto-perf/cperf_test_latency.c
+++ b/app/test-crypto-perf/cperf_test_latency.c
@@ -129,7 +129,7 @@ cperf_latency_test_runner(void *arg)
 	uint8_t burst_size_idx = 0;
 	uint32_t imix_idx = 0;
 
-	static int only_once;
+	static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
 
 	if (ctx == NULL)
 		return 0;
@@ -311,7 +311,7 @@ cperf_latency_test_runner(void *arg)
 		time_min = tunit*(double)(tsc_min) / tsc_hz;
 
 		if (ctx->options->csv) {
-			if (!only_once)
+			if (rte_atomic16_test_and_set(&display_once))
 				printf("\n# lcore, Buffer Size, Burst Size, Pakt Seq #, "
 						"Packet Size, cycles, time (us)");
 
@@ -326,7 +326,6 @@ cperf_latency_test_runner(void *arg)
 						/ tsc_hz);
 
 			}
-			only_once = 1;
 		} else {
 			printf("\n# Device %d on lcore %u\n", ctx->dev_id,
 				ctx->lcore_id);
diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
index 92af5ec..70ffd6b 100644
--- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
+++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
@@ -391,7 +391,7 @@ cperf_pmd_cyclecount_test_runner(void *test_ctx)
 	state.lcore = rte_lcore_id();
 	state.linearize = 0;
 
-	static int only_once;
+	static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
 	static bool warmup = true;
 
 	/*
@@ -437,13 +437,12 @@ cperf_pmd_cyclecount_test_runner(void *test_ctx)
 		}
 
 		if (!opts->csv) {
-			if (!only_once)
+			if (rte_atomic16_test_and_set(&display_once))
 				printf(PRETTY_HDR_FMT, "lcore id", "Buf Size",
 						"Burst Size", "Enqueued",
 						"Dequeued", "Enq Retries",
 						"Deq Retries", "Cycles/Op",
 						"Cycles/Enq", "Cycles/Deq");
-			only_once = 1;
 
 			printf(PRETTY_LINE_FMT, state.ctx->lcore_id,
 					opts->test_buffer_size, test_burst_size,
@@ -454,13 +453,12 @@ cperf_pmd_cyclecount_test_runner(void *test_ctx)
 					state.cycles_per_enq,
 					state.cycles_per_deq);
 		} else {
-			if (!only_once)
+			if (rte_atomic16_test_and_set(&display_once))
 				printf(CSV_HDR_FMT, "# lcore id", "Buf Size",
 						"Burst Size", "Enqueued",
 						"Dequeued", "Enq Retries",
 						"Deq Retries", "Cycles/Op",
 						"Cycles/Enq", "Cycles/Deq");
-			only_once = 1;
 
 			printf(CSV_LINE_FMT, state.ctx->lcore_id,
 					opts->test_buffer_size, test_burst_size,
diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c
index 2767f4e..972d520 100644
--- a/app/test-crypto-perf/cperf_test_throughput.c
+++ b/app/test-crypto-perf/cperf_test_throughput.c
@@ -95,7 +95,7 @@ cperf_throughput_test_runner(void *test_ctx)
 	uint8_t burst_size_idx = 0;
 	uint32_t imix_idx = 0;
 
-	static int only_once;
+	static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
 
 	struct rte_crypto_op *ops[ctx->options->max_burst_size];
 	struct rte_crypto_op *ops_processed[ctx->options->max_burst_size];
@@ -262,13 +262,12 @@ cperf_throughput_test_runner(void *test_ctx)
 				ctx->options->total_ops);
 
 		if (!ctx->options->csv) {
-			if (!only_once)
+			if (rte_atomic16_test_and_set(&display_once))
 				printf("%12s%12s%12s%12s%12s%12s%12s%12s%12s%12s\n\n",
 					"lcore id", "Buf Size", "Burst Size",
 					"Enqueued", "Dequeued", "Failed Enq",
 					"Failed Deq", "MOps", "Gbps",
 					"Cycles/Buf");
-			only_once = 1;
 
 			printf("%12u%12u%12u%12"PRIu64"%12"PRIu64"%12"PRIu64
 					"%12"PRIu64"%12.4f%12.4f%12.2f\n",
@@ -283,12 +282,11 @@ cperf_throughput_test_runner(void *test_ctx)
 					throughput_gbps,
 					cycles_per_packet);
 		} else {
-			if (!only_once)
+			if (rte_atomic16_test_and_set(&display_once))
 				printf("#lcore id,Buffer Size(B),"
 					"Burst Size,Enqueued,Dequeued,Failed Enq,"
 					"Failed Deq,Ops(Millions),Throughput(Gbps),"
 					"Cycles/Buf\n\n");
-			only_once = 1;
 
 			printf("%u;%u;%u;%"PRIu64";%"PRIu64";%"PRIu64";%"PRIu64";"
 					"%.3f;%.3f;%.3f\n",
diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c
index 0497cf9..bbdf37d 100644
--- a/app/test-crypto-perf/cperf_test_verify.c
+++ b/app/test-crypto-perf/cperf_test_verify.c
@@ -233,7 +233,7 @@ cperf_verify_test_runner(void *test_ctx)
 	uint64_t ops_deqd = 0, ops_deqd_total = 0, ops_deqd_failed = 0;
 	uint64_t ops_failed = 0;
 
-	static int only_once;
+	static rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);
 
 	uint64_t i;
 	uint16_t ops_unused = 0;
@@ -376,12 +376,11 @@ cperf_verify_test_runner(void *test_ctx)
 	}
 
 	if (!ctx->options->csv) {
-		if (!only_once)
+		if (rte_atomic16_test_and_set(&display_once))
 			printf("%12s%12s%12s%12s%12s%12s%12s%12s\n\n",
 				"lcore id", "Buf Size", "Burst size",
 				"Enqueued", "Dequeued", "Failed Enq",
 				"Failed Deq", "Failed Ops");
-		only_once = 1;
 
 		printf("%12u%12u%12u%12"PRIu64"%12"PRIu64"%12"PRIu64
 				"%12"PRIu64"%12"PRIu64"\n",
@@ -394,11 +393,10 @@ cperf_verify_test_runner(void *test_ctx)
 				ops_deqd_failed,
 				ops_failed);
 	} else {
-		if (!only_once)
+		if (rte_atomic16_test_and_set(&display_once))
 			printf("\n# lcore id, Buffer Size(B), "
 				"Burst Size,Enqueued,Dequeued,Failed Enq,"
 				"Failed Deq,Failed Ops\n");
-		only_once = 1;
 
 		printf("%10u;%10u;%u;%"PRIu64";%"PRIu64";%"PRIu64";%"PRIu64";"
 				"%"PRIu64"\n",
-- 
2.7.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] app/crypto-perf: fix display once detection
  2019-06-14 22:28 [dpdk-dev] [PATCH] app/crypto-perf: fix display once detection Tomasz Jozwiak
@ 2019-07-01 11:35 ` Akhil Goyal
  0 siblings, 0 replies; 2+ messages in thread
From: Akhil Goyal @ 2019-07-01 11:35 UTC (permalink / raw)
  To: Tomasz Jozwiak, dev, fiona.trahe, pablo.de.lara.guarch, stable



> 
> This patch changes 'only_once' variable to 'display_once',
> which should be atomic type due to fact, that all runner functions
> can be executed in paraller way on different lcores.
> 
> Fixes: df52cb3b6e13 ("app/crypto-perf: move verify as single test type")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Tomasz Jozwiak <tjozwiakgm@gmail.com>
> ---
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>

Applied to dpdk-next-crypto

Thanks.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-07-01 11:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-14 22:28 [dpdk-dev] [PATCH] app/crypto-perf: fix display once detection Tomasz Jozwiak
2019-07-01 11:35 ` Akhil Goyal

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).