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

Function test_worker

dpdk/app/test/test_ring_stress_impl.h:184–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182}
183
184static int
185test_worker(void *arg, const char *fname, int32_t prcs)
186{
187 int32_t rc;
188 uint32_t lc, n, num;
189 uint64_t cl, tm0, tm1;
190 struct lcore_arg *la;
191 struct ring_elem def_elm, loc_elm;
192 struct ring_elem *obj[2 * BULK_NUM];
193
194 la = arg;
195 lc = rte_lcore_id();
196
197 fill_ring_elm(&def_elm, UINT32_MAX);
198 fill_ring_elm(&loc_elm, lc);
199
200 /* Acquire ordering is not required as the main is not
201 * really releasing any data through 'wrk_cmd' to
202 * the worker.
203 */
204 while (__atomic_load_n(&wrk_cmd, __ATOMIC_RELAXED) != WRK_CMD_RUN)
205 rte_pause();
206
207 cl = rte_rdtsc_precise();
208
209 do {
210 /* num in interval [7/8, 11/8] of BULK_NUM */
211 num = 7 * BULK_NUM / 8 + rte_rand() % (BULK_NUM / 2);
212
213 /* reset all pointer values */
214 memset(obj, 0, sizeof(obj));
215
216 /* dequeue num elems */
217 tm0 = (prcs != 0) ? rte_rdtsc_precise() : 0;
218 n = _st_ring_dequeue_bulk(la->rng, (void **)obj, num, NULL);
219 tm0 = (prcs != 0) ? rte_rdtsc_precise() - tm0 : 0;
220
221 /* check return value and objects */
222 rc = check_ring_op(num, n, lc, fname,
223 RTE_STR(_st_ring_dequeue_bulk));
224 if (rc == 0)
225 rc = check_updt_elem(obj, num, &def_elm, &loc_elm);
226 if (rc != 0)
227 break;
228
229 /* enqueue num elems */
230 rte_compiler_barrier();
231 rc = check_updt_elem(obj, num, &loc_elm, &def_elm);
232 if (rc != 0)
233 break;
234
235 tm1 = (prcs != 0) ? rte_rdtsc_precise() : 0;
236 n = _st_ring_enqueue_bulk(la->rng, (void **)obj, num, NULL);
237 tm1 = (prcs != 0) ? rte_rdtsc_precise() - tm1 : 0;
238
239 /* check return value */
240 rc = check_ring_op(num, n, lc, fname,
241 RTE_STR(_st_ring_enqueue_bulk));

Callers 2

test_worker_prcsFunction · 0.85
test_worker_avgFunction · 0.85

Calls 11

rte_lcore_idFunction · 0.85
fill_ring_elmFunction · 0.85
rte_randFunction · 0.85
memsetFunction · 0.85
check_ring_opFunction · 0.85
check_updt_elemFunction · 0.85
lcore_stat_updateFunction · 0.85
_st_ring_dequeue_bulkFunction · 0.70
_st_ring_enqueue_bulkFunction · 0.70
rte_pauseFunction · 0.50
rte_rdtsc_preciseFunction · 0.50

Tested by

no test coverage detected