diff mbox series

[v5,6/8] test: add tests in hash table perf test

Message ID 1531242001-381104-7-git-send-email-yipeng1.wang@intel.com (mailing list archive)
State Accepted, archived
Headers show
Series Add read-write concurrency to rte_hash library | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Wang, Yipeng1 July 10, 2018, 4:59 p.m. UTC
New code is added to support read-write concurrency for
rte_hash. Due to the newly added code in critial path,
the perf test is modified to show any performance impact.
It is still a single-thread test.

Signed-off-by: Yipeng Wang <yipeng1.wang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 test/test/test_hash_perf.c | 36 +++++++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/test/test/test_hash_perf.c b/test/test/test_hash_perf.c
index a81d0c7..33dcb9f 100644
--- a/test/test/test_hash_perf.c
+++ b/test/test/test_hash_perf.c
@@ -76,7 +76,8 @@  static struct rte_hash_parameters ut_params = {
 };
 
 static int
-create_table(unsigned with_data, unsigned table_index)
+create_table(unsigned int with_data, unsigned int table_index,
+		unsigned int with_locks)
 {
 	char name[RTE_HASH_NAMESIZE];
 
@@ -86,6 +87,14 @@  create_table(unsigned with_data, unsigned table_index)
 	else
 		sprintf(name, "test_hash%d", hashtest_key_lens[table_index]);
 
+
+	if (with_locks)
+		ut_params.extra_flag =
+			RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT
+				| RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY;
+	else
+		ut_params.extra_flag = 0;
+
 	ut_params.name = name;
 	ut_params.key_len = hashtest_key_lens[table_index];
 	ut_params.socket_id = rte_socket_id();
@@ -459,7 +468,7 @@  reset_table(unsigned table_index)
 }
 
 static int
-run_all_tbl_perf_tests(unsigned with_pushes)
+run_all_tbl_perf_tests(unsigned int with_pushes, unsigned int with_locks)
 {
 	unsigned i, j, with_data, with_hash;
 
@@ -468,7 +477,7 @@  run_all_tbl_perf_tests(unsigned with_pushes)
 
 	for (with_data = 0; with_data <= 1; with_data++) {
 		for (i = 0; i < NUM_KEYSIZES; i++) {
-			if (create_table(with_data, i) < 0)
+			if (create_table(with_data, i, with_locks) < 0)
 				return -1;
 
 			if (get_input_keys(with_pushes, i) < 0)
@@ -611,15 +620,20 @@  fbk_hash_perf_test(void)
 static int
 test_hash_perf(void)
 {
-	unsigned with_pushes;
-
-	for (with_pushes = 0; with_pushes <= 1; with_pushes++) {
-		if (with_pushes == 0)
-			printf("\nALL ELEMENTS IN PRIMARY LOCATION\n");
+	unsigned int with_pushes, with_locks;
+	for (with_locks = 0; with_locks <= 1; with_locks++) {
+		if (with_locks)
+			printf("\nWith locks in the code\n");
 		else
-			printf("\nELEMENTS IN PRIMARY OR SECONDARY LOCATION\n");
-		if (run_all_tbl_perf_tests(with_pushes) < 0)
-			return -1;
+			printf("\nWithout locks in the code\n");
+		for (with_pushes = 0; with_pushes <= 1; with_pushes++) {
+			if (with_pushes == 0)
+				printf("\nALL ELEMENTS IN PRIMARY LOCATION\n");
+			else
+				printf("\nELEMENTS IN PRIMARY OR SECONDARY LOCATION\n");
+			if (run_all_tbl_perf_tests(with_pushes, with_locks) < 0)
+				return -1;
+		}
 	}
 	if (fbk_hash_perf_test() < 0)
 		return -1;