/** * * @brief The test main function * * @return 0 on success */ int nanoIntLatency(void) { PRINT_FORMAT(" 1- Measure time to switch from fiber to ISR execution"); TICK_SYNCH(); task_fiber_start(&fiberStack[0], STACKSIZE, (nano_fiber_entry_t) fiberInt, 0, 0, 6, 0); PRINT_FORMAT(" switching time is %lu tcs = %lu nsec", timestamp, SYS_CLOCK_HW_CYCLES_TO_NS(timestamp)); return 0; }
/** * * @brief The test main function * * @return 0 on success */ int int_to_thread_evt(void) { PRINT_FORMAT(" 2 - Measure time from ISR to executing a different thread" " (rescheduled)"); TICK_SYNCH(); k_sem_give(&INTSEMA); k_alert_recv(&EVENT0, K_FOREVER); timestamp = TIME_STAMP_DELTA_GET(timestamp); PRINT_FORMAT(" switch time is %u tcs = %u nsec", timestamp, SYS_CLOCK_HW_CYCLES_TO_NS(timestamp)); return 0; }
/** * * @brief The test main function * * @return 0 on success */ int nanoIntToFiber(void) { PRINT_FORMAT(" 2- Measure time to switch from ISR back to interrupted" " fiber"); TICK_SYNCH(); task_fiber_start(&fiberStack[0], STACKSIZE, (nano_fiber_entry_t) fiberInt, 0, 0, 6, 0); if (flagVar == 1) { PRINT_FORMAT(" switching time is %lu tcs = %lu nsec", timestamp, SYS_CLOCK_HW_CYCLES_TO_NS(timestamp)); } return 0; }
/** * * @brief The test main function * * @return 0 on success */ int nanoIntToFiberSem(void) { PRINT_FORMAT(" 3- Measure time from ISR to executing a different fiber" " (rescheduled)"); nano_sem_init(&testSema); TICK_SYNCH(); task_fiber_start(&waiterStack[0], STACKSIZE, (nano_fiber_entry_t) fiberWaiter, 0, 0, 5, 0); task_fiber_start(&intStack[0], STACKSIZE, (nano_fiber_entry_t) fiberInt, 0, 0, 6, 0); PRINT_FORMAT(" switching time is %lu tcs = %lu nsec", timestamp, SYS_CLOCK_HW_CYCLES_TO_NS(timestamp)); return 0; }