diff mbox series

[v7,12/17] test/ring: modify bulk enq/deq perf test cases

Message ID 20191220044524.32910-13-honnappa.nagarahalli@arm.com
State New
Headers show
Series lib/ring: APIs to support custom element size | expand

Commit Message

Honnappa Nagarahalli Dec. 20, 2019, 4:45 a.m. UTC
Modify test cases to test legacy and rte_ring_xxx_elem APIs for
bulk enqueue/dequeue test cases.

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

Reviewed-by: Gavin Hu <gavin.hu@arm.com>

---
 app/test/test_ring_perf.c | 57 ++++++++++-----------------------------
 1 file changed, 14 insertions(+), 43 deletions(-)

-- 
2.17.1
diff mbox series

Patch

diff --git a/app/test/test_ring_perf.c b/app/test/test_ring_perf.c
index 508c688dc..8a543b6f0 100644
--- a/app/test/test_ring_perf.c
+++ b/app/test/test_ring_perf.c
@@ -433,46 +433,6 @@  test_burst_bulk_enqueue_dequeue(struct rte_ring *r, const int esize,
 	return 0;
 }
 
-/* Times enqueue and dequeue on a single lcore */
-static void
-test_bulk_enqueue_dequeue(struct rte_ring *r)
-{
-	const unsigned iter_shift = 23;
-	const unsigned iterations = 1<<iter_shift;
-	unsigned sz, i = 0;
-	void *burst[MAX_BURST] = {0};
-
-	for (sz = 0; sz < sizeof(bulk_sizes)/sizeof(bulk_sizes[0]); sz++) {
-		const uint64_t sc_start = rte_rdtsc();
-		for (i = 0; i < iterations; i++) {
-			rte_ring_sp_enqueue_bulk(r, burst,
-					bulk_sizes[sz], NULL);
-			rte_ring_sc_dequeue_bulk(r, burst,
-					bulk_sizes[sz], NULL);
-		}
-		const uint64_t sc_end = rte_rdtsc();
-
-		const uint64_t mc_start = rte_rdtsc();
-		for (i = 0; i < iterations; i++) {
-			rte_ring_mp_enqueue_bulk(r, burst,
-					bulk_sizes[sz], NULL);
-			rte_ring_mc_dequeue_bulk(r, burst,
-					bulk_sizes[sz], NULL);
-		}
-		const uint64_t mc_end = rte_rdtsc();
-
-		double sc_avg = ((double)(sc_end-sc_start) /
-				(iterations * bulk_sizes[sz]));
-		double mc_avg = ((double)(mc_end-mc_start) /
-				(iterations * bulk_sizes[sz]));
-
-		printf("SP/SC bulk enq/dequeue (size: %u): %.2F\n", bulk_sizes[sz],
-				sc_avg);
-		printf("MP/MC bulk enq/dequeue (size: %u): %.2F\n", bulk_sizes[sz],
-				mc_avg);
-	}
-}
-
 static int
 test_ring_perf(void)
 {
@@ -499,6 +459,13 @@  test_ring_perf(void)
 	if (test_burst_bulk_enqueue_dequeue(r, -1,
 			TEST_RING_M | TEST_RING_BR) < 0)
 		return -1;
+	printf("\n### Testing bulk enq/deq ###\n");
+	if (test_burst_bulk_enqueue_dequeue(r, -1,
+			TEST_RING_S | TEST_RING_BL) < 0)
+		return -1;
+	if (test_burst_bulk_enqueue_dequeue(r, -1,
+			TEST_RING_M | TEST_RING_BL) < 0)
+		return -1;
 	rte_ring_free(r);
 
 	TEST_RING_CREATE(RING_NAME, 16, RING_SIZE, rte_socket_id(), 0, r);
@@ -517,6 +484,13 @@  test_ring_perf(void)
 	if (test_burst_bulk_enqueue_dequeue(r, 16,
 			TEST_RING_M | TEST_RING_BR) < 0)
 		return -1;
+	printf("\n### Testing bulk enq/deq ###\n");
+	if (test_burst_bulk_enqueue_dequeue(r, 16,
+			TEST_RING_S | TEST_RING_BL) < 0)
+		return -1;
+	if (test_burst_bulk_enqueue_dequeue(r, 16,
+			TEST_RING_M | TEST_RING_BL) < 0)
+		return -1;
 	rte_ring_free(r);
 
 	r = rte_ring_create(RING_NAME, RING_SIZE, rte_socket_id(), 0);
@@ -526,9 +500,6 @@  test_ring_perf(void)
 	printf("\n### Testing empty dequeue ###\n");
 	test_empty_dequeue(r);
 
-	printf("\n### Testing using a single lcore ###\n");
-	test_bulk_enqueue_dequeue(r);
-
 	if (get_two_hyperthreads(&cores) == 0) {
 		printf("\n### Testing using two hyperthreads ###\n");
 		run_on_core_pair(&cores, r, enqueue_bulk, dequeue_bulk);