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

Function timer_basic_main_loop

dpdk/app/test/test_timer.c:455–491  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

453}
454
455static int
456timer_basic_main_loop(__rte_unused void *arg)
457{
458 uint64_t hz = rte_get_timer_hz();
459 unsigned lcore_id = rte_lcore_id();
460 uint64_t cur_time;
461 int64_t diff = 0;
462
463 /* launch all timers on core 0 */
464 if (lcore_id == rte_get_main_lcore()) {
465 mytimer_reset(&mytiminfo[0], hz/4, SINGLE, lcore_id,
466 timer_basic_cb);
467 mytimer_reset(&mytiminfo[1], hz/2, SINGLE, lcore_id,
468 timer_basic_cb);
469 mytimer_reset(&mytiminfo[2], hz/4, PERIODICAL, lcore_id,
470 timer_basic_cb);
471 mytimer_reset(&mytiminfo[3], hz/4, PERIODICAL,
472 rte_get_next_lcore(lcore_id, 0, 1),
473 timer_basic_cb);
474 }
475
476 while (diff >= 0) {
477
478 /* call the timer handler on each core */
479 rte_timer_manage();
480
481 /* simulate the processing of a packet
482 * (3 us = 6000 cycles at 2 Ghz) */
483 rte_delay_us(3);
484
485 cur_time = rte_get_timer_cycles();
486 diff = end_time - cur_time;
487 }
488 RTE_LOG(INFO, TESTTIMER, "core %u finished\n", lcore_id);
489
490 return 0;
491}
492
493static int
494timer_sanity_check(void)

Callers

nothing calls this directly

Calls 5

rte_lcore_idFunction · 0.85
rte_get_main_lcoreFunction · 0.85
mytimer_resetFunction · 0.85
rte_get_next_lcoreFunction · 0.85
rte_timer_manageFunction · 0.85

Tested by

no test coverage detected