* 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. */
| 425 | * takes on a single lcore. Result is for comparison with the bulk enq+deq. |
| 426 | */ |
| 427 | static int |
| 428 | test_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 |
no test coverage detected