From 25ce056279faf7db2a870e9045210f777d217efa Mon Sep 17 00:00:00 2001 From: Andrew Boie Date: Tue, 1 Nov 2016 13:37:45 -0700 Subject: [PATCH] tests: benchmark: enable for V2 kernel Not completely ported to V2 APIs yet, but enough that we pull in all the kernel.h APIs for the microkernel test, bypassing the legacy layer. We pull in a lot more than the legacy test did, so results are not directly comparable. Change-Id: I35e74bfd1aa15ee59951f68fb7dd8d811619c3f8 Signed-off-by: Andrew Boie --- .../footprint/microkernel/float/arm.conf | 4 +- .../footprint/microkernel/float/x86.conf | 4 +- .../footprint/microkernel/max/arm.conf | 2 + .../footprint/microkernel/max/x86.conf | 2 + .../microkernel/src/microkernel_footprint.c | 127 ++++++++++++++++++ .../footprint/microkernel/testcase.ini | 8 +- .../nanokernel/src/nanokernel_footprint.c | 43 ++++++ .../footprint/nanokernel/testcase.ini | 8 +- 8 files changed, 186 insertions(+), 12 deletions(-) diff --git a/tests/legacy/benchmark/footprint/microkernel/float/arm.conf b/tests/legacy/benchmark/footprint/microkernel/float/arm.conf index b9753cf52f8..475a0966ca0 100644 --- a/tests/legacy/benchmark/footprint/microkernel/float/arm.conf +++ b/tests/legacy/benchmark/footprint/microkernel/float/arm.conf @@ -7,7 +7,7 @@ CONFIG_NUM_TASK_PRIORITIES=64 CONFIG_NUM_COMMAND_PACKETS=64 CONFIG_NUM_TIMER_PACKETS=16 CONFIG_MICROKERNEL_SERVER_STACK_SIZE=4096 - +CONFIG_HEAP_MEM_POOL_SIZE=256 CONFIG_SYS_POWER_MANAGEMENT=y - +CONFIG_THREAD_CUSTOM_DATA=y CONFIG_NUM_IRQS=43 diff --git a/tests/legacy/benchmark/footprint/microkernel/float/x86.conf b/tests/legacy/benchmark/footprint/microkernel/float/x86.conf index 4e1588aa241..0017d14eeed 100644 --- a/tests/legacy/benchmark/footprint/microkernel/float/x86.conf +++ b/tests/legacy/benchmark/footprint/microkernel/float/x86.conf @@ -8,9 +8,9 @@ CONFIG_NUM_TASK_PRIORITIES=64 CONFIG_NUM_COMMAND_PACKETS=64 CONFIG_NUM_TIMER_PACKETS=16 CONFIG_MICROKERNEL_SERVER_STACK_SIZE=4096 - +CONFIG_HEAP_MEM_POOL_SIZE=256 CONFIG_SYS_POWER_MANAGEMENT=y CONFIG_FLOAT=y CONFIG_SSE=y CONFIG_FP_SHARING=y - +CONFIG_THREAD_CUSTOM_DATA=y diff --git a/tests/legacy/benchmark/footprint/microkernel/max/arm.conf b/tests/legacy/benchmark/footprint/microkernel/max/arm.conf index 0f78db6e8ed..970569eb745 100644 --- a/tests/legacy/benchmark/footprint/microkernel/max/arm.conf +++ b/tests/legacy/benchmark/footprint/microkernel/max/arm.conf @@ -9,3 +9,5 @@ CONFIG_NUM_TIMER_PACKETS=16 CONFIG_MICROKERNEL_SERVER_STACK_SIZE=4096 CONFIG_SYS_POWER_MANAGEMENT=y CONFIG_NUM_IRQS=43 +CONFIG_THREAD_CUSTOM_DATA=y +CONFIG_HEAP_MEM_POOL_SIZE=256 diff --git a/tests/legacy/benchmark/footprint/microkernel/max/x86.conf b/tests/legacy/benchmark/footprint/microkernel/max/x86.conf index 8cfdbfbfa1b..045baf83aed 100644 --- a/tests/legacy/benchmark/footprint/microkernel/max/x86.conf +++ b/tests/legacy/benchmark/footprint/microkernel/max/x86.conf @@ -9,3 +9,5 @@ CONFIG_NUM_COMMAND_PACKETS=64 CONFIG_NUM_TIMER_PACKETS=16 CONFIG_MICROKERNEL_SERVER_STACK_SIZE=4096 CONFIG_SYS_POWER_MANAGEMENT=y +CONFIG_THREAD_CUSTOM_DATA=y +CONFIG_HEAP_MEM_POOL_SIZE=256 diff --git a/tests/legacy/benchmark/footprint/microkernel/src/microkernel_footprint.c b/tests/legacy/benchmark/footprint/microkernel/src/microkernel_footprint.c index 32be3e8baf5..e3b74320fcc 100644 --- a/tests/legacy/benchmark/footprint/microkernel/src/microkernel_footprint.c +++ b/tests/legacy/benchmark/footprint/microkernel/src/microkernel_footprint.c @@ -44,6 +44,10 @@ typedef void* (*pfunc) (void*); volatile int i = 0; /* counter used by foreground task */ +#ifndef CONFIG_KERNEL_V2 + +/* legacy microkernel */ + /* pointer array ensures specified functions are linked into the image */ static pfunc func_array[] = { /* event functions */ @@ -95,6 +99,129 @@ static pfunc func_array[] = { #endif /* TEST_max */ }; +#else + +static pfunc func_array[] = { + /* mutexes */ + (pfunc)k_mutex_init, + (pfunc)k_mutex_lock, + (pfunc)k_mutex_unlock, + + /* semaphores */ + (pfunc)k_sem_init, + (pfunc)k_sem_take, + (pfunc)k_sem_give, + (pfunc)k_sem_reset, + (pfunc)k_sem_count_get, + + /* FIFOs */ + (pfunc)k_fifo_init, + (pfunc)k_fifo_put, + (pfunc)k_fifo_put_list, + (pfunc)k_fifo_put_slist, + (pfunc)k_fifo_get, + + /* mem slabs */ + (pfunc)k_mem_slab_init, + (pfunc)k_mem_slab_alloc, + (pfunc)k_mem_slab_free, + (pfunc)k_mem_slab_num_used_get, + (pfunc)k_mem_slab_num_free_get, + +#ifdef TEST_max + /* alerts */ + (pfunc)k_alert_init, + (pfunc)k_alert_send, + (pfunc)k_alert_recv, + + /* message queues */ + (pfunc)k_msgq_init, + (pfunc)k_msgq_put, + (pfunc)k_msgq_get, + (pfunc)k_msgq_purge, + (pfunc)k_msgq_num_free_get, + (pfunc)k_msgq_num_used_get, + + /* semaphore groups */ + (pfunc)k_sem_group_take, + (pfunc)k_sem_group_give, + (pfunc)k_sem_group_reset, + + /* LIFOs */ + (pfunc)k_lifo_init, + (pfunc)k_lifo_put, + (pfunc)k_lifo_get, + + /* stacks */ + (pfunc)k_stack_init, + (pfunc)k_stack_push, + (pfunc)k_stack_pop, + + /* workqueues */ + (pfunc)k_work_init, + (pfunc)k_work_submit_to_queue, + (pfunc)k_work_pending, + (pfunc)k_work_q_start, + (pfunc)k_delayed_work_init, + (pfunc)k_delayed_work_submit_to_queue, + (pfunc)k_delayed_work_cancel, + (pfunc)k_work_submit, + (pfunc)k_delayed_work_submit, + + /* mailboxes */ + (pfunc)k_mbox_init, + (pfunc)k_mbox_put, + (pfunc)k_mbox_async_put, + (pfunc)k_mbox_get, + (pfunc)k_mbox_data_get, + (pfunc)k_mbox_data_block_get, + + /* pipes */ + (pfunc)k_pipe_init, + (pfunc)k_pipe_put, + (pfunc)k_pipe_get, + (pfunc)k_pipe_block_put, + + /* mem pools */ + (pfunc)k_mem_pool_alloc, + (pfunc)k_mem_pool_free, + (pfunc)k_mem_pool_defrag, + (pfunc)k_malloc, + (pfunc)k_free, + + /* timers */ + (pfunc)k_timer_init, + (pfunc)k_timer_stop, + (pfunc)k_timer_status_get, + (pfunc)k_timer_status_sync, + (pfunc)k_timer_remaining_get, + (pfunc)k_uptime_get, + (pfunc)k_uptime_get_32, + (pfunc)k_uptime_delta, + (pfunc)k_uptime_delta_32, + (pfunc)k_cycle_get_32, + + /* thread stuff */ + (pfunc)k_thread_spawn, + (pfunc)k_sleep, + (pfunc)k_busy_wait, + (pfunc)k_yield, + (pfunc)k_wakeup, + (pfunc)k_current_get, + (pfunc)k_thread_cancel, + (pfunc)k_thread_abort, + (pfunc)k_thread_priority_get, + (pfunc)k_thread_priority_set, + (pfunc)k_thread_suspend, + (pfunc)k_thread_resume, + (pfunc)k_sched_time_slice_set, + (pfunc)k_am_in_isr, + (pfunc)k_thread_custom_data_set, + (pfunc)k_thread_custom_data_get, +#endif +}; +#endif + /** * * @brief Dummy ISR diff --git a/tests/legacy/benchmark/footprint/microkernel/testcase.ini b/tests/legacy/benchmark/footprint/microkernel/testcase.ini index e33b4695788..5a1402486ef 100644 --- a/tests/legacy/benchmark/footprint/microkernel/testcase.ini +++ b/tests/legacy/benchmark/footprint/microkernel/testcase.ini @@ -1,26 +1,26 @@ [footprint-min] -tags = footprint +tags = footprint unified_capable extra_args = TEST=min build_only = true filter = not CONFIG_BOARD_GALILEO kernel = micro [footprint-reg] -tags = footprint +tags = footprint unified_capable extra_args = TEST=reg build_only = true arch_whitelist = x86 kernel = micro [footprint-max] -tags = footprint +tags = footprint unified_capable extra_args = TEST=max build_only = true arch_whitelist = x86 kernel = micro [footprint-float] -tags = footprint +tags = footprint unified_capable extra_args = TEST=float build_only = true kernel = micro diff --git a/tests/legacy/benchmark/footprint/nanokernel/src/nanokernel_footprint.c b/tests/legacy/benchmark/footprint/nanokernel/src/nanokernel_footprint.c index 952c79b9d95..8952f230675 100644 --- a/tests/legacy/benchmark/footprint/nanokernel/src/nanokernel_footprint.c +++ b/tests/legacy/benchmark/footprint/nanokernel/src/nanokernel_footprint.c @@ -47,6 +47,8 @@ typedef void* (*pfunc) (void*); /* stack used by fiber */ static char __stack pStack[FIBER_STACK_SIZE]; +#ifndef CONFIG_KERNEL_V2 + /* pointer array ensures specified functions are linked into the image */ volatile pfunc func_array[] = { /* nano timer functions */ @@ -72,6 +74,47 @@ volatile pfunc func_array[] = { (pfunc)nano_fiber_fifo_get, #endif /* TEST_max */ }; +#else +static pfunc func_array[] = { + /* timers */ + (pfunc)k_timer_init, + (pfunc)k_timer_stop, + (pfunc)k_timer_status_get, + (pfunc)k_timer_status_sync, + (pfunc)k_timer_remaining_get, + (pfunc)k_uptime_get, + (pfunc)k_uptime_get_32, + (pfunc)k_uptime_delta, + (pfunc)k_uptime_delta_32, + (pfunc)k_cycle_get_32, + + /* semaphores */ + (pfunc)k_sem_init, + (pfunc)k_sem_take, + (pfunc)k_sem_give, + (pfunc)k_sem_reset, + (pfunc)k_sem_count_get, + +#ifdef TEST_max + /* LIFOs */ + (pfunc)k_lifo_init, + (pfunc)k_lifo_put, + (pfunc)k_lifo_get, + + /* stacks */ + (pfunc)k_stack_init, + (pfunc)k_stack_push, + (pfunc)k_stack_pop, + + /* FIFOs */ + (pfunc)k_fifo_init, + (pfunc)k_fifo_put, + (pfunc)k_fifo_put_list, + (pfunc)k_fifo_put_slist, + (pfunc)k_fifo_get, +#endif +}; +#endif /** * diff --git a/tests/legacy/benchmark/footprint/nanokernel/testcase.ini b/tests/legacy/benchmark/footprint/nanokernel/testcase.ini index 8aadcf8ccac..7794aec469e 100644 --- a/tests/legacy/benchmark/footprint/nanokernel/testcase.ini +++ b/tests/legacy/benchmark/footprint/nanokernel/testcase.ini @@ -1,20 +1,20 @@ [footprint-min] -tags = footprint +tags = footprint unified_capable extra_args = TEST=min build_only = true [footprint-reg] -tags = footprint +tags = footprint unified_capable extra_args = TEST=reg build_only = true [footprint-max] -tags = footprint +tags = footprint unified_capable extra_args = TEST=max build_only = true [footprint-float] -tags = footprint +tags = footprint unified_capable extra_args = TEST=float build_only = true arch_whitelist = x86