unified/test Adapt sys_kernel test to unified kernel

As unified kernel starts main() application function, remove test
thread.

Remove nanokernel part of the test since their code base is
identical.

Change-Id: I2afb4c0da2d139b159c89186166afdb5d9813d61
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
This commit is contained in:
Benjamin Walsh 2016-10-31 17:12:23 -04:00 committed by Anas Nashif
parent bfcf575cbb
commit 1952ac1611
18 changed files with 65 additions and 249 deletions

View file

@ -0,0 +1,5 @@
KERNEL_TYPE = unified
BOARD ?= qemu_x86
CONF_FILE = prj.conf
include ${ZEPHYR_BASE}/Makefile.inc

View file

@ -1,7 +0,0 @@
MDEF_FILE = prj.mdef
KERNEL_TYPE = micro
BOARD ?= qemu_x86
CONF_FILE = prj.conf
SOURCE_DIR = $(ZEPHYR_BASE)/tests/benchmark/sys_kernel/nanokernel/src/
include ${ZEPHYR_BASE}/Makefile.inc

View file

@ -1,6 +0,0 @@
% Application : SysKernel benchmark
% Part common for all platforms
% TASK NAME PRIO ENTRY STACK GROUPS
% =======================================================
TASK SYSKERNELBENCH 6 SysKernelBench 16384 [FPU,EXE]

View file

@ -1,5 +0,0 @@
[test]
tags = benchmark
arch_whitelist = x86
kernel = micro

View file

@ -1,5 +0,0 @@
KERNEL_TYPE = nano
BOARD ?= qemu_x86
CONF_FILE = prj_console.conf
include $(ZEPHYR_BASE)/Makefile.inc

View file

@ -1,175 +0,0 @@
Title: Nanokernel Object Performance
Description:
The SysKernel test measures the performance of the nanokernel's semaphore,
lifo, fifo, and stack objects.
--------------------------------------------------------------------------------
Building and Running Project:
This nanokernel project outputs to the console. It can be built and executed
on QEMU as follows:
make qemu
--------------------------------------------------------------------------------
Troubleshooting:
Problems caused by out-dated project information can be addressed by
issuing one of the following commands then rebuilding the project:
make clean # discard results of previous builds
# but keep existing configuration info
or
make pristine # discard results of previous builds
# and restore pre-defined configuration info
--------------------------------------------------------------------------------
Sample Output:
MODULE: Nanokernel API test
KERNEL VERSION: <varies>
Each test below are repeated 5000 times and the average
time for one iteration is displayed.
TEST CASE: Semaphore #1
TEST COVERAGE:
nano_sem_init
nano_fiber_sem_take(TICKS_UNLIMITED)
nano_fiber_sem_give
Starting test. Please wait...
TEST RESULT: SUCCESSFUL
DETAILS: Average time for 1 iteration: NNNN nSec
END TEST CASE
TEST CASE: Semaphore #2
TEST COVERAGE:
nano_sem_init
nano_fiber_sem_take(TICKS_NONE)
fiber_yield
nano_fiber_sem_give
Starting test. Please wait...
TEST RESULT: SUCCESSFUL
DETAILS: Average time for 1 iteration: NNNN nSec
END TEST CASE
TEST CASE: Semaphore #3
TEST COVERAGE:
nano_sem_init
nano_fiber_sem_take(TICKS_UNLIMITED)
nano_fiber_sem_give
nano_task_sem_give
nano_task_sem_take(TICKS_UNLIMITED)
Starting test. Please wait...
TEST RESULT: SUCCESSFUL
DETAILS: Average time for 1 iteration: NNNN nSec
END TEST CASE
TEST CASE: LIFO #1
TEST COVERAGE:
nano_lifo_init
nano_fiber_lifo_get(TICKS_UNLIMITED)
nano_fiber_lifo_put
Starting test. Please wait...
TEST RESULT: SUCCESSFUL
DETAILS: Average time for 1 iteration: NNNN nSec
END TEST CASE
TEST CASE: LIFO #2
TEST COVERAGE:
nano_lifo_init
nano_fiber_lifo_get(TICKS_UNLIMITED)
nano_fiber_lifo_get(TICKS_NONE)
nano_fiber_lifo_put
fiber_yield
Starting test. Please wait...
TEST RESULT: SUCCESSFUL
DETAILS: Average time for 1 iteration: NNNN nSec
END TEST CASE
TEST CASE: LIFO #3
TEST COVERAGE:
nano_lifo_init
nano_fiber_lifo_get(TICKS_UNLIMITED)
nano_fiber_lifo_put
nano_task_lifo_get(TICKS_UNLIMITED)
nano_task_lifo_put
Starting test. Please wait...
TEST RESULT: SUCCESSFUL
DETAILS: Average time for 1 iteration: NNNN nSec
END TEST CASE
TEST CASE: FIFO #1
TEST COVERAGE:
nano_fifo_init
nano_fiber_fifo_get(TICKS_UNLIMITED)
nano_fiber_fifo_put
Starting test. Please wait...
TEST RESULT: SUCCESSFUL
DETAILS: Average time for 1 iteration: NNNN nSec
END TEST CASE
TEST CASE: FIFO #2
TEST COVERAGE:
nano_fifo_init
nano_fiber_fifo_get(TICKS_UNLIMITED)
nano_fiber_fifo_get
nano_fiber_fifo_put
fiber_yield
Starting test. Please wait...
TEST RESULT: SUCCESSFUL
DETAILS: Average time for 1 iteration: NNNN nSec
END TEST CASE
TEST CASE: FIFO #3
TEST COVERAGE:
nano_fifo_init
nano_fiber_fifo_get(TICKS_UNLIMITED)
nano_fiber_fifo_put
nano_task_fifo_get_wait
nano_task_fifo_put
Starting test. Please wait...
TEST RESULT: SUCCESSFUL
DETAILS: Average time for 1 iteration: NNNN nSec
END TEST CASE
TEST CASE: Stack #1
TEST COVERAGE:
nano_stack_init
nano_fiber_stack_pop(TICKS_UNLIMITED)
nano_fiber_stack_push
Starting test. Please wait...
TEST RESULT: SUCCESSFUL
DETAILS: Average time for 1 iteration: NNNN nSec
END TEST CASE
TEST CASE: Stack #2
TEST COVERAGE:
nano_stack_init
nano_fiber_stack_pop(TICKS_UNLIMITED)
nano_fiber_stack_pop
nano_fiber_stack_push
fiber_yield
Starting test. Please wait...
TEST RESULT: SUCCESSFUL
DETAILS: Average time for 1 iteration: NNNN nSec
END TEST CASE
TEST CASE: Stack #3
TEST COVERAGE:
nano_stack_init
nano_fiber_stack_pop(TICKS_UNLIMITED)
nano_fiber_stack_push
nano_task_stack_pop(TICKS_UNLIMITED)
nano_task_stack_push
Starting test. Please wait...
TEST RESULT: SUCCESSFUL
DETAILS: Average time for 1 iteration: NNNN nSec
END TEST CASE
PROJECT EXECUTION SUCCESSFUL

View file

@ -1,2 +0,0 @@
# all printf, fprintf to stdout go to console
CONFIG_STDOUT_CONSOLE=y

View file

@ -1,4 +0,0 @@
[test]
tags = benchmark
arch_whitelist = x86

View file

@ -5,3 +5,5 @@ CONFIG_NUM_COMMAND_PACKETS=50
# eliminate timer interrupts during the benchmark
CONFIG_SYS_CLOCK_TICKS_PER_SEC=1
CONFIG_MAIN_STACK_SIZE=16384

View file

@ -50,18 +50,20 @@ void lifo_fiber1(int par1, int par2)
int i;
int element_a[2];
int element_b[2];
int * pelement;
int *pelement;
ARG_UNUSED(par1);
for (i = 0; i < par2 / 2; i++) {
pelement = (int *) nano_fiber_lifo_get(&nanoLifo1, TICKS_UNLIMITED);
pelement = (int *)nano_fiber_lifo_get(&nanoLifo1,
TICKS_UNLIMITED);
if (pelement[1] != 2 * i) {
break;
}
element_a[1] = 2 * i;
nano_fiber_lifo_put(&nanoLifo2, element_a);
pelement = (int *) nano_fiber_lifo_get(&nanoLifo1, TICKS_UNLIMITED);
pelement = (int *)nano_fiber_lifo_get(&nanoLifo1,
TICKS_UNLIMITED);
if (pelement[1] != 2 * i + 1) {
break;
}
@ -86,13 +88,14 @@ void lifo_fiber2(int par1, int par2)
{
int i;
int element[2];
int * pelement;
int * pcounter = (int *) par1;
int *pelement;
int *pcounter = (int *)par1;
for (i = 0; i < par2; i++) {
element[1] = i;
nano_fiber_lifo_put(&nanoLifo1, element);
pelement = (int *) nano_fiber_lifo_get(&nanoLifo2, TICKS_UNLIMITED);
pelement = (int *)nano_fiber_lifo_get(&nanoLifo2,
TICKS_UNLIMITED);
if (pelement[1] != i) {
break;
}
@ -115,8 +118,8 @@ void lifo_fiber3(int par1, int par2)
{
int i;
int element[2];
int * pelement;
int * pcounter = (int *) par1;
int *pelement;
int *pcounter = (int *)par1;
for (i = 0; i < par2; i++) {
element[1] = i;
@ -226,17 +229,20 @@ int lifo_test(void)
NUMBER_OF_LOOPS, 3, 0);
for (i = 0; i < NUMBER_OF_LOOPS / 2; i++) {
int element[2];
int * pelement;
int *pelement;
element[1] = 2 * i;
nano_task_lifo_put(&nanoLifo1, element);
element[1] = 2 * i + 1;
nano_task_lifo_put(&nanoLifo1, element);
pelement = (int *) nano_task_lifo_get(&nanoLifo2, TICKS_UNLIMITED);
pelement = (int *)nano_task_lifo_get(&nanoLifo2,
TICKS_UNLIMITED);
if (pelement[1] != 2 * i + 1) {
break;
}
pelement = (int *) nano_task_lifo_get(&nanoLifo2, TICKS_UNLIMITED);
pelement = (int *)nano_task_lifo_get(&nanoLifo2,
TICKS_UNLIMITED);
if (pelement[1] != 2 * i) {
break;
}

View file

@ -50,11 +50,12 @@ void fifo_fiber1(int par1, int par2)
{
int i;
int element[2];
int * pelement;
int *pelement;
ARG_UNUSED(par1);
for (i = 0; i < par2; i++) {
pelement = (int *) nano_fiber_fifo_get(&nanoFifo1, TICKS_UNLIMITED);
pelement = (int *)nano_fiber_fifo_get(&nanoFifo1,
TICKS_UNLIMITED);
if (pelement[1] != i) {
break;
}
@ -79,13 +80,14 @@ void fifo_fiber2(int par1, int par2)
{
int i;
int element[2];
int * pelement;
int * pcounter = (int *) par1;
int *pelement;
int *pcounter = (int *) par1;
for (i = 0; i < par2; i++) {
element[1] = i;
nano_fiber_fifo_put(&nanoFifo1, element);
pelement = (int *) nano_fiber_fifo_get(&nanoFifo2, TICKS_UNLIMITED);
pelement = (int *)nano_fiber_fifo_get(&nanoFifo2,
TICKS_UNLIMITED);
if (pelement[1] != i) {
break;
}
@ -109,8 +111,8 @@ void fifo_fiber3(int par1, int par2)
{
int i;
int element[2];
int * pelement;
int * pcounter = (int *) par1;
int *pelement;
int *pcounter = (int *)par1;
for (i = 0; i < par2; i++) {
element[1] = i;
@ -223,17 +225,20 @@ int fifo_test(void)
NUMBER_OF_LOOPS / 2, 3, 0);
for (i = 0; i < NUMBER_OF_LOOPS / 2; i++) {
int element[2];
int * pelement;
int *pelement;
element[1] = i;
nano_task_fifo_put(&nanoFifo1, element);
element[1] = i;
nano_task_fifo_put(&nanoFifo1, element);
pelement = (int *) nano_task_fifo_get(&nanoFifo2, TICKS_UNLIMITED);
pelement = (int *)nano_task_fifo_get(&nanoFifo2,
TICKS_UNLIMITED);
if (pelement[1] != i) {
break;
}
pelement = (int *) nano_task_fifo_get(&nanoFifo2, TICKS_UNLIMITED);
pelement = (int *)nano_task_fifo_get(&nanoFifo2,
TICKS_UNLIMITED);
if (pelement[1] != i) {
break;
}

View file

@ -68,7 +68,7 @@ void sema_fiber1(int par1, int par2)
void sema_fiber2(int par1, int par2)
{
int i;
int * pcounter = (int *) par1;
int *pcounter = (int *)par1;
for (i = 0; i < par2; i++) {
nano_fiber_sem_give(&nanoSem1);
@ -89,7 +89,7 @@ void sema_fiber2(int par1, int par2)
void sema_fiber3(int par1, int par2)
{
int i;
int * pcounter = (int *) par1;
int *pcounter = (int *)par1;
for (i = 0; i < par2; i++) {
nano_fiber_sem_give(&nanoSem1);

View file

@ -86,7 +86,7 @@ void stack_fiber2(int par1, int par2)
{
int i;
uint32_t data;
int * pcounter = (int *) par1;
int *pcounter = (int *)par1;
for (i = 0; i < par2; i++) {
data = i;
@ -114,13 +114,14 @@ void stack_fiber3(int par1, int par2)
{
int i;
uint32_t data;
int * pcounter = (int *) par1;
int *pcounter = (int *)par1;
for (i = 0; i < par2; i++) {
data = i;
nano_fiber_stack_push(&nano_stack_1, data);
data = 0xffffffff;
while (!nano_fiber_stack_pop(&nano_stack_2, &data, TICKS_NONE)) {
while (!nano_fiber_stack_pop(&nano_stack_2, &data,
TICKS_NONE)) {
fiber_yield();
}
if (data != i) {
@ -210,6 +211,7 @@ int stack_test(void)
NUMBER_OF_LOOPS, 3, 0);
for (i = 0; i < NUMBER_OF_LOOPS / 2; i++) {
uint32_t data;
data = 2 * i;
nano_task_stack_push(&nano_stack_1, data);
data = 2 * i + 1;

View file

@ -23,14 +23,12 @@
#include <string.h>
/* #define FLOAT */
char __stack fiber_stack1[STACK_SIZE];
char __stack fiber_stack2[STACK_SIZE];
char Msg[256];
FILE * output_file;
FILE *output_file;
const char sz_success[] = "SUCCESSFUL";
const char sz_partial[] = "PARTIAL";
@ -49,11 +47,7 @@ const char sz_test_start_fmt[] = "\nStarting test. Please wait...";
const char sz_case_result_fmt[] = "\nTEST RESULT: %s";
const char sz_case_details_fmt[] = "\nDETAILS: %s";
const char sz_case_end_fmt[] = "\nEND TEST CASE";
#ifdef FLOAT
const char sz_case_timing_fmt[] = "%6.3f nSec";
#else
const char sz_case_timing_fmt[] = "%ld nSec";
#endif
/* time necessary to read the time */
uint32_t tm_off;
@ -163,11 +157,7 @@ void output_close(void)
*
* @return N/A
*/
#ifdef CONFIG_MICROKERNEL
void SysKernelBench(void)
#else
void main(void)
#endif
{
int continuously = 0;
int test_result;
@ -176,11 +166,14 @@ void main(void)
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, 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 are repeated %d times and the average\n"
"time for one iteration is displayed.", NUMBER_OF_LOOPS);
"\n\nEach test below is repeated %d times;\n"
"average time for one iteration is displayed.",
NUMBER_OF_LOOPS);
test_result = 0;
@ -190,11 +183,13 @@ void main(void)
test_result += stack_test();
if (test_result) {
/* sema, lifo, fifo, stack account for twelve tests in total */
/* sema/lifo/fifo/stack account for 12 tests in total */
if (test_result == 12) {
fprintf(output_file, sz_module_result_fmt, sz_success);
fprintf(output_file, sz_module_result_fmt,
sz_success);
} else {
fprintf(output_file, sz_module_result_fmt, sz_partial);
fprintf(output_file, sz_module_result_fmt,
sz_partial);
}
} else {
fprintf(output_file, sz_module_result_fmt, sz_fail);

View file

@ -30,7 +30,7 @@
extern char fiber_stack1[STACK_SIZE];
extern char fiber_stack2[STACK_SIZE];
extern FILE * output_file;
extern FILE *output_file;
extern const char sz_success[];
extern const char sz_partial[];

View file

@ -0,0 +1,5 @@
[test]
tags = benchmark unified_capable
arch_whitelist = x86
kernel = unified