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

Function test_mt1

dpdk/app/test/test_ring_stress_impl.h:332–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

330}
331
332static int
333test_mt1(int (*test)(void *))
334{
335 int32_t rc;
336 uint32_t lc, mc;
337 struct rte_ring *r;
338 void *data;
339 struct lcore_arg arg[RTE_MAX_LCORE];
340
341 static const struct lcore_stat init_stat = {
342 .op.min_cycle = UINT64_MAX,
343 };
344
345 rc = mt1_init(&r, &data, RING_SIZE);
346 if (rc != 0) {
347 mt1_fini(r, data);
348 return rc;
349 }
350
351 memset(arg, 0, sizeof(arg));
352
353 /* launch on all workers */
354 RTE_LCORE_FOREACH_WORKER(lc) {
355 arg[lc].rng = r;
356 arg[lc].stats = init_stat;
357 rte_eal_remote_launch(test, &arg[lc], lc);
358 }
359
360 /* signal worker to start test */
361 __atomic_store_n(&wrk_cmd, WRK_CMD_RUN, __ATOMIC_RELEASE);
362
363 rte_delay_us(run_time * US_PER_S);
364
365 /* signal worker to start test */
366 __atomic_store_n(&wrk_cmd, WRK_CMD_STOP, __ATOMIC_RELEASE);
367
368 /* wait for workers and collect stats. */
369 mc = rte_lcore_id();
370 arg[mc].stats = init_stat;
371
372 rc = 0;
373 RTE_LCORE_FOREACH_WORKER(lc) {
374 rc |= rte_eal_wait_lcore(lc);
375 lcore_stat_aggr(&arg[mc].stats, &arg[lc].stats);
376 if (verbose != 0)
377 lcore_stat_dump(stdout, lc, &arg[lc].stats);
378 }
379
380 lcore_stat_dump(stdout, UINT32_MAX, &arg[mc].stats);
381 mt1_fini(r, data);
382 return rc;
383}
384
385static const struct test_case tests[] = {
386 {

Callers

nothing calls this directly

Calls 5

mt1_initFunction · 0.85
mt1_finiFunction · 0.85
memsetFunction · 0.85
rte_lcore_idFunction · 0.85
lcore_stat_dumpFunction · 0.85

Tested by

no test coverage detected