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

Function timer_stress_main_loop

dpdk/app/test/test_timer.c:164–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162}
163
164static int
165timer_stress_main_loop(__rte_unused void *arg)
166{
167 uint64_t hz = rte_get_timer_hz();
168 unsigned lcore_id = rte_lcore_id();
169 uint64_t cur_time;
170 int64_t diff = 0;
171 long r;
172
173 while (diff >= 0) {
174
175 /* call the timer handler on each core */
176 rte_timer_manage();
177
178 /* simulate the processing of a packet
179 * (1 us = 2000 cycles at 2 Ghz) */
180 rte_delay_us(1);
181
182 /* randomly stop or reset timer */
183 r = rte_rand();
184 lcore_id = rte_get_next_lcore(lcore_id, 0, 1);
185 if ((r & 0xff) == 0) {
186 /* 100 us */
187 mytimer_reset(&mytiminfo[0], hz/10000, SINGLE, lcore_id,
188 timer_stress_cb);
189 }
190 else if ((r & 0xff) == 1) {
191 rte_timer_stop_sync(&mytiminfo[0].tim);
192 }
193 cur_time = rte_get_timer_cycles();
194 diff = end_time - cur_time;
195 }
196
197 lcore_id = rte_lcore_id();
198 RTE_LOG(INFO, TESTTIMER, "core %u finished\n", lcore_id);
199
200 return 0;
201}
202
203/* Need to synchronize worker lcores through multiple steps. */
204enum { WORKER_WAITING = 1, WORKER_RUN_SIGNAL, WORKER_RUNNING, WORKER_FINISHED };

Callers

nothing calls this directly

Calls 6

rte_lcore_idFunction · 0.85
rte_timer_manageFunction · 0.85
rte_randFunction · 0.85
rte_get_next_lcoreFunction · 0.85
mytimer_resetFunction · 0.85
rte_timer_stop_syncFunction · 0.85

Tested by

no test coverage detected