| 162 | } |
| 163 | |
| 164 | static int |
| 165 | timer_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. */ |
| 204 | enum { WORKER_WAITING = 1, WORKER_RUN_SIGNAL, WORKER_RUNNING, WORKER_FINISHED }; |
nothing calls this directly
no test coverage detected