benchmarks: remove legacy tests already ported to unified
Change-Id: I002a462e06333b8540e96d4e4e166830b231d536 Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
7942eaee39
commit
e994b0ab19
30 changed files with 0 additions and 1719 deletions
|
@ -1,15 +0,0 @@
|
|||
CONF_quark_d2000_crb = quark_d2000/quark_d2000_prj.conf
|
||||
CONF_quark_se_c1000_devboard = quark_se/quark_se_prj.conf
|
||||
CONF_qemu_x86 = ia32/prj_expert_test.conf
|
||||
CONF_qemu_x86_iamcu = ia32/prj_expert_test.conf
|
||||
CONF_minnowboard = ia32/prj_expert_test.conf
|
||||
CONF_galileo = quark_x1000/prj.conf
|
||||
CONF_arduino_101 = quark_se/quark_se_prj.conf
|
||||
CONF_tinytile = quark_se/quark_se_prj.conf
|
||||
CONF_panther = quark_se/quark_se_prj.conf
|
||||
|
||||
MDEF_FILE = prj.mdef
|
||||
BOARD ?= qemu_x86
|
||||
CONF_FILE = ${CONF_${BOARD}}
|
||||
|
||||
include ${ZEPHYR_BASE}/Makefile.test
|
|
@ -1,68 +0,0 @@
|
|||
Title: Boot Time Measurement
|
||||
|
||||
Description:
|
||||
|
||||
BootTime measures the time:
|
||||
a) from system reset to kernel start (crt0.s's __start)
|
||||
b) from kernel start to begin of main()
|
||||
c) from kernel start to begin of first task
|
||||
d) from kernel start to when microkernel's main task goes immediately idle
|
||||
|
||||
The project can be built using one of the following three configurations:
|
||||
|
||||
best
|
||||
-------
|
||||
- Disables most features
|
||||
- Provides best case boot measurement
|
||||
|
||||
default
|
||||
-------
|
||||
- Default configuration options
|
||||
- Provides typical boot measurement
|
||||
|
||||
worst
|
||||
-------
|
||||
- Enables most features.
|
||||
- Provides worst case boot measurement
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Building and Running Project:
|
||||
|
||||
This microkernel project outputs to the console. It can be built and executed
|
||||
on QEMU in three possibile configurations as follows:
|
||||
|
||||
make BOOTTIME_QUALIFIER=best qemu
|
||||
|
||||
make BOOTTIME_QUALIFIER=default qemu
|
||||
|
||||
make BOOTTIME_QUALIFIER=worst 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:
|
||||
|
||||
tc_start() - Boot Time Measurement
|
||||
MicroKernel Boot Result: Clock Frequency: 20 MHz
|
||||
__start : 377787 cycles, 18889 us
|
||||
_start->main(): 3915 cycles, 195 us
|
||||
_start->task : 5898 cycles, 294 us
|
||||
_start->idle : 6399 cycles, 319 us
|
||||
Boot Time Measurement finished
|
||||
===================================================================
|
||||
PASS - bootTimeTask.
|
||||
===================================================================
|
||||
PROJECT EXECUTION SUCCESSFUL
|
|
@ -1,5 +0,0 @@
|
|||
CONFIG_PERFORMANCE_METRICS=y
|
||||
CONFIG_BOOT_TIME_MEASUREMENT=y
|
||||
CONFIG_CPU_CLOCK_FREQ_MHZ=1800
|
||||
CONFIG_LEGACY_KERNEL=y
|
||||
CONFIG_BOOT_BANNER=n
|
|
@ -1,5 +0,0 @@
|
|||
% Application : bootTime
|
||||
|
||||
% TASK NAME PRIO ENTRY STACK GROUPS
|
||||
% ===================================================
|
||||
TASK BOOTTIME 5 bootTimeTask 1024 [EXE]
|
|
@ -1,5 +0,0 @@
|
|||
CONFIG_PERFORMANCE_METRICS=y
|
||||
CONFIG_BOOT_TIME_MEASUREMENT=y
|
||||
CONFIG_CPU_CLOCK_FREQ_MHZ=32
|
||||
CONFIG_LEGACY_KERNEL=y
|
||||
CONFIG_BOOT_BANNER=n
|
|
@ -1,5 +0,0 @@
|
|||
CONFIG_PERFORMANCE_METRICS=y
|
||||
CONFIG_BOOT_TIME_MEASUREMENT=y
|
||||
CONFIG_CPU_CLOCK_FREQ_MHZ=32
|
||||
CONFIG_LEGACY_KERNEL=y
|
||||
CONFIG_BOOT_BANNER=n
|
|
@ -1,6 +0,0 @@
|
|||
|
||||
CONFIG_PERFORMANCE_METRICS=y
|
||||
CONFIG_BOOT_TIME_MEASUREMENT=y
|
||||
CONFIG_CPU_CLOCK_FREQ_MHZ=533
|
||||
CONFIG_LEGACY_KERNEL=y
|
||||
CONFIG_BOOT_BANNER=n
|
|
@ -1,4 +0,0 @@
|
|||
ccflags-y += -I$(CURDIR)/misc/generated/sysgen
|
||||
ccflags-y += -I$(ZEPHYR_BASE)/tests/include
|
||||
|
||||
obj-y=boot_time.o
|
|
@ -1,76 +0,0 @@
|
|||
/* boot_time.c - Boot Time measurement task */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2013-2015 Wind River Systems, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Measure boot time for nanokernel project
|
||||
*
|
||||
* Measuring the boot time for the nanokernel project includes
|
||||
* 1. From reset to kernel's __start
|
||||
* 2. From __start to main()
|
||||
* 3. From __start to task
|
||||
* 4 From __start to idle
|
||||
*/
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <tc_util.h>
|
||||
|
||||
/* externs */
|
||||
extern uint64_t __start_tsc; /* timestamp when kernel begins executing */
|
||||
extern uint64_t __main_tsc; /* timestamp when main() begins executing */
|
||||
extern uint64_t __idle_tsc; /* timestamp when CPU went idle */
|
||||
|
||||
void bootTimeTask(void)
|
||||
{
|
||||
uint64_t task_tsc; /* timestamp at beginning of first task */
|
||||
uint64_t _start_us; /* being of __start timestamp in us */
|
||||
uint64_t main_us; /* begin of main timestamp in us */
|
||||
uint64_t task_us; /* begin of task timestamp in us */
|
||||
uint64_t s_main_tsc; /* __start->main timestamp */
|
||||
uint64_t s_task_tsc; /*__start->task timestamp */
|
||||
uint64_t idle_us; /* begin of idle timestamp in us */
|
||||
uint64_t s_idle_tsc; /*__start->idle timestamp */
|
||||
|
||||
task_tsc = _tsc_read();
|
||||
/* Go to sleep for 1 tick in order to timestamp when IdleTask halts. */
|
||||
task_sleep(1);
|
||||
|
||||
_start_us = __start_tsc / CONFIG_CPU_CLOCK_FREQ_MHZ;
|
||||
s_main_tsc = __main_tsc-__start_tsc;
|
||||
main_us = s_main_tsc / CONFIG_CPU_CLOCK_FREQ_MHZ;
|
||||
s_task_tsc = task_tsc-__start_tsc;
|
||||
task_us = s_task_tsc / CONFIG_CPU_CLOCK_FREQ_MHZ;
|
||||
s_idle_tsc = __idle_tsc-__start_tsc;
|
||||
idle_us = s_idle_tsc / CONFIG_CPU_CLOCK_FREQ_MHZ;
|
||||
|
||||
/* Indicate start for sanity test suite */
|
||||
TC_START("Boot Time Measurement");
|
||||
|
||||
/* Only print lower 32bit of time result */
|
||||
TC_PRINT("MicroKernel Boot Result: Clock Frequency: %d MHz\n",
|
||||
CONFIG_CPU_CLOCK_FREQ_MHZ);
|
||||
TC_PRINT("__start : %d cycles, %d us\n",
|
||||
(uint32_t)(__start_tsc & 0xFFFFFFFFULL),
|
||||
(uint32_t) (_start_us & 0xFFFFFFFFULL));
|
||||
TC_PRINT("_start->main(): %d cycles, %d us\n",
|
||||
(uint32_t)(s_main_tsc & 0xFFFFFFFFULL),
|
||||
(uint32_t) (main_us & 0xFFFFFFFFULL));
|
||||
TC_PRINT("_start->task : %d cycles, %d us\n",
|
||||
(uint32_t)(s_task_tsc & 0xFFFFFFFFULL),
|
||||
(uint32_t) (task_us & 0xFFFFFFFFULL));
|
||||
TC_PRINT("_start->idle : %d cycles, %d us\n",
|
||||
(uint32_t)(s_idle_tsc & 0xFFFFFFFFULL),
|
||||
(uint32_t) (idle_us & 0xFFFFFFFFULL));
|
||||
|
||||
TC_PRINT("Boot Time Measurement finished\n");
|
||||
|
||||
/* for sanity regression test utility. */
|
||||
TC_END_RESULT(TC_PASS);
|
||||
TC_END_REPORT(TC_PASS);
|
||||
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
[test]
|
||||
tags = legacy benchmark
|
||||
arch_whitelist = x86
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
CONF_quark_d2000_crb = quark_d2000/quark_d2000_prj.conf
|
||||
CONF_quark_se_c1000_devboard = quark_se/quark_se_prj.conf
|
||||
CONF_qemu_x86 = ia32/prj_expert_test.conf
|
||||
CONF_qemu_x86_iamcu = ia32/prj_expert_test.conf
|
||||
CONF_galileo = quark_x1000/prj.conf
|
||||
CONF_minnowboard = ia32/prj_expert_test.conf
|
||||
CONF_arduino_101 = quark_se/quark_se_prj.conf
|
||||
CONF_tinytile = quark_se/quark_se_prj.conf
|
||||
CONF_panther = quark_se/quark_se_prj.conf
|
||||
|
||||
BOARD ?= qemu_x86
|
||||
CONF_FILE = $(CONF_$(BOARD))
|
||||
|
||||
include $(ZEPHYR_BASE)/Makefile.test
|
|
@ -1,66 +0,0 @@
|
|||
Title: Boot Time Measurement
|
||||
|
||||
Description:
|
||||
|
||||
BootTime measures the time:
|
||||
a) from system reset to kernel start (crt0.s's __start)
|
||||
b) from kernel start to begin of main()
|
||||
c) from kernel start to begin of first task
|
||||
|
||||
The project can be built using one of the following three configurations:
|
||||
|
||||
best
|
||||
-------
|
||||
- Disables most features
|
||||
- Provides best case boot measurement
|
||||
|
||||
default
|
||||
-------
|
||||
- Default config options
|
||||
- Provides typical boot measurement
|
||||
|
||||
worst
|
||||
-------
|
||||
- Enables most features
|
||||
- Provides worst case boot measurement
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Building and Running Project:
|
||||
|
||||
This nanokernel project outputs to the console. It can be built and executed
|
||||
on QEMU in three possibile configurations as follows:
|
||||
|
||||
make BOOTTIME_QUALIFIER=best qemu
|
||||
|
||||
make BOOTTIME_QUALIFIER=default qemu
|
||||
|
||||
make BOOTTIME_QUALIFIER=worst 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:
|
||||
|
||||
tc_start() - Boot Time Measurement
|
||||
NanoKernel Boot Result: Clock Frequency: 20 MHz
|
||||
__start : 377787 cycles, 18889 us
|
||||
_start->main(): 5287 cycles, 264 us
|
||||
_start->task : 5653 cycles, 282 us
|
||||
Boot Time Measurement finished
|
||||
===================================================================
|
||||
PASS - bootTimeTask.
|
||||
===================================================================
|
||||
PROJECT EXECUTION SUCCESSFUL
|
|
@ -1,4 +0,0 @@
|
|||
CONFIG_PERFORMANCE_METRICS=y
|
||||
CONFIG_BOOT_TIME_MEASUREMENT=y
|
||||
CONFIG_CPU_CLOCK_FREQ_MHZ=1800
|
||||
CONFIG_LEGACY_KERNEL=y
|
|
@ -1,4 +0,0 @@
|
|||
CONFIG_PERFORMANCE_METRICS=y
|
||||
CONFIG_BOOT_TIME_MEASUREMENT=y
|
||||
CONFIG_CPU_CLOCK_FREQ_MHZ=32
|
||||
CONFIG_LEGACY_KERNEL=y
|
|
@ -1,4 +0,0 @@
|
|||
CONFIG_PERFORMANCE_METRICS=y
|
||||
CONFIG_BOOT_TIME_MEASUREMENT=y
|
||||
CONFIG_CPU_CLOCK_FREQ_MHZ=32
|
||||
CONFIG_LEGACY_KERNEL=y
|
|
@ -1,4 +0,0 @@
|
|||
CONFIG_PERFORMANCE_METRICS=y
|
||||
CONFIG_BOOT_TIME_MEASUREMENT=y
|
||||
CONFIG_CPU_CLOCK_FREQ_MHZ=533
|
||||
CONFIG_LEGACY_KERNEL=y
|
|
@ -1,3 +0,0 @@
|
|||
ccflags-y += -I$(ZEPHYR_BASE)/tests/include
|
||||
|
||||
obj-y=boot_time.o
|
|
@ -1,84 +0,0 @@
|
|||
/* boot_time.c - Boot Time measurement task */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2013-2015 Wind River Systems, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Measure boot time for nanokernel project
|
||||
*
|
||||
* Measuring the boot time for the nanokernel project includes
|
||||
* 1. From reset to kernel's __start
|
||||
* 2. From __start to main()
|
||||
* 3. From __start to task
|
||||
*/
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <tc_util.h>
|
||||
|
||||
/* externs */
|
||||
extern uint64_t __start_tsc; /* timestamp when kernel begins executing */
|
||||
extern uint64_t __main_tsc; /* timestamp when main() begins executing */
|
||||
|
||||
void bootTimeTask(void)
|
||||
{
|
||||
uint64_t task_tsc; /* timestamp at beginning of first task */
|
||||
uint64_t _start_us; /* being of __start timestamp in us */
|
||||
uint64_t main_us; /* begin of main timestamp in us */
|
||||
uint64_t task_us; /* begin of task timestamp in us */
|
||||
uint64_t s_main_tsc; /* __start->main timestamp */
|
||||
uint64_t s_task_tsc; /*__start->task timestamp */
|
||||
|
||||
task_tsc = _tsc_read();
|
||||
|
||||
_start_us = __start_tsc / CONFIG_CPU_CLOCK_FREQ_MHZ;
|
||||
s_main_tsc = __main_tsc-__start_tsc;
|
||||
main_us = s_main_tsc / CONFIG_CPU_CLOCK_FREQ_MHZ;
|
||||
s_task_tsc = task_tsc-__start_tsc;
|
||||
task_us = s_task_tsc / CONFIG_CPU_CLOCK_FREQ_MHZ;
|
||||
|
||||
/* Indicate start for sanity test suite */
|
||||
TC_START("Boot Time Measurement");
|
||||
|
||||
/* Only print lower 32bit of time result */
|
||||
TC_PRINT("NanoKernel Boot Result: Clock Frequency: %d MHz\n",
|
||||
CONFIG_CPU_CLOCK_FREQ_MHZ);
|
||||
TC_PRINT("__start : %d cycles, %d us\n",
|
||||
(uint32_t)(__start_tsc & 0xFFFFFFFFULL),
|
||||
(uint32_t) (_start_us & 0xFFFFFFFFULL));
|
||||
TC_PRINT("_start->main(): %d cycles, %d us\n",
|
||||
(uint32_t)(s_main_tsc & 0xFFFFFFFFULL),
|
||||
(uint32_t) (main_us & 0xFFFFFFFFULL));
|
||||
TC_PRINT("_start->task : %d cycles, %d us\n",
|
||||
(uint32_t)(s_task_tsc & 0xFFFFFFFFULL),
|
||||
(uint32_t) (task_us & 0xFFFFFFFFULL));
|
||||
|
||||
TC_PRINT("Boot Time Measurement finished\n");
|
||||
|
||||
/* for sanity regression test utility. */
|
||||
TC_END_RESULT(TC_PASS);
|
||||
TC_END_REPORT(TC_PASS);
|
||||
|
||||
}
|
||||
|
||||
char __stack fiberStack[512];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Nanokernel entry point
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
|
||||
void main(void)
|
||||
{
|
||||
/* record timestamp for nanokernel's main() function */
|
||||
__main_tsc = _tsc_read();
|
||||
|
||||
/* create bootTime fibers */
|
||||
task_fiber_start(fiberStack, 512, (nano_fiber_entry_t) bootTimeTask,
|
||||
0, 0, 6, 0);
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
[test]
|
||||
tags = legacy benchmark
|
||||
arch_whitelist = x86
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
BOARD ?= qemu_x86
|
||||
CONF_FILE = prj.conf
|
||||
|
||||
include ${ZEPHYR_BASE}/Makefile.test
|
|
@ -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 microkernel 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
|
||||
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
|
||||
nano_fiber_fifo_put
|
||||
nano_task_fifo_get
|
||||
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
|
|
@ -1,10 +0,0 @@
|
|||
# all printf, fprintf to stdout go to console
|
||||
CONFIG_STDOUT_CONSOLE=y
|
||||
|
||||
CONFIG_NUM_COMMAND_PACKETS=50
|
||||
|
||||
# eliminate timer interrupts during the benchmark
|
||||
CONFIG_SYS_CLOCK_TICKS_PER_SEC=1
|
||||
|
||||
CONFIG_MAIN_STACK_SIZE=16384
|
||||
CONFIG_LEGACY_KERNEL=y
|
|
@ -1,8 +0,0 @@
|
|||
ccflags-y = -I$(ZEPHYR_BASE)/tests/legacy/benchmark/latency_measure/src -I${ZEPHYR_BASE}/tests/include
|
||||
ccflags-y += -I$(CURDIR)/misc/generated/sysgen
|
||||
|
||||
obj-y = lifo.o \
|
||||
mwfifo.o \
|
||||
sema.o \
|
||||
stack.o \
|
||||
syskernel.o
|
|
@ -1,251 +0,0 @@
|
|||
/* lifo.c */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2010, 2013-2014 Wind River Systems, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "syskernel.h"
|
||||
|
||||
struct nano_lifo nanoLifo1;
|
||||
struct nano_lifo nanoLifo2;
|
||||
|
||||
static struct nano_fifo nanoFifo_sync; /* for synchronization */
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Initialize LIFOs for the test
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void lifo_test_init(void)
|
||||
{
|
||||
nano_lifo_init(&nanoLifo1);
|
||||
nano_lifo_init(&nanoLifo2);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Lifo test fiber
|
||||
*
|
||||
* @param par1 Ignored parameter.
|
||||
* @param par2 Number of test loops.
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void lifo_fiber1(int par1, int par2)
|
||||
{
|
||||
int i;
|
||||
int element_a[2];
|
||||
int element_b[2];
|
||||
int *pelement;
|
||||
|
||||
ARG_UNUSED(par1);
|
||||
|
||||
for (i = 0; i < par2 / 2; i++) {
|
||||
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);
|
||||
if (pelement[1] != 2 * i + 1) {
|
||||
break;
|
||||
}
|
||||
element_b[1] = 2 * i + 1;
|
||||
nano_fiber_lifo_put(&nanoLifo2, element_b);
|
||||
}
|
||||
/* wait till it is safe to end: */
|
||||
nano_fiber_fifo_get(&nanoFifo_sync, TICKS_UNLIMITED);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Lifo test fiber
|
||||
*
|
||||
* @param par1 Address of the counter.
|
||||
* @param par2 Number of test cycles.
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void lifo_fiber2(int par1, int par2)
|
||||
{
|
||||
int i;
|
||||
int element[2];
|
||||
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);
|
||||
if (pelement[1] != i) {
|
||||
break;
|
||||
}
|
||||
(*pcounter)++;
|
||||
}
|
||||
/* wait till it is safe to end: */
|
||||
nano_fiber_fifo_get(&nanoFifo_sync, TICKS_UNLIMITED);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Lifo test fiber
|
||||
*
|
||||
* @param par1 Address of the counter.
|
||||
* @param par2 Number of test loops.
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void lifo_fiber3(int par1, int par2)
|
||||
{
|
||||
int i;
|
||||
int element[2];
|
||||
int *pelement;
|
||||
int *pcounter = (int *)par1;
|
||||
|
||||
for (i = 0; i < par2; i++) {
|
||||
element[1] = i;
|
||||
nano_fiber_lifo_put(&nanoLifo1, element);
|
||||
while ((pelement = nano_fiber_lifo_get(&nanoLifo2,
|
||||
TICKS_NONE)) == NULL) {
|
||||
fiber_yield();
|
||||
}
|
||||
if (pelement[1] != i) {
|
||||
break;
|
||||
}
|
||||
(*pcounter)++;
|
||||
}
|
||||
/* wait till it is safe to end: */
|
||||
nano_fiber_fifo_get(&nanoFifo_sync, TICKS_UNLIMITED);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief The main test entry
|
||||
*
|
||||
* @return 1 if success and 0 on failure
|
||||
*/
|
||||
int lifo_test(void)
|
||||
{
|
||||
uint32_t t;
|
||||
int i = 0;
|
||||
int return_value = 0;
|
||||
int element[2];
|
||||
int j;
|
||||
|
||||
nano_fifo_init(&nanoFifo_sync);
|
||||
|
||||
/* test get wait & put fiber functions */
|
||||
fprintf(output_file, sz_test_case_fmt,
|
||||
"LIFO #1");
|
||||
fprintf(output_file, sz_description,
|
||||
"\n\tnano_lifo_init"
|
||||
"\n\tnano_fiber_lifo_get(TICKS_UNLIMITED)"
|
||||
"\n\tnano_fiber_lifo_put");
|
||||
printf(sz_test_start_fmt);
|
||||
|
||||
lifo_test_init();
|
||||
|
||||
t = BENCH_START();
|
||||
|
||||
task_fiber_start(fiber_stack1, STACK_SIZE, lifo_fiber1, 0,
|
||||
NUMBER_OF_LOOPS, 3, 0);
|
||||
task_fiber_start(fiber_stack2, STACK_SIZE, lifo_fiber2, (int) &i,
|
||||
NUMBER_OF_LOOPS, 3, 0);
|
||||
|
||||
t = TIME_STAMP_DELTA_GET(t);
|
||||
|
||||
return_value += check_result(i, t);
|
||||
|
||||
/* fibers have done their job, they can stop now safely: */
|
||||
for (j = 0; j < 2; j++) {
|
||||
nano_task_fifo_put(&nanoFifo_sync, (void *) element);
|
||||
}
|
||||
|
||||
/* test get/yield & put fiber functions */
|
||||
fprintf(output_file, sz_test_case_fmt,
|
||||
"LIFO #2");
|
||||
fprintf(output_file, sz_description,
|
||||
"\n\tnano_lifo_init"
|
||||
"\n\tnano_fiber_lifo_get(TICKS_UNLIMITED)"
|
||||
"\n\tnano_fiber_lifo_get(TICKS_NONE)"
|
||||
"\n\tnano_fiber_lifo_put"
|
||||
"\n\tfiber_yield");
|
||||
printf(sz_test_start_fmt);
|
||||
|
||||
lifo_test_init();
|
||||
|
||||
t = BENCH_START();
|
||||
|
||||
i = 0;
|
||||
task_fiber_start(fiber_stack1, STACK_SIZE, lifo_fiber1, 0,
|
||||
NUMBER_OF_LOOPS, 3, 0);
|
||||
task_fiber_start(fiber_stack2, STACK_SIZE, lifo_fiber3, (int) &i,
|
||||
NUMBER_OF_LOOPS, 3, 0);
|
||||
|
||||
t = TIME_STAMP_DELTA_GET(t);
|
||||
|
||||
return_value += check_result(i, t);
|
||||
|
||||
/* fibers have done their job, they can stop now safely: */
|
||||
for (j = 0; j < 2; j++) {
|
||||
nano_task_fifo_put(&nanoFifo_sync, (void *) element);
|
||||
}
|
||||
|
||||
/* test get wait & put fiber/task functions */
|
||||
fprintf(output_file, sz_test_case_fmt,
|
||||
"LIFO #3");
|
||||
fprintf(output_file, sz_description,
|
||||
"\n\tnano_lifo_init"
|
||||
"\n\tnano_fiber_lifo_get(TICKS_UNLIMITED)"
|
||||
"\n\tnano_fiber_lifo_put"
|
||||
"\n\tnano_task_lifo_get(TICKS_UNLIMITED)"
|
||||
"\n\tnano_task_lifo_put");
|
||||
printf(sz_test_start_fmt);
|
||||
|
||||
lifo_test_init();
|
||||
|
||||
t = BENCH_START();
|
||||
|
||||
task_fiber_start(fiber_stack1, STACK_SIZE, lifo_fiber1, 0,
|
||||
NUMBER_OF_LOOPS, 3, 0);
|
||||
for (i = 0; i < NUMBER_OF_LOOPS / 2; i++) {
|
||||
int element[2];
|
||||
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);
|
||||
if (pelement[1] != 2 * i + 1) {
|
||||
break;
|
||||
}
|
||||
pelement = (int *)nano_task_lifo_get(&nanoLifo2,
|
||||
TICKS_UNLIMITED);
|
||||
if (pelement[1] != 2 * i) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
t = TIME_STAMP_DELTA_GET(t);
|
||||
|
||||
return_value += check_result(i * 2, t);
|
||||
|
||||
/* fibers have done their job, they can stop now safely: */
|
||||
for (j = 0; j < 2; j++) {
|
||||
nano_task_fifo_put(&nanoFifo_sync, (void *) element);
|
||||
}
|
||||
|
||||
return return_value;
|
||||
}
|
|
@ -1,246 +0,0 @@
|
|||
/* fifo.c */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2010, 2013-2014 Wind River Systems, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "syskernel.h"
|
||||
|
||||
struct nano_fifo nanoFifo1;
|
||||
struct nano_fifo nanoFifo2;
|
||||
|
||||
static struct nano_fifo nanoFifo_sync; /* for synchronization */
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Initialize FIFOs for the test
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void fifo_test_init(void)
|
||||
{
|
||||
nano_fifo_init(&nanoFifo1);
|
||||
nano_fifo_init(&nanoFifo2);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Fifo test fiber
|
||||
*
|
||||
* @param par1 Ignored parameter.
|
||||
* @param par2 Number of test loops.
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void fifo_fiber1(int par1, int par2)
|
||||
{
|
||||
int i;
|
||||
int element[2];
|
||||
int *pelement;
|
||||
|
||||
ARG_UNUSED(par1);
|
||||
for (i = 0; i < par2; i++) {
|
||||
pelement = (int *)nano_fiber_fifo_get(&nanoFifo1,
|
||||
TICKS_UNLIMITED);
|
||||
if (pelement[1] != i) {
|
||||
break;
|
||||
}
|
||||
element[1] = i;
|
||||
nano_fiber_fifo_put(&nanoFifo2, element);
|
||||
}
|
||||
/* wait till it is safe to end: */
|
||||
nano_fiber_fifo_get(&nanoFifo_sync, TICKS_UNLIMITED);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Fifo test fiber
|
||||
*
|
||||
* @param par1 Address of the counter.
|
||||
* @param par2 Number of test cycles.
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void fifo_fiber2(int par1, int par2)
|
||||
{
|
||||
int i;
|
||||
int element[2];
|
||||
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);
|
||||
if (pelement[1] != i) {
|
||||
break;
|
||||
}
|
||||
(*pcounter)++;
|
||||
}
|
||||
/* wait till it is safe to end: */
|
||||
nano_fiber_fifo_get(&nanoFifo_sync, TICKS_UNLIMITED);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Fifo test fiber
|
||||
*
|
||||
* @param par1 Address of the counter.
|
||||
* @param par2 Number of test cycles.
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void fifo_fiber3(int par1, int par2)
|
||||
{
|
||||
int i;
|
||||
int element[2];
|
||||
int *pelement;
|
||||
int *pcounter = (int *)par1;
|
||||
|
||||
for (i = 0; i < par2; i++) {
|
||||
element[1] = i;
|
||||
nano_fiber_fifo_put(&nanoFifo1, element);
|
||||
while ((pelement = nano_fiber_fifo_get(&nanoFifo2,
|
||||
TICKS_NONE)) == NULL) {
|
||||
fiber_yield();
|
||||
}
|
||||
if (pelement[1] != i) {
|
||||
break;
|
||||
}
|
||||
(*pcounter)++;
|
||||
}
|
||||
/* wait till it is safe to end: */
|
||||
nano_fiber_fifo_get(&nanoFifo_sync, TICKS_UNLIMITED);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief The main test entry
|
||||
*
|
||||
* @return 1 if success and 0 on failure
|
||||
*/
|
||||
int fifo_test(void)
|
||||
{
|
||||
uint32_t t;
|
||||
int i = 0;
|
||||
int return_value = 0;
|
||||
int element[2];
|
||||
int j;
|
||||
|
||||
nano_fifo_init(&nanoFifo_sync);
|
||||
|
||||
/* test get wait & put fiber functions */
|
||||
fprintf(output_file, sz_test_case_fmt,
|
||||
"FIFO #1");
|
||||
fprintf(output_file, sz_description,
|
||||
"\n\tnano_fifo_init"
|
||||
"\n\tnano_fiber_fifo_get(TICKS_UNLIMITED)"
|
||||
"\n\tnano_fiber_fifo_put");
|
||||
printf(sz_test_start_fmt);
|
||||
|
||||
fifo_test_init();
|
||||
|
||||
t = BENCH_START();
|
||||
|
||||
task_fiber_start(fiber_stack1, STACK_SIZE, fifo_fiber1, 0,
|
||||
NUMBER_OF_LOOPS, 3, 0);
|
||||
task_fiber_start(fiber_stack2, STACK_SIZE, fifo_fiber2, (int) &i,
|
||||
NUMBER_OF_LOOPS, 3, 0);
|
||||
|
||||
t = TIME_STAMP_DELTA_GET(t);
|
||||
|
||||
return_value += check_result(i, t);
|
||||
|
||||
/* fibers have done their job, they can stop now safely: */
|
||||
for (j = 0; j < 2; j++) {
|
||||
nano_task_fifo_put(&nanoFifo_sync, (void *) element);
|
||||
}
|
||||
|
||||
/* test get/yield & put fiber functions */
|
||||
fprintf(output_file, sz_test_case_fmt,
|
||||
"FIFO #2");
|
||||
fprintf(output_file, sz_description,
|
||||
"\n\tnano_fifo_init"
|
||||
"\n\tnano_fiber_fifo_get(TICKS_UNLIMITED)"
|
||||
"\n\tnano_fiber_fifo_get(TICKS_NONE)"
|
||||
"\n\tnano_fiber_fifo_put"
|
||||
"\n\tfiber_yield");
|
||||
printf(sz_test_start_fmt);
|
||||
|
||||
fifo_test_init();
|
||||
|
||||
t = BENCH_START();
|
||||
|
||||
i = 0;
|
||||
task_fiber_start(fiber_stack1, STACK_SIZE, fifo_fiber1, 0,
|
||||
NUMBER_OF_LOOPS, 3, 0);
|
||||
task_fiber_start(fiber_stack2, STACK_SIZE, fifo_fiber3, (int) &i,
|
||||
NUMBER_OF_LOOPS, 3, 0);
|
||||
|
||||
t = TIME_STAMP_DELTA_GET(t);
|
||||
|
||||
return_value += check_result(i, t);
|
||||
|
||||
/* fibers have done their job, they can stop now safely: */
|
||||
for (j = 0; j < 2; j++) {
|
||||
nano_task_fifo_put(&nanoFifo_sync, (void *) element);
|
||||
}
|
||||
|
||||
/* test get wait & put fiber/task functions */
|
||||
fprintf(output_file, sz_test_case_fmt,
|
||||
"FIFO #3");
|
||||
fprintf(output_file, sz_description,
|
||||
"\n\tnano_fifo_init"
|
||||
"\n\tnano_fiber_fifo_get(TICKS_UNLIMITED)"
|
||||
"\n\tnano_fiber_fifo_put"
|
||||
"\n\tnano_task_fifo_get(TICKS_UNLIMITED)"
|
||||
"\n\tnano_task_fifo_put");
|
||||
printf(sz_test_start_fmt);
|
||||
|
||||
fifo_test_init();
|
||||
|
||||
t = BENCH_START();
|
||||
|
||||
task_fiber_start(fiber_stack1, STACK_SIZE, fifo_fiber1, 0,
|
||||
NUMBER_OF_LOOPS / 2, 3, 0);
|
||||
task_fiber_start(fiber_stack2, STACK_SIZE, fifo_fiber1, 0,
|
||||
NUMBER_OF_LOOPS / 2, 3, 0);
|
||||
for (i = 0; i < NUMBER_OF_LOOPS / 2; i++) {
|
||||
int element[2];
|
||||
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);
|
||||
if (pelement[1] != i) {
|
||||
break;
|
||||
}
|
||||
pelement = (int *)nano_task_fifo_get(&nanoFifo2,
|
||||
TICKS_UNLIMITED);
|
||||
if (pelement[1] != i) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
t = TIME_STAMP_DELTA_GET(t);
|
||||
|
||||
return_value += check_result(i * 2, t);
|
||||
|
||||
/* fibers have done their job, they can stop now safely: */
|
||||
for (j = 0; j < 2; j++) {
|
||||
nano_task_fifo_put(&nanoFifo_sync, (void *) element);
|
||||
}
|
||||
|
||||
return return_value;
|
||||
}
|
|
@ -1,176 +0,0 @@
|
|||
/* sema.c */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2010, 2013-2014 Wind River Systems, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "syskernel.h"
|
||||
|
||||
struct nano_sem nanoSem1;
|
||||
struct nano_sem nanoSem2;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Initialize semaphores for the test
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void sema_test_init(void)
|
||||
{
|
||||
nano_sem_init(&nanoSem1);
|
||||
nano_sem_init(&nanoSem2);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Semaphore test fiber
|
||||
*
|
||||
* @param par1 Ignored parameter.
|
||||
* @param par2 Number of test loops.
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void sema_fiber1(int par1, int par2)
|
||||
{
|
||||
int i;
|
||||
|
||||
ARG_UNUSED(par1);
|
||||
|
||||
for (i = 0; i < par2; i++) {
|
||||
nano_fiber_sem_take(&nanoSem1, TICKS_UNLIMITED);
|
||||
nano_fiber_sem_give(&nanoSem2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Semaphore test fiber
|
||||
*
|
||||
* @param par1 Address of the counter.
|
||||
* @param par2 Number of test cycles.
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void sema_fiber2(int par1, int par2)
|
||||
{
|
||||
int i;
|
||||
int *pcounter = (int *)par1;
|
||||
|
||||
for (i = 0; i < par2; i++) {
|
||||
nano_fiber_sem_give(&nanoSem1);
|
||||
nano_fiber_sem_take(&nanoSem2, TICKS_UNLIMITED);
|
||||
(*pcounter)++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Semaphore test fiber
|
||||
*
|
||||
* @param par1 Address of the counter.
|
||||
* @param par2 Number of test cycles.
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void sema_fiber3(int par1, int par2)
|
||||
{
|
||||
int i;
|
||||
int *pcounter = (int *)par1;
|
||||
|
||||
for (i = 0; i < par2; i++) {
|
||||
nano_fiber_sem_give(&nanoSem1);
|
||||
while (!nano_fiber_sem_take(&nanoSem2, TICKS_NONE)) {
|
||||
fiber_yield();
|
||||
}
|
||||
(*pcounter)++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief The main test entry
|
||||
*
|
||||
* @return 1 if success and 0 on failure
|
||||
*/
|
||||
int sema_test(void)
|
||||
{
|
||||
uint32_t t;
|
||||
int i = 0;
|
||||
int return_value = 0;
|
||||
|
||||
fprintf(output_file, sz_test_case_fmt,
|
||||
"Semaphore #1");
|
||||
fprintf(output_file, sz_description,
|
||||
"\n\tnano_sem_init"
|
||||
"\n\tnano_fiber_sem_take(TICKS_UNLIMITED)"
|
||||
"\n\tnano_fiber_sem_give");
|
||||
printf(sz_test_start_fmt);
|
||||
|
||||
sema_test_init();
|
||||
|
||||
t = BENCH_START();
|
||||
|
||||
task_fiber_start(fiber_stack1, STACK_SIZE, sema_fiber1, 0,
|
||||
NUMBER_OF_LOOPS, 3, 0);
|
||||
task_fiber_start(fiber_stack2, STACK_SIZE, sema_fiber2, (int) &i,
|
||||
NUMBER_OF_LOOPS, 3, 0);
|
||||
|
||||
t = TIME_STAMP_DELTA_GET(t);
|
||||
|
||||
return_value += check_result(i, t);
|
||||
|
||||
fprintf(output_file, sz_test_case_fmt,
|
||||
"Semaphore #2");
|
||||
fprintf(output_file, sz_description,
|
||||
"\n\tnano_sem_init"
|
||||
"\n\tnano_fiber_sem_take(TICKS_NONE)"
|
||||
"\n\tfiber_yield"
|
||||
"\n\tnano_fiber_sem_give");
|
||||
printf(sz_test_start_fmt);
|
||||
|
||||
sema_test_init();
|
||||
i = 0;
|
||||
|
||||
t = BENCH_START();
|
||||
|
||||
task_fiber_start(fiber_stack1, STACK_SIZE, sema_fiber1, 0,
|
||||
NUMBER_OF_LOOPS, 3, 0);
|
||||
task_fiber_start(fiber_stack2, STACK_SIZE, sema_fiber3, (int) &i,
|
||||
NUMBER_OF_LOOPS, 3, 0);
|
||||
|
||||
t = TIME_STAMP_DELTA_GET(t);
|
||||
|
||||
return_value += check_result(i, t);
|
||||
|
||||
fprintf(output_file, sz_test_case_fmt,
|
||||
"Semaphore #3");
|
||||
fprintf(output_file, sz_description,
|
||||
"\n\tnano_sem_init"
|
||||
"\n\tnano_fiber_sem_take(TICKS_UNLIMITED)"
|
||||
"\n\tnano_fiber_sem_give"
|
||||
"\n\tnano_task_sem_give"
|
||||
"\n\tnano_task_sem_take(TICKS_UNLIMITED)");
|
||||
printf(sz_test_start_fmt);
|
||||
|
||||
sema_test_init();
|
||||
|
||||
t = BENCH_START();
|
||||
|
||||
task_fiber_start(fiber_stack1, STACK_SIZE, sema_fiber1, 0,
|
||||
NUMBER_OF_LOOPS, 3, 0);
|
||||
for (i = 0; i < NUMBER_OF_LOOPS; i++) {
|
||||
nano_task_sem_give(&nanoSem1);
|
||||
nano_task_sem_take(&nanoSem2, TICKS_UNLIMITED);
|
||||
}
|
||||
|
||||
t = TIME_STAMP_DELTA_GET(t);
|
||||
|
||||
return_value += check_result(i, t);
|
||||
|
||||
return return_value;
|
||||
}
|
|
@ -1,225 +0,0 @@
|
|||
/* stack.c */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2010, 2013-2014 Wind River Systems, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "syskernel.h"
|
||||
|
||||
struct nano_stack nano_stack_1;
|
||||
struct nano_stack nano_stack_2;
|
||||
|
||||
uint32_t stack1[2];
|
||||
uint32_t stack2[2];
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Initialize stacks for the test
|
||||
*
|
||||
* @return N/A
|
||||
*
|
||||
*/
|
||||
void stack_test_init(void)
|
||||
{
|
||||
nano_stack_init(&nano_stack_1, stack1);
|
||||
nano_stack_init(&nano_stack_2, stack2);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Stack test fiber
|
||||
*
|
||||
* @param par1 Ignored parameter.
|
||||
* @param par2 Number of test loops.
|
||||
*
|
||||
* @return N/A
|
||||
*
|
||||
*/
|
||||
void stack_fiber1(int par1, int par2)
|
||||
{
|
||||
int i;
|
||||
uint32_t data;
|
||||
|
||||
ARG_UNUSED(par1);
|
||||
|
||||
for (i = 0; i < par2 / 2; i++) {
|
||||
nano_fiber_stack_pop(&nano_stack_1, &data, TICKS_UNLIMITED);
|
||||
if (data != 2 * i) {
|
||||
break;
|
||||
}
|
||||
data = 2 * i;
|
||||
nano_fiber_stack_push(&nano_stack_2, data);
|
||||
nano_fiber_stack_pop(&nano_stack_1, &data, TICKS_UNLIMITED);
|
||||
if (data != 2 * i + 1) {
|
||||
break;
|
||||
}
|
||||
data = 2 * i + 1;
|
||||
nano_fiber_stack_push(&nano_stack_2, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Stack test fiber
|
||||
*
|
||||
* @param par1 Address of the counter.
|
||||
* @param par2 Number of test cycles.
|
||||
*
|
||||
* @return N/A
|
||||
*
|
||||
*/
|
||||
void stack_fiber2(int par1, int par2)
|
||||
{
|
||||
int i;
|
||||
uint32_t data;
|
||||
int *pcounter = (int *)par1;
|
||||
|
||||
for (i = 0; i < par2; i++) {
|
||||
data = i;
|
||||
nano_fiber_stack_push(&nano_stack_1, data);
|
||||
nano_fiber_stack_pop(&nano_stack_2, &data, TICKS_UNLIMITED);
|
||||
if (data != i) {
|
||||
break;
|
||||
}
|
||||
(*pcounter)++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Stack test fiber
|
||||
*
|
||||
* @param par1 Address of the counter.
|
||||
* @param par2 Number of test cycles.
|
||||
*
|
||||
* @return N/A
|
||||
*
|
||||
*/
|
||||
void stack_fiber3(int par1, int par2)
|
||||
{
|
||||
int i;
|
||||
uint32_t data;
|
||||
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)) {
|
||||
fiber_yield();
|
||||
}
|
||||
if (data != i) {
|
||||
break;
|
||||
}
|
||||
(*pcounter)++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief The main test entry
|
||||
*
|
||||
* @return 1 if success and 0 on failure
|
||||
*
|
||||
*/
|
||||
int stack_test(void)
|
||||
{
|
||||
uint32_t t;
|
||||
int i = 0;
|
||||
int return_value = 0;
|
||||
|
||||
/* test get wait & put fiber functions */
|
||||
fprintf(output_file, sz_test_case_fmt,
|
||||
"Stack #1");
|
||||
fprintf(output_file, sz_description,
|
||||
"\n\tnano_stack_init"
|
||||
"\n\tnano_fiber_stack_pop(TICKS_UNLIMITED)"
|
||||
"\n\tnano_fiber_stack_push");
|
||||
printf(sz_test_start_fmt);
|
||||
|
||||
stack_test_init();
|
||||
|
||||
t = BENCH_START();
|
||||
|
||||
task_fiber_start(fiber_stack1, STACK_SIZE, stack_fiber1, 0,
|
||||
NUMBER_OF_LOOPS, 3, 0);
|
||||
task_fiber_start(fiber_stack2, STACK_SIZE, stack_fiber2, (int) &i,
|
||||
NUMBER_OF_LOOPS, 3, 0);
|
||||
|
||||
t = TIME_STAMP_DELTA_GET(t);
|
||||
|
||||
return_value += check_result(i, t);
|
||||
|
||||
/* test get/yield & put fiber functions */
|
||||
fprintf(output_file, sz_test_case_fmt,
|
||||
"Stack #2");
|
||||
fprintf(output_file, sz_description,
|
||||
"\n\tnano_stack_init"
|
||||
"\n\tnano_fiber_stack_pop(TICKS_UNLIMITED)"
|
||||
"\n\tnano_fiber_stack_pop"
|
||||
"\n\tnano_fiber_stack_push"
|
||||
"\n\tfiber_yield");
|
||||
printf(sz_test_start_fmt);
|
||||
|
||||
stack_test_init();
|
||||
|
||||
t = BENCH_START();
|
||||
|
||||
i = 0;
|
||||
task_fiber_start(fiber_stack1, STACK_SIZE, stack_fiber1, 0,
|
||||
NUMBER_OF_LOOPS, 3, 0);
|
||||
task_fiber_start(fiber_stack2, STACK_SIZE, stack_fiber3, (int) &i,
|
||||
NUMBER_OF_LOOPS, 3, 0);
|
||||
|
||||
t = TIME_STAMP_DELTA_GET(t);
|
||||
|
||||
return_value += check_result(i, t);
|
||||
|
||||
/* test get wait & put fiber/task functions */
|
||||
fprintf(output_file, sz_test_case_fmt,
|
||||
"Stack #3");
|
||||
fprintf(output_file, sz_description,
|
||||
"\n\tnano_stack_init"
|
||||
"\n\tnano_fiber_stack_pop(TICKS_UNLIMITED)"
|
||||
"\n\tnano_fiber_stack_push"
|
||||
"\n\tnano_task_stack_pop(TICKS_UNLIMITED)"
|
||||
"\n\tnano_task_stack_push");
|
||||
printf(sz_test_start_fmt);
|
||||
|
||||
stack_test_init();
|
||||
|
||||
t = BENCH_START();
|
||||
|
||||
task_fiber_start(fiber_stack1, STACK_SIZE, stack_fiber1, 0,
|
||||
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;
|
||||
nano_task_stack_push(&nano_stack_1, data);
|
||||
|
||||
nano_task_stack_pop(&nano_stack_2, &data, TICKS_UNLIMITED);
|
||||
if (data != 2 * i + 1) {
|
||||
break;
|
||||
}
|
||||
nano_task_stack_pop(&nano_stack_2, &data, TICKS_UNLIMITED);
|
||||
if (data != 2 * i) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
t = TIME_STAMP_DELTA_GET(t);
|
||||
|
||||
return_value += check_result(i * 2, t);
|
||||
|
||||
return return_value;
|
||||
}
|
|
@ -1,177 +0,0 @@
|
|||
/* syskernel.c */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2010, 2012-2014 Wind River Systems, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <tc_util.h>
|
||||
|
||||
#include "syskernel.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
char __stack fiber_stack1[STACK_SIZE];
|
||||
char __stack fiber_stack2[STACK_SIZE];
|
||||
|
||||
char Msg[256];
|
||||
|
||||
FILE *output_file;
|
||||
|
||||
const char sz_success[] = "SUCCESSFUL";
|
||||
const char sz_partial[] = "PARTIAL";
|
||||
const char sz_fail[] = "FAILED";
|
||||
|
||||
/* time necessary to read the time */
|
||||
uint32_t tm_off;
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Get the time ticks before test starts
|
||||
*
|
||||
* Routine does necessary preparations for the test to start
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void begin_test(void)
|
||||
{
|
||||
/*
|
||||
* Invoke bench_test_start in order to be able to use
|
||||
* tCheck static variable.
|
||||
*/
|
||||
bench_test_start();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Checks number of tests and calculate average time
|
||||
*
|
||||
* @return 1 if success and 0 on failure
|
||||
*
|
||||
* @param i Number of tests.
|
||||
* @param t Time in ticks for the whole test.
|
||||
*/
|
||||
int check_result(int i, uint32_t t)
|
||||
{
|
||||
/*
|
||||
* bench_test_end checks tCheck static variable.
|
||||
* bench_test_start modifies it
|
||||
*/
|
||||
if (bench_test_end() != 0) {
|
||||
fprintf(output_file, sz_case_result_fmt, sz_fail);
|
||||
fprintf(output_file, sz_case_details_fmt,
|
||||
"timer tick happened. Results are inaccurate");
|
||||
fprintf(output_file, sz_case_end_fmt);
|
||||
return 0;
|
||||
}
|
||||
if (i != NUMBER_OF_LOOPS) {
|
||||
fprintf(output_file, sz_case_result_fmt, sz_fail);
|
||||
fprintf(output_file, sz_case_details_fmt, "loop counter = ");
|
||||
fprintf(output_file, "%i !!!", i);
|
||||
fprintf(output_file, sz_case_end_fmt);
|
||||
return 0;
|
||||
}
|
||||
fprintf(output_file, sz_case_result_fmt, sz_success);
|
||||
fprintf(output_file, sz_case_details_fmt,
|
||||
"Average time for 1 iteration: ");
|
||||
fprintf(output_file, sz_case_timing_fmt,
|
||||
SYS_CLOCK_HW_CYCLES_TO_NS_AVG(t, NUMBER_OF_LOOPS));
|
||||
|
||||
fprintf(output_file, sz_case_end_fmt);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Check for a key press
|
||||
*
|
||||
* @return 1 when a keyboard key is pressed, or 0 if no keyboard support
|
||||
*/
|
||||
int kbhit(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Prepares the test output
|
||||
*
|
||||
* @param continuously Run test till the user presses the key.
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
|
||||
void init_output(int *continuously)
|
||||
{
|
||||
ARG_UNUSED(continuously);
|
||||
|
||||
/*
|
||||
* send all printf and fprintf to console
|
||||
*/
|
||||
output_file = stdout;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Close output for the test
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
void output_close(void)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @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();
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
/* syskernel.h */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-2010, 2014 Wind River Systems, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef SYSKERNEK_H
|
||||
#define SYSKERNEK_H
|
||||
|
||||
#include <timestamp.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <toolchain.h>
|
||||
|
||||
#define STACK_SIZE 2048
|
||||
#define NUMBER_OF_LOOPS 5000
|
||||
|
||||
extern char fiber_stack1[STACK_SIZE];
|
||||
extern char fiber_stack2[STACK_SIZE];
|
||||
|
||||
extern FILE *output_file;
|
||||
|
||||
extern const char sz_success[];
|
||||
extern const char sz_partial[];
|
||||
extern const char sz_fail[];
|
||||
|
||||
#define sz_module_title_fmt "\nMODULE: %s"
|
||||
#define sz_module_result_fmt "\n\nPROJECT EXECUTION %s\n"
|
||||
#define sz_module_end_fmt "\nEND MODULE"
|
||||
|
||||
#define sz_date_fmt "\nBUILD_DATE: %s %s"
|
||||
#define sz_kernel_ver_fmt "\nKERNEL VERSION: 0x%x"
|
||||
#define sz_description "\nTEST COVERAGE: %s"
|
||||
|
||||
#define sz_test_case_fmt "\n\nTEST CASE: %s"
|
||||
#define sz_test_start_fmt "\nStarting test. Please wait..."
|
||||
#define sz_case_result_fmt "\nTEST RESULT: %s"
|
||||
#define sz_case_details_fmt "\nDETAILS: %s"
|
||||
#define sz_case_end_fmt "\nEND TEST CASE"
|
||||
#define sz_case_timing_fmt "%u nSec"
|
||||
|
||||
int check_result(int i, uint32_t ticks);
|
||||
|
||||
int sema_test(void);
|
||||
int lifo_test(void);
|
||||
int fifo_test(void);
|
||||
int stack_test(void);
|
||||
void begin_test(void);
|
||||
|
||||
static inline uint32_t BENCH_START(void)
|
||||
{
|
||||
uint32_t et;
|
||||
|
||||
begin_test();
|
||||
et = TIME_STAMP_DELTA_GET(0);
|
||||
return et;
|
||||
}
|
||||
|
||||
#endif /* SYSKERNEK_H */
|
|
@ -1,6 +0,0 @@
|
|||
[test]
|
||||
tags = legacy benchmark
|
||||
arch_whitelist = x86
|
||||
filter = not ((CONFIG_DEBUG or CONFIG_ASSERT)) and ( CONFIG_SRAM_SIZE >= 32
|
||||
or CONFIG_DCCM_SIZE >= 32 or CONFIG_RAM_SIZE >= 32)
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue