* Measure the cycle cost of pushing and popping a single pointer on a single * lcore. */
| 249 | * lcore. |
| 250 | */ |
| 251 | static void |
| 252 | test_single_push_pop(struct rte_stack *s) |
| 253 | { |
| 254 | unsigned int iterations = 16000000; |
| 255 | void *obj = NULL; |
| 256 | unsigned int i; |
| 257 | |
| 258 | uint64_t start = rte_rdtsc(); |
| 259 | |
| 260 | for (i = 0; i < iterations; i++) { |
| 261 | rte_stack_push(s, &obj, 1); |
| 262 | rte_stack_pop(s, &obj, 1); |
| 263 | } |
| 264 | |
| 265 | uint64_t end = rte_rdtsc(); |
| 266 | |
| 267 | printf("Average cycles per single object push/pop: %.2F\n", |
| 268 | ((double)(end - start)) / iterations); |
| 269 | } |
| 270 | |
| 271 | /* Measure the cycle cost of bulk pushing and popping on a single lcore. */ |
| 272 | static void |
no test coverage detected