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

Function lcore_mainloop

dpdk/examples/timer/main.c:59–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57/* >8 End of timer1 callback. */
58
59static __rte_noreturn int
60lcore_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
86int
87main(int argc, char **argv)

Callers 1

mainFunction · 0.85

Calls 3

rte_lcore_idFunction · 0.85
rte_timer_manageFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected