/** * * @brief Perform all selected benchmarks * * @return N/A */ void main(void) { int continuously = 0; int test_result; init_output(&continuously); bench_test_init(); do { fprintf(output_file, sz_module_title_fmt, "Nanokernel API test"); fprintf(output_file, sz_kernel_ver_fmt, sys_kernel_version_get()); fprintf(output_file, "\n\nEach test below is repeated %d times;\n" "average time for one iteration is displayed.", NUMBER_OF_LOOPS); test_result = 0; test_result += sema_test(); test_result += lifo_test(); test_result += fifo_test(); test_result += stack_test(); if (test_result) { /* sema/lifo/fifo/stack account for 12 tests in total */ if (test_result == 12) { fprintf(output_file, sz_module_result_fmt, sz_success); } else { fprintf(output_file, sz_module_result_fmt, sz_partial); } } else { fprintf(output_file, sz_module_result_fmt, sz_fail); } TC_PRINT_RUNID; } while (continuously && !kbhit()); output_close(); }
/** * * @brief Perform all selected benchmarks * see config.h to select or to unselect * * @return N/A */ void BenchTask(void) { int autorun = 0, continuously = 0; init_output(&continuously, &autorun); bench_test_init(); PRINT_STRING(newline, output_file); do { PRINT_STRING(dashline, output_file); PRINT_STRING("| S I M P L E S E R V I C E " "M E A S U R E M E N T S | nsec |\n", output_file); PRINT_STRING(dashline, output_file); task_start(RECVTASK); call_test(); queue_test(); sema_test(); mutex_test(); memorymap_test(); mempool_test(); event_test(); mailbox_test(); pipe_test(); PRINT_STRING("| END OF TESTS " " |\n", output_file); PRINT_STRING(dashline, output_file); PRINT_STRING("PROJECT EXECUTION SUCCESSFUL\n",output_file); } while (continuously && !kbhit()); WAIT_FOR_USER(); if (autorun) { task_sleep(SECONDS(2)); } output_close(); }