MCPcopy Index your code
hub / github.com/F-Stack/f-stack / reload_timer

Function reload_timer

dpdk/app/test/test_timer_racecond.c:55–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53RTE_DEFINE_PER_LCORE(unsigned, n_reset_collisions);
54
55static int
56reload_timer(struct rte_timer *tim)
57{
58 /* Make timer expire roughly when the TSC hits the next BILLION
59 * multiple. Add in timer's index to make them expire in nearly
60 * sorted order. This makes all timers somewhat synchronized,
61 * firing ~2-3 times per second, assuming 2-3 GHz TSCs.
62 */
63 uint64_t ticks = BILLION - (rte_get_timer_cycles() % BILLION) +
64 (tim - timer);
65 int ret;
66
67 ret = rte_timer_reset(tim, ticks, PERIODICAL, main_lcore, timer_cb, NULL);
68 if (ret != 0) {
69 rte_log(RTE_LOG_DEBUG, timer_logtype_test,
70 "- core %u failed to reset timer %" PRIuPTR " (OK)\n",
71 rte_lcore_id(), tim - timer);
72 RTE_PER_LCORE(n_reset_collisions) += 1;
73 }
74 return ret;
75}
76
77static int
78worker_main_loop(__rte_unused void *arg)

Callers 3

timer_cbFunction · 0.85
worker_main_loopFunction · 0.85
test_timer_racecondFunction · 0.85

Calls 3

rte_timer_resetFunction · 0.85
rte_logFunction · 0.85
rte_lcore_idFunction · 0.85

Tested by

no test coverage detected