| 57 | /* >8 End of timer1 callback. */ |
| 58 | |
| 59 | static __rte_noreturn int |
| 60 | lcore_mainloop(__rte_unused void *arg) |
| 61 | { |
| 62 | uint64_t prev_tsc = 0, cur_tsc, diff_tsc; |
| 63 | unsigned lcore_id; |
| 64 | |
| 65 | lcore_id = rte_lcore_id(); |
| 66 | printf("Starting mainloop on core %u\n", lcore_id); |
| 67 | |
| 68 | /* Main loop. 8< */ |
| 69 | while (1) { |
| 70 | /* |
| 71 | * Call the timer handler on each core: as we don't need a |
| 72 | * very precise timer, so only call rte_timer_manage() |
| 73 | * every ~10ms. In a real application, this will enhance |
| 74 | * performances as reading the HPET timer is not efficient. |
| 75 | */ |
| 76 | cur_tsc = rte_get_timer_cycles(); |
| 77 | diff_tsc = cur_tsc - prev_tsc; |
| 78 | if (diff_tsc > timer_resolution_cycles) { |
| 79 | rte_timer_manage(); |
| 80 | prev_tsc = cur_tsc; |
| 81 | } |
| 82 | } |
| 83 | /* >8 End of main loop. */ |
| 84 | } |
| 85 | |
| 86 | int |
| 87 | main(int argc, char **argv) |
no test coverage detected