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

Function test_timer

dpdk/app/test/test_timer.c:530–595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

528}
529
530static int
531test_timer(void)
532{
533 unsigned i;
534 uint64_t cur_time;
535 uint64_t hz;
536
537 if (rte_lcore_count() < 2) {
538 printf("Not enough cores for timer_autotest, expecting at least 2\n");
539 return TEST_SKIPPED;
540 }
541
542 /* sanity check our timer sources and timer config values */
543 if (timer_sanity_check() < 0) {
544 printf("Timer sanity checks failed\n");
545 return TEST_FAILED;
546 }
547
548 /* init timer */
549 for (i=0; i<NB_TIMER; i++) {
550 memset(&mytiminfo[i], 0, sizeof(struct mytimerinfo));
551 mytiminfo[i].id = i;
552 rte_timer_init(&mytiminfo[i].tim);
553 }
554
555 /* calculate the "end of test" time */
556 cur_time = rte_get_timer_cycles();
557 hz = rte_get_timer_hz();
558 end_time = cur_time + (hz * TEST_DURATION_S);
559
560 /* start other cores */
561 printf("Start timer stress tests\n");
562 rte_eal_mp_remote_launch(timer_stress_main_loop, NULL, CALL_MAIN);
563 rte_eal_mp_wait_lcore();
564
565 /* stop timer 0 used for stress test */
566 rte_timer_stop_sync(&mytiminfo[0].tim);
567
568 /* run a second, slightly different set of stress tests */
569 printf("\nStart timer stress tests 2\n");
570 test_failed = 0;
571 main_init_workers();
572 rte_eal_mp_remote_launch(timer_stress2_main_loop, NULL, CALL_MAIN);
573 rte_eal_mp_wait_lcore();
574 if (test_failed)
575 return TEST_FAILED;
576
577 /* calculate the "end of test" time */
578 cur_time = rte_get_timer_cycles();
579 hz = rte_get_timer_hz();
580 end_time = cur_time + (hz * TEST_DURATION_S);
581
582 /* start other cores */
583 printf("\nStart timer basic tests\n");
584 rte_eal_mp_remote_launch(timer_basic_main_loop, NULL, CALL_MAIN);
585 rte_eal_mp_wait_lcore();
586
587 /* stop all timers */

Callers

nothing calls this directly

Calls 10

rte_lcore_countFunction · 0.85
timer_sanity_checkFunction · 0.85
memsetFunction · 0.85
rte_timer_initFunction · 0.85
rte_eal_mp_remote_launchFunction · 0.85
rte_eal_mp_wait_lcoreFunction · 0.85
rte_timer_stop_syncFunction · 0.85
main_init_workersFunction · 0.85
rte_timer_dump_statsFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected