MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_hash_readwrite_perf

Function test_hash_readwrite_perf

dpdk/app/test/test_hash_readwrite.c:353–602  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

351}
352
353static int
354test_hash_readwrite_perf(struct perf *perf_results, int use_htm,
355 int reader_faster)
356{
357 unsigned int n;
358 int ret;
359 int start_coreid;
360 uint64_t i, read_cnt;
361
362 const void *next_key;
363 void *next_data;
364 uint32_t iter;
365 int use_jhash = 0;
366
367 uint32_t duplicated_keys = 0;
368 uint32_t lost_keys = 0;
369
370 uint64_t start = 0, end = 0;
371
372 __atomic_store_n(&gwrites, 0, __ATOMIC_RELAXED);
373 __atomic_store_n(&greads, 0, __ATOMIC_RELAXED);
374
375 __atomic_store_n(&gread_cycles, 0, __ATOMIC_RELAXED);
376 __atomic_store_n(&gwrite_cycles, 0, __ATOMIC_RELAXED);
377
378 if (init_params(0, use_htm, 0, use_jhash) != 0)
379 goto err;
380
381 /*
382 * Do a readers finish faster or writers finish faster test.
383 * When readers finish faster, we timing the readers, and when writers
384 * finish faster, we timing the writers.
385 * Divided by 10 or 2 is just experimental values to vary the workload
386 * of readers.
387 */
388 if (reader_faster) {
389 printf("++++++Start perf test: reader++++++++\n");
390 read_cnt = TOTAL_INSERT / 10;
391 } else {
392 printf("++++++Start perf test: writer++++++++\n");
393 read_cnt = TOTAL_INSERT / 2;
394 }
395
396 /* We first test single thread performance */
397 start = rte_rdtsc_precise();
398 /* Insert half of the keys */
399 for (i = 0; i < TOTAL_INSERT / 2; i++) {
400 ret = rte_hash_add_key_data(tbl_rw_test_param.h,
401 tbl_rw_test_param.keys + i,
402 (void *)((uintptr_t)i));
403 if (ret < 0) {
404 printf("Failed to insert half of keys\n");
405 goto err_free;
406 }
407 }
408 end = rte_rdtsc_precise() - start;
409 perf_results->single_write = end / i;
410

Callers 1

test_hash_rw_perf_mainFunction · 0.85

Calls 13

rte_hash_add_key_dataFunction · 0.85
rte_hash_lookup_dataFunction · 0.85
rte_lcore_countFunction · 0.85
rte_hash_resetFunction · 0.85
rte_eal_remote_launchFunction · 0.85
rte_eal_mp_wait_lcoreFunction · 0.85
memsetFunction · 0.85
rte_hash_iterateFunction · 0.85
rte_freeFunction · 0.85
rte_hash_freeFunction · 0.85
init_paramsFunction · 0.70
printfFunction · 0.50

Tested by

no test coverage detected