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

Function main

dpdk/examples/timer/main.c:86–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86int
87main(int argc, char **argv)
88{
89 int ret;
90 uint64_t hz;
91 unsigned lcore_id;
92
93 /* Init EAL. 8< */
94 ret = rte_eal_init(argc, argv);
95 if (ret < 0)
96 rte_panic("Cannot init EAL\n");
97
98 /* init RTE timer library */
99 rte_timer_subsystem_init();
100 /* >8 End of init EAL. */
101
102 /* Init timer structures. 8< */
103 rte_timer_init(&timer0);
104 rte_timer_init(&timer1);
105 /* >8 End of init timer structures. */
106
107 /* Load timer0, every second, on main lcore, reloaded automatically. 8< */
108 hz = rte_get_timer_hz();
109 timer_resolution_cycles = hz * 10 / 1000; /* around 10ms */
110
111 lcore_id = rte_lcore_id();
112 rte_timer_reset(&timer0, hz, PERIODICAL, lcore_id, timer0_cb, NULL);
113
114 /* load timer1, every second/3, on next lcore, reloaded manually */
115 lcore_id = rte_get_next_lcore(lcore_id, 0, 1);
116 rte_timer_reset(&timer1, hz/3, SINGLE, lcore_id, timer1_cb, NULL);
117
118 /* >8 End of two timers configured. */
119
120 /* Call lcore_mainloop() on every worker lcore. 8< */
121 RTE_LCORE_FOREACH_WORKER(lcore_id) {
122 rte_eal_remote_launch(lcore_mainloop, NULL, lcore_id);
123 }
124
125 /* call it on main lcore too */
126 (void) lcore_mainloop(NULL);
127 /* >8 End of call lcore_mainloop() on every worker lcore. */
128
129 /* clean up the EAL */
130 rte_eal_cleanup();
131
132 return 0;
133}

Callers

nothing calls this directly

Calls 9

rte_timer_subsystem_initFunction · 0.85
rte_timer_initFunction · 0.85
rte_lcore_idFunction · 0.85
rte_timer_resetFunction · 0.85
rte_get_next_lcoreFunction · 0.85
rte_eal_remote_launchFunction · 0.85
lcore_mainloopFunction · 0.85
rte_eal_initFunction · 0.50
rte_eal_cleanupFunction · 0.50

Tested by

no test coverage detected