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

Function test_single_enqueue_dequeue

dpdk/app/test/test_ring_perf.c:427–454  ·  view source on GitHub ↗

* Test function that determines how long an enqueue + dequeue of a single item * takes on a single lcore. Result is for comparison with the bulk enq+deq. */

Source from the content-addressed store, hash-verified

425 * takes on a single lcore. Result is for comparison with the bulk enq+deq.
426 */
427static int
428test_single_enqueue_dequeue(struct rte_ring *r, const int esize,
429 const unsigned int api_type)
430{
431 const unsigned int iter_shift = 24;
432 const unsigned int iterations = 1 << iter_shift;
433 unsigned int i = 0;
434 void *burst = NULL;
435
436 /* alloc dummy object pointers */
437 burst = test_ring_calloc(1, esize);
438 if (burst == NULL)
439 return -1;
440
441 const uint64_t start = rte_rdtsc();
442 for (i = 0; i < iterations; i++) {
443 test_ring_enqueue(r, burst, esize, 1, api_type);
444 test_ring_dequeue(r, burst, esize, 1, api_type);
445 }
446 const uint64_t end = rte_rdtsc();
447
448 test_ring_print_test_string(api_type, esize, 1,
449 ((double)(end - start)) / iterations);
450
451 rte_free(burst);
452
453 return 0;
454}
455
456/*
457 * Test that does both enqueue and dequeue on a core using the burst/bulk API

Callers 1

test_ring_perf_esizeFunction · 0.70

Calls 6

test_ring_callocFunction · 0.85
test_ring_enqueueFunction · 0.85
test_ring_dequeueFunction · 0.85
rte_freeFunction · 0.85
rte_rdtscFunction · 0.50

Tested by

no test coverage detected