From patchwork Thu Nov 1 04:54:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 47638 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C38534F9A; Thu, 1 Nov 2018 05:55:24 +0100 (CET) Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id A627D2C2F for ; Thu, 1 Nov 2018 05:55:20 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EDC5C15BE; Wed, 31 Oct 2018 21:55:19 -0700 (PDT) Received: from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com [10.118.12.122]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7567D3F557; Wed, 31 Oct 2018 21:55:19 -0700 (PDT) From: Honnappa Nagarahalli To: bruce.richardson@intel.com, pablo.de.lara.guarch@intel.com Cc: dev@dpdk.org, gavin.hu@arm.com, dharmik.thakkar@arm.com, nd@arm.com, yipeng1.wang@intel.com, sameh.gobriel@intel.com, Honnappa Nagarahalli Date: Wed, 31 Oct 2018 23:54:53 -0500 Message-Id: <20181101045454.632-3-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181101045454.632-1-honnappa.nagarahalli@arm.com> References: <1539208085-30756-4-git-send-email-yipeng1.wang@intel.com> <20181101045454.632-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH 2/3] test/hash: stop using lock ellision and read/write concurreny flags X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" With the deprecation of RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY and RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT flags, the test cases can be simplified. This results in shorter run times. Signed-off-by: Honnappa Nagarahalli Reviewed-by: Dharmik Thakkar Reviewed-by: Gavin Hu --- lib/librte_hash/rte_hash.h | 2 - test/test/test_hash_multiwriter.c | 20 +-- test/test/test_hash_perf.c | 40 +++--- test/test/test_hash_readwrite.c | 84 ++++--------- test/test/test_hash_readwrite_lf.c | 189 ++++++----------------------- 5 files changed, 82 insertions(+), 253 deletions(-) diff --git a/lib/librte_hash/rte_hash.h b/lib/librte_hash/rte_hash.h index 93c7019ec..e7e3397d5 100644 --- a/lib/librte_hash/rte_hash.h +++ b/lib/librte_hash/rte_hash.h @@ -32,7 +32,6 @@ extern "C" { /** * @deprecated - * This define will be removed in the next release. * If the target platform supports hardware transactional memory * it will be used without user consent as it provides the best possible * performance. @@ -46,7 +45,6 @@ extern "C" { /** * @deprecated - * This define will be removed in the next release. * This library should be thread-safe by default. * * Flag to support reader writer concurrency diff --git a/test/test/test_hash_multiwriter.c b/test/test/test_hash_multiwriter.c index d447f6dca..5469fb705 100644 --- a/test/test/test_hash_multiwriter.c +++ b/test/test/test_hash_multiwriter.c @@ -46,8 +46,6 @@ uint32_t rounded_nb_total_tsx_insertion; static rte_atomic64_t gcycles; static rte_atomic64_t ginsertions; -static int use_htm; - static int test_hash_multiwriter_worker(void *arg) { @@ -113,13 +111,9 @@ test_hash_multiwriter(void) .hash_func_init_val = 0, .socket_id = rte_socket_id(), }; - if (use_htm) - hash_params.extra_flag = - RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT - | RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; - else - hash_params.extra_flag = - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; + + hash_params.extra_flag = + RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; struct rte_hash *handle; char name[RTE_HASH_NAMESIZE]; @@ -272,19 +266,15 @@ test_hash_multiwriter_main(void) if (!rte_tm_supported()) { printf("Hardware transactional memory (lock elision) " "is NOT supported\n"); + printf("Test multi-writer without Hardware transactional " + "memory\n"); } else { printf("Hardware transactional memory (lock elision) " "is supported\n"); printf("Test multi-writer with Hardware transactional memory\n"); - - use_htm = 1; - if (test_hash_multiwriter() < 0) - return -1; } - printf("Test multi-writer without Hardware transactional memory\n"); - use_htm = 0; if (test_hash_multiwriter() < 0) return -1; diff --git a/test/test/test_hash_perf.c b/test/test/test_hash_perf.c index 525211180..03facd22a 100644 --- a/test/test/test_hash_perf.c +++ b/test/test/test_hash_perf.c @@ -79,7 +79,7 @@ static struct rte_hash_parameters ut_params = { static int create_table(unsigned int with_data, unsigned int table_index, - unsigned int with_locks, unsigned int ext) + unsigned int ext) { char name[RTE_HASH_NAMESIZE]; @@ -89,17 +89,11 @@ create_table(unsigned int with_data, unsigned int 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; + if (ext) + ut_params.extra_flag = RTE_HASH_EXTRA_FLAGS_EXT_TABLE; else ut_params.extra_flag = 0; - if (ext) - ut_params.extra_flag |= RTE_HASH_EXTRA_FLAGS_EXT_TABLE; - ut_params.name = name; ut_params.key_len = hashtest_key_lens[table_index]; ut_params.socket_id = rte_socket_id(); @@ -516,8 +510,7 @@ reset_table(unsigned table_index) } static int -run_all_tbl_perf_tests(unsigned int with_pushes, unsigned int with_locks, - unsigned int ext) +run_all_tbl_perf_tests(unsigned int with_pushes, unsigned int ext) { unsigned i, j, with_data, with_hash; @@ -526,7 +519,7 @@ run_all_tbl_perf_tests(unsigned int with_pushes, unsigned int with_locks, for (with_data = 0; with_data <= 1; with_data++) { for (i = 0; i < NUM_KEYSIZES; i++) { - if (create_table(with_data, i, with_locks, ext) < 0) + if (create_table(with_data, i, ext) < 0) return -1; if (get_input_keys(with_pushes, i, ext) < 0) @@ -669,25 +662,20 @@ fbk_hash_perf_test(void) static int test_hash_perf(void) { - 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"); + unsigned int with_pushes; + + for (with_pushes = 0; with_pushes <= 1; with_pushes++) { + if (with_pushes == 0) + printf("\nALL ELEMENTS IN PRIMARY LOCATION\n"); else - 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) < 0) - return -1; - } + printf("\nELEMENTS IN PRIMARY OR SECONDARY LOCATION\n"); + if (run_all_tbl_perf_tests(with_pushes, 0) < 0) + return -1; } printf("\n EXTENDABLE BUCKETS PERFORMANCE\n"); - if (run_all_tbl_perf_tests(1, 0, 1) < 0) + if (run_all_tbl_perf_tests(1, 1) < 0) return -1; if (fbk_hash_perf_test() < 0) diff --git a/test/test/test_hash_readwrite.c b/test/test/test_hash_readwrite.c index 01f986cf4..d389723aa 100644 --- a/test/test/test_hash_readwrite.c +++ b/test/test/test_hash_readwrite.c @@ -35,7 +35,7 @@ struct perf { uint32_t read_write_w[NUM_TEST]; }; -static struct perf htm_results, non_htm_results; +static struct perf results; struct { uint32_t *keys; @@ -121,7 +121,7 @@ test_hash_readwrite_worker(__attribute__((unused)) void *arg) } static int -init_params(int use_ext, int use_htm, int use_jhash) +init_params(int use_ext, int use_jhash) { unsigned int i; @@ -140,15 +140,8 @@ init_params(int use_ext, int use_htm, int use_jhash) else hash_params.hash_func = rte_hash_crc; - if (use_htm) - hash_params.extra_flag = - RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT | - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; - else - hash_params.extra_flag = - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; + hash_params.extra_flag = + RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; if (use_ext) hash_params.extra_flag |= @@ -195,7 +188,7 @@ init_params(int use_ext, int use_htm, int use_jhash) } static int -test_hash_readwrite_functional(int use_ext, int use_htm) +test_hash_readwrite_functional(int use_ext) { unsigned int i; const void *next_key; @@ -214,7 +207,7 @@ test_hash_readwrite_functional(int use_ext, int use_htm) rte_atomic64_init(&ginsertions); rte_atomic64_clear(&ginsertions); - if (init_params(use_ext, use_htm, use_jhash) != 0) + if (init_params(use_ext, use_jhash) != 0) goto err; if (use_ext) @@ -351,8 +344,7 @@ test_rw_writer(void *arg) } static int -test_hash_readwrite_perf(struct perf *perf_results, int use_htm, - int reader_faster) +test_hash_readwrite_perf(struct perf *perf_results, int reader_faster) { unsigned int n; int ret; @@ -379,7 +371,7 @@ test_hash_readwrite_perf(struct perf *perf_results, int use_htm, rte_atomic64_init(&gwrite_cycles); rte_atomic64_clear(&gwrite_cycles); - if (init_params(0, use_htm, use_jhash) != 0) + if (init_params(0, use_jhash) != 0) goto err; /* @@ -608,12 +600,11 @@ test_hash_readwrite_main(void) { /* * Variables used to choose different tests. - * use_htm indicates if hardware transactional memory should be used. * reader_faster indicates if the reader threads should finish earlier * than writer threads. This is to timing either reader threads or * writer threads for performance numbers. */ - int use_htm, use_ext, reader_faster; + int use_ext, reader_faster; unsigned int i = 0, core_id = 0; if (rte_lcore_count() <= 2) { @@ -634,69 +625,40 @@ test_hash_readwrite_main(void) "is supported\n"); printf("Test read-write with Hardware transactional memory\n"); - - use_htm = 1; - use_ext = 0; - - if (test_hash_readwrite_functional(use_ext, use_htm) < 0) - return -1; - - use_ext = 1; - if (test_hash_readwrite_functional(use_ext, use_htm) < 0) - return -1; - - reader_faster = 1; - if (test_hash_readwrite_perf(&htm_results, use_htm, - reader_faster) < 0) - return -1; - - reader_faster = 0; - if (test_hash_readwrite_perf(&htm_results, use_htm, - reader_faster) < 0) - return -1; } else { printf("Hardware transactional memory (lock elision) " "is NOT supported\n"); + + printf("Test read-write without Hardware transactional " + "memory\n"); } - printf("Test read-write without Hardware transactional memory\n"); - use_htm = 0; use_ext = 0; - if (test_hash_readwrite_functional(use_ext, use_htm) < 0) + if (test_hash_readwrite_functional(use_ext) < 0) return -1; use_ext = 1; - if (test_hash_readwrite_functional(use_ext, use_htm) < 0) + if (test_hash_readwrite_functional(use_ext) < 0) return -1; reader_faster = 1; - if (test_hash_readwrite_perf(&non_htm_results, use_htm, - reader_faster) < 0) + if (test_hash_readwrite_perf(&results, reader_faster) < 0) return -1; + reader_faster = 0; - if (test_hash_readwrite_perf(&non_htm_results, use_htm, - reader_faster) < 0) + if (test_hash_readwrite_perf(&results, reader_faster) < 0) return -1; printf("Results summary:\n"); - printf("single read: %u\n", htm_results.single_read); - printf("single write: %u\n", htm_results.single_write); + printf("single read: %u\n", results.single_read); + printf("single write: %u\n", results.single_write); for (i = 0; i < NUM_TEST; i++) { printf("core_cnt: %u\n", core_cnt[i]); - printf("HTM:\n"); - printf("read only: %u\n", htm_results.read_only[i]); - printf("write only: %u\n", htm_results.write_only[i]); - printf("read-write read: %u\n", htm_results.read_write_r[i]); - printf("read-write write: %u\n", htm_results.read_write_w[i]); - - printf("non HTM:\n"); - printf("read only: %u\n", non_htm_results.read_only[i]); - printf("write only: %u\n", non_htm_results.write_only[i]); - printf("read-write read: %u\n", - non_htm_results.read_write_r[i]); - printf("read-write write: %u\n", - non_htm_results.read_write_w[i]); + printf("read only: %u\n", results.read_only[i]); + printf("write only: %u\n", results.write_only[i]); + printf("read-write read: %u\n", results.read_write_r[i]); + printf("read-write write: %u\n", results.read_write_w[i]); } return 0; diff --git a/test/test/test_hash_readwrite_lf.c b/test/test/test_hash_readwrite_lf.c index cbfd93226..9d459aeb8 100644 --- a/test/test/test_hash_readwrite_lf.c +++ b/test/test/test_hash_readwrite_lf.c @@ -22,20 +22,9 @@ #define BULK_LOOKUP_SIZE 32 -#define RUN_WITH_HTM_DISABLED 0 - -#if (RUN_WITH_HTM_DISABLED) - -#define TOTAL_ENTRY (5*1024) -#define TOTAL_INSERT (5*1024) - -#else - #define TOTAL_ENTRY (4*1024*1024) #define TOTAL_INSERT (4*1024*1024) -#endif - #define READ_FAIL 1 #define READ_PASS_NO_KEY_SHIFTS 2 #define READ_PASS_SHIFT_PATH 4 @@ -53,7 +42,7 @@ struct rwc_perf { uint32_t multi_rw[NUM_TEST - 1][2][NUM_TEST]; }; -static struct rwc_perf rwc_lf_results, rwc_non_lf_results; +static struct rwc_perf rwc_lf_results; struct { uint32_t *keys; @@ -395,7 +384,7 @@ generate_keys(void) } static int -init_params(int rwc_lf, int use_jhash, int htm) +init_params(int use_jhash) { struct rte_hash *handle; @@ -411,19 +400,8 @@ init_params(int rwc_lf, int use_jhash, int htm) else hash_params.hash_func = rte_hash_crc; - if (rwc_lf) - hash_params.extra_flag = - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF | - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; - else if (htm) - hash_params.extra_flag = - RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT | - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; - else - hash_params.extra_flag = - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; + hash_params.extra_flag = RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD | + RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF; hash_params.name = "tests"; @@ -580,8 +558,7 @@ test_rwc_multi_writer(__attribute__((unused)) void *arg) * Reader(s) lookup keys present in the table. */ static int -test_hash_add_no_ks_lookup_hit(struct rwc_perf *rwc_perf_results, int rwc_lf, - int htm) +test_hash_add_no_ks_lookup_hit(struct rwc_perf *rwc_perf_results) { unsigned int n, m; uint64_t i; @@ -592,7 +569,7 @@ test_hash_add_no_ks_lookup_hit(struct rwc_perf *rwc_perf_results, int rwc_lf, rte_atomic64_init(&greads); rte_atomic64_init(&gread_cycles); - if (init_params(rwc_lf, use_jhash, htm) != 0) + if (init_params(use_jhash) != 0) goto err; printf("\nTest: Hash add - no key-shifts, read - hit\n"); for (m = 0; m < 2; m++) { @@ -649,8 +626,7 @@ test_hash_add_no_ks_lookup_hit(struct rwc_perf *rwc_perf_results, int rwc_lf, * 'Main' thread adds with no key-shifts. */ static int -test_hash_add_no_ks_lookup_miss(struct rwc_perf *rwc_perf_results, int rwc_lf, - int htm) +test_hash_add_no_ks_lookup_miss(struct rwc_perf *rwc_perf_results) { unsigned int n, m; uint64_t i; @@ -662,7 +638,7 @@ test_hash_add_no_ks_lookup_miss(struct rwc_perf *rwc_perf_results, int rwc_lf, rte_atomic64_init(&greads); rte_atomic64_init(&gread_cycles); - if (init_params(rwc_lf, use_jhash, htm) != 0) + if (init_params(use_jhash) != 0) goto err; printf("\nTest: Hash add - no key-shifts, Hash lookup - miss\n"); for (m = 0; m < 2; m++) { @@ -721,8 +697,7 @@ test_hash_add_no_ks_lookup_miss(struct rwc_perf *rwc_perf_results, int rwc_lf, * shift path while 'Main' thread adds keys causing key-shifts. */ static int -test_hash_add_ks_lookup_hit_non_sp(struct rwc_perf *rwc_perf_results, - int rwc_lf, int htm) +test_hash_add_ks_lookup_hit_non_sp(struct rwc_perf *rwc_perf_results) { unsigned int n, m; uint64_t i; @@ -734,7 +709,7 @@ test_hash_add_ks_lookup_hit_non_sp(struct rwc_perf *rwc_perf_results, rte_atomic64_init(&greads); rte_atomic64_init(&gread_cycles); - if (init_params(rwc_lf, use_jhash, htm) != 0) + if (init_params(use_jhash) != 0) goto err; printf("\nTest: Hash add - key shift, Hash lookup - hit" " (non-shift-path)\n"); @@ -797,8 +772,7 @@ test_hash_add_ks_lookup_hit_non_sp(struct rwc_perf *rwc_perf_results, * 'Main' thread adds keys causing key-shifts. */ static int -test_hash_add_ks_lookup_hit_sp(struct rwc_perf *rwc_perf_results, int rwc_lf, - int htm) +test_hash_add_ks_lookup_hit_sp(struct rwc_perf *rwc_perf_results) { unsigned int n, m; uint64_t i; @@ -810,7 +784,7 @@ test_hash_add_ks_lookup_hit_sp(struct rwc_perf *rwc_perf_results, int rwc_lf, rte_atomic64_init(&greads); rte_atomic64_init(&gread_cycles); - if (init_params(rwc_lf, use_jhash, htm) != 0) + if (init_params(use_jhash) != 0) goto err; printf("\nTest: Hash add - key shift, Hash lookup - hit (shift-path)" "\n"); @@ -873,8 +847,7 @@ test_hash_add_ks_lookup_hit_sp(struct rwc_perf *rwc_perf_results, int rwc_lf, * 'Main' thread adds keys causing key-shifts. */ static int -test_hash_add_ks_lookup_miss(struct rwc_perf *rwc_perf_results, int rwc_lf, int - htm) +test_hash_add_ks_lookup_miss(struct rwc_perf *rwc_perf_results) { unsigned int n, m; uint64_t i; @@ -886,7 +859,7 @@ test_hash_add_ks_lookup_miss(struct rwc_perf *rwc_perf_results, int rwc_lf, int rte_atomic64_init(&greads); rte_atomic64_init(&gread_cycles); - if (init_params(rwc_lf, use_jhash, htm) != 0) + if (init_params(use_jhash) != 0) goto err; printf("\nTest: Hash add - key shift, Hash lookup - miss\n"); for (m = 0; m < 2; m++) { @@ -948,8 +921,7 @@ test_hash_add_ks_lookup_miss(struct rwc_perf *rwc_perf_results, int rwc_lf, int * Writers are running in parallel, on different data plane cores. */ static int -test_hash_multi_add_lookup(struct rwc_perf *rwc_perf_results, int rwc_lf, - int htm) +test_hash_multi_add_lookup(struct rwc_perf *rwc_perf_results) { unsigned int n, m, k; uint64_t i; @@ -960,7 +932,7 @@ test_hash_multi_add_lookup(struct rwc_perf *rwc_perf_results, int rwc_lf, rte_atomic64_init(&greads); rte_atomic64_init(&gread_cycles); - if (init_params(rwc_lf, use_jhash, htm) != 0) + if (init_params(use_jhash) != 0) goto err; printf("\nTest: Multi-add-lookup\n"); uint8_t pos_core; @@ -1048,14 +1020,6 @@ test_hash_multi_add_lookup(struct rwc_perf *rwc_perf_results, int rwc_lf, static int test_hash_readwrite_lf_main(void) { - /* - * Variables used to choose different tests. - * rwc_lf indicates if read-write concurrency lock-free support is - * enabled. - * htm indicates if Hardware transactional memory support is enabled. - */ - int rwc_lf = 0; - int htm; int use_jhash = 0; if (rte_lcore_count() == 1) { printf("More than one lcore is required " @@ -1065,12 +1029,7 @@ test_hash_readwrite_lf_main(void) setlocale(LC_NUMERIC, ""); - if (rte_tm_supported()) - htm = 1; - else - htm = 0; - - if (init_params(rwc_lf, use_jhash, htm) != 0) + if (init_params(use_jhash) != 0) return -1; if (generate_keys() != 0) return -1; @@ -1078,133 +1037,65 @@ test_hash_readwrite_lf_main(void) return -1; if (RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF) { - rwc_lf = 1; - printf("Test lookup with read-write concurrency lock free support" - " enabled\n"); - if (test_hash_add_no_ks_lookup_hit(&rwc_lf_results, rwc_lf, - htm) < 0) + printf("Test lookup with read-write concurrency lock free " + "support enabled\n"); + if (test_hash_add_no_ks_lookup_hit(&rwc_lf_results) < 0) return -1; - if (test_hash_add_no_ks_lookup_miss(&rwc_lf_results, rwc_lf, - htm) < 0) + if (test_hash_add_no_ks_lookup_miss(&rwc_lf_results) < 0) return -1; - if (test_hash_add_ks_lookup_hit_non_sp(&rwc_lf_results, rwc_lf, - htm) < 0) + if (test_hash_add_ks_lookup_hit_non_sp(&rwc_lf_results) < 0) return -1; - if (test_hash_add_ks_lookup_hit_sp(&rwc_lf_results, rwc_lf, - htm) < 0) + if (test_hash_add_ks_lookup_hit_sp(&rwc_lf_results) < 0) return -1; - if (test_hash_add_ks_lookup_miss(&rwc_lf_results, rwc_lf, htm) - < 0) + if (test_hash_add_ks_lookup_miss(&rwc_lf_results) < 0) return -1; - if (test_hash_multi_add_lookup(&rwc_lf_results, rwc_lf, htm) - < 0) + if (test_hash_multi_add_lookup(&rwc_lf_results) < 0) return -1; } - printf("\nTest lookup with read-write concurrency lock free support" - " disabled\n"); - rwc_lf = 0; - if (!htm) { - printf("With HTM Disabled\n"); - if (!RUN_WITH_HTM_DISABLED) { - printf("Enable RUN_WITH_HTM_DISABLED to test with" - " lock-free disabled"); - goto results; - } - } else - printf("With HTM Enabled\n"); - if (test_hash_add_no_ks_lookup_hit(&rwc_non_lf_results, rwc_lf, htm) - < 0) - return -1; - if (test_hash_add_no_ks_lookup_miss(&rwc_non_lf_results, rwc_lf, htm) - < 0) - return -1; - if (test_hash_add_ks_lookup_hit_non_sp(&rwc_non_lf_results, rwc_lf, - htm) < 0) - return -1; - if (test_hash_add_ks_lookup_hit_sp(&rwc_non_lf_results, rwc_lf, htm) - < 0) - return -1; - if (test_hash_add_ks_lookup_miss(&rwc_non_lf_results, rwc_lf, htm) < 0) - return -1; - if (test_hash_multi_add_lookup(&rwc_non_lf_results, rwc_lf, htm) < 0) - return -1; -results: + printf("\n\t\t\t\t\t\t********** Results summary **********\n\n"); int i, j, k; for (j = 0; j < 2; j++) { if (j == 1) printf("\n\t\t\t\t\t#######********** Bulk Lookup " "**********#######\n\n"); - printf("_______\t\t_______\t\t_________\t___\t\t_________\t\t" - "\t\t\t\t_________________\n"); - printf("Writers\t\tReaders\t\tLock-free\tHTM\t\tTest-case\t\t\t" + printf("_______\t\t_______\t\t_________\t\t\t" + "\t\t\t_________________\n"); + printf("Writers\t\tReaders\t\tTest-case\t\t\t" "\t\t\tCycles per lookup\n"); - printf("_______\t\t_______\t\t_________\t___\t\t_________\t\t\t" + printf("_______\t\t_______\t\t_________\t\t\t" "\t\t\t_________________\n"); for (i = 0; i < NUM_TEST; i++) { printf("%u\t\t%u\t\t", 1, rwc_core_cnt[i]); - printf("Enabled\t\t"); - printf("N/A\t\t"); printf("Hash add - no key-shifts, lookup - hit\t\t\t\t" - "%u\n\t\t\t\t\t\t\t\t", + "%u\n\t\t\t\t", rwc_lf_results.w_no_ks_r_hit[j][i]); printf("Hash add - no key-shifts, lookup - miss\t\t\t\t" - "%u\n\t\t\t\t\t\t\t\t", + "%u\n\t\t\t\t", rwc_lf_results.w_no_ks_r_miss[j][i]); printf("Hash add - key-shifts, lookup - hit" - "(non-shift-path)\t\t%u\n\t\t\t\t\t\t\t\t", + "(non-shift-path)\t\t%u\n\t\t\t\t", rwc_lf_results.w_ks_r_hit_nsp[j][i]); printf("Hash add - key-shifts, lookup - hit " - "(shift-path)\t\t%u\n\t\t\t\t\t\t\t\t", + "(shift-path)\t\t%u\n\t\t\t\t", rwc_lf_results.w_ks_r_hit_sp[j][i]); printf("Hash add - key-shifts, Hash lookup miss\t\t\t\t" - "%u\n\n\t\t\t\t", + "%u\n\n", rwc_lf_results.w_ks_r_miss[j][i]); - printf("Disabled\t"); - if (htm) - printf("Enabled\t\t"); - else - printf("Disabled\t"); - printf("Hash add - no key-shifts, lookup - hit\t\t\t\t" - "%u\n\t\t\t\t\t\t\t\t", - rwc_non_lf_results.w_no_ks_r_hit[j][i]); - printf("Hash add - no key-shifts, lookup - miss\t\t\t\t" - "%u\n\t\t\t\t\t\t\t\t", - rwc_non_lf_results.w_no_ks_r_miss[j][i]); - printf("Hash add - key-shifts, lookup - hit " - "(non-shift-path)\t\t%u\n\t\t\t\t\t\t\t\t", - rwc_non_lf_results.w_ks_r_hit_nsp[j][i]); - printf("Hash add - key-shifts, lookup - hit " - "(shift-path)\t\t%u\n\t\t\t\t\t\t\t\t", - rwc_non_lf_results.w_ks_r_hit_sp[j][i]); - printf("Hash add - key-shifts, Hash lookup miss\t\t\t\t" - "%u\n", rwc_non_lf_results.w_ks_r_miss[j][i]); - - printf("_______\t\t_______\t\t_________\t___\t\t" - "_________\t\t\t\t\t\t_________________\n"); + printf("_______\t\t_______\t\t_________\t\t\t" + "\t\t\t_________________\n"); } for (i = 1; i < NUM_TEST; i++) { for (k = 0; k < NUM_TEST; k++) { printf("%u", rwc_core_cnt[i]); printf("\t\t%u\t\t", rwc_core_cnt[k]); - printf("Enabled\t\t"); - printf("N/A\t\t"); - printf("Multi-add-lookup\t\t\t\t\t\t%u\n\n\t\t" - "\t\t", + printf("Multi-add-lookup\t\t\t\t\t\t%u\n\n", rwc_lf_results.multi_rw[i][j][k]); - printf("Disabled\t"); - if (htm) - printf("Enabled\t\t"); - else - printf("Disabled\t"); - printf("Multi-add-lookup\t\t\t\t\t\t%u\n", - rwc_non_lf_results.multi_rw[i][j][k]); - printf("_______\t\t_______\t\t_________\t___" - "\t\t_________\t\t\t\t\t\t" - "_________________\n"); + printf("_______\t\t_______\t\t_________\t\t\t" + "\t\t\t_________________\n"); } } }