Measure the cycle cost of bulk pushing and popping on a single lcore. */
| 270 | |
| 271 | /* Measure the cycle cost of bulk pushing and popping on a single lcore. */ |
| 272 | static void |
| 273 | test_bulk_push_pop(struct rte_stack *s) |
| 274 | { |
| 275 | unsigned int iterations = 8000000; |
| 276 | void *objs[MAX_BURST]; |
| 277 | unsigned int sz, i; |
| 278 | |
| 279 | for (sz = 0; sz < RTE_DIM(bulk_sizes); sz++) { |
| 280 | uint64_t start = rte_rdtsc(); |
| 281 | |
| 282 | for (i = 0; i < iterations; i++) { |
| 283 | rte_stack_push(s, objs, bulk_sizes[sz]); |
| 284 | rte_stack_pop(s, objs, bulk_sizes[sz]); |
| 285 | } |
| 286 | |
| 287 | uint64_t end = rte_rdtsc(); |
| 288 | |
| 289 | double avg = ((double)(end - start) / |
| 290 | (iterations * bulk_sizes[sz])); |
| 291 | |
| 292 | printf("Average cycles per object push/pop (bulk size: %u): %.2F\n", |
| 293 | bulk_sizes[sz], avg); |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | static int |
| 298 | __test_stack_perf(uint32_t flags) |
no test coverage detected