benchmarks: move footprint benchmark out of legacy

Those can be used with unified kernel.

Change-Id: I4bd024f7e645b99ac1b8df6dfbbdd94f2fda99c4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2017-03-23 08:53:24 -04:00 committed by Anas Nashif
commit 477a928134
39 changed files with 14 additions and 507 deletions

View file

@ -5,7 +5,6 @@ BOARD ?= qemu_x86
ARCH = $(notdir $(subst /$(BOARD),,$(wildcard $(ZEPHYR_BASE)/boards/*/$(BOARD))))
MDEF_FILE = micro_${TEST}.mdef
CONF_FILE = $(or $(wildcard $(TEST)/$(BOARD).conf), \
$(wildcard $(TEST)/$(ARCH).conf))
ifeq ($(TEST),float)

View file

@ -0,0 +1 @@
obj-y = main.o

View file

@ -1,5 +1,3 @@
/* microkernel_footprint.c - microkernel footprint */
/*
* Copyright (c) 2013-2015 Wind River Systems, Inc.
*
@ -11,7 +9,7 @@
#ifdef TEST_min
/* INTENTIONALLY LEFT EMPTY (I.E. NO APPLICATION TASKS, FIBERS, OR ISRS) */
/* INTENTIONALLY LEFT EMPTY (I.E. NO APPLICATION THREADS, OR ISRS) */
#else
@ -23,16 +21,16 @@
#define TEST_SOFT_INT 64
#ifdef TEST_max
#define MESSAGE "Running maximal microkernel configuration %p\n"
#define MESSAGE "Running maximal kernel configuration %p\n"
#else
#define MESSAGE "Running regular microkernel configuration %p\n"
#define MESSAGE "Running regular kernel configuration %p\n"
#endif /* TEST_max */
typedef void* (*pfunc) (void*);
typedef void* (*pfunc) (void *);
/* variables */
volatile int i = 0; /* counter used by foreground task */
volatile int i; /* counter used by foreground task */
static pfunc func_array[] = {
/* mutexes */
@ -155,7 +153,7 @@ static pfunc func_array[] = {
*
* @return N/A
*/
void dummyIsr(void *unused)
void dummy_isr(void *unused)
{
ARG_UNUSED(unused);
}
@ -169,10 +167,11 @@ void dummyIsr(void *unused)
*
* @return N/A
*/
void fgTaskEntry(void)
void main(void)
{
i = 0;
#ifdef TEST_reg
IRQ_CONNECT(IRQ_LINE, IRQ_PRIORITY, dummyIsr, NULL, 0);
IRQ_CONNECT(IRQ_LINE, IRQ_PRIORITY, dummy_isr, NULL, 0);
#endif
/* note: referencing "func_array" ensures it isn't optimized out */
#ifdef TEST_max

View file

@ -1,12 +1,12 @@
[footprint-min]
tags = legacy footprint
tags = footprint
extra_args = TEST=min
build_only = true
platform_exclude = tinytile
filter = not CONFIG_BOARD_GALILEO
[footprint-reg]
tags = legacy footprint
tags = footprint
extra_args = TEST=reg
build_only = true
arch_whitelist = x86
@ -14,7 +14,7 @@ platform_exclude = tinytile
filter = ( CONFIG_SRAM_SIZE > 8 or CONFIG_DCCM_SIZE > 8 or CONFIG_RAM_SIZE > 8 )
[footprint-max]
tags = legacy footprint
tags = footprint
extra_args = TEST=max
build_only = true
arch_whitelist = x86
@ -22,7 +22,7 @@ platform_exclude = tinytile
filter = ( CONFIG_SRAM_SIZE > 8 or CONFIG_DCCM_SIZE > 8 or CONFIG_RAM_SIZE > 8 )
[footprint-float]
tags = legacy footprint
tags = ootprint
extra_args = TEST=float
build_only = true
arch_whitelist = x86

View file

@ -1,37 +0,0 @@
% Application : maximal Microkernel footprint
% TASK NAME PRIO ENTRY STACK GROUPS
% ==================================================
TASK fgTask 10 fgTaskEntry 1024 [EXE]
% EVENT NAME ENTRY
% ====================
EVENT MYEVENT NULL
% MUTEX NAME
% ==============
MUTEX MY_MUTEX
% SEMA NAME
% ===========
SEMA MYSEMA
% FIFO NAME DEPTH WIDTH
% ==========================
FIFO MYFIFO 1 4
% PIPE NAME BUFFERSIZE
% ===========================
PIPE MYPIPE 0
% MAILBOX NAME
% ==============
MAILBOX MYMBOX
% MAP NAME BLOCKS BLOCKSIZE
% ==============================
MAP MYMAP 1 4
% POOL NAME MIN MAX NMAX
% ==============================
POOL MYPOOL 4 4 1

View file

@ -1,37 +0,0 @@
% Application : maximal Microkernel footprint
% TASK NAME PRIO ENTRY STACK GROUPS
% ==================================================
TASK fgTask 10 fgTaskEntry 1024 [EXE]
% EVENT NAME ENTRY
% ====================
EVENT MYEVENT NULL
% MUTEX NAME
% ==============
MUTEX MY_MUTEX
% SEMA NAME
% ===========
SEMA MYSEMA
% FIFO NAME DEPTH WIDTH
% ==========================
FIFO MYFIFO 1 4
% PIPE NAME BUFFERSIZE
% ===========================
PIPE MYPIPE 0
% MAILBOX NAME
% ==============
MAILBOX MYMBOX
% MAP NAME BLOCKS BLOCKSIZE
% ==============================
MAP MYMAP 1 4
% POOL NAME MIN MAX NMAX
% ==============================
POOL MYPOOL 4 4 1

View file

@ -1,2 +0,0 @@
% Application : minimal Microkernel footprint

View file

@ -1,21 +0,0 @@
% Application : regular Microkernel footprint
% TASK NAME PRIO ENTRY STACK GROUPS
% ==================================================
TASK fgTask 10 fgTaskEntry 512 [EXE]
% EVENT NAME ENTRY
% ======================
EVENT MYEVENT NULL
% MUTEX NAME
% ==============
MUTEX MY_MUTEX
% FIFO NAME DEPTH WIDTH
% ===========================
FIFO MYFIFO 1 4
% MAP NAME BLOCKS BLOCKSIZE
% =================================
MAP MYMAP 1 4

View file

@ -1 +0,0 @@
obj-y=microkernel_footprint.o

View file

@ -1,25 +0,0 @@
# default configuration
TEST ?= min
ARCH = $(notdir $(subst /$(BOARD),,$(wildcard $(ZEPHYR_BASE)/boards/*/$(BOARD))))
BOARD ?= qemu_x86
CONF_FILE ?= $(or $(wildcard $(TEST)/$(BOARD).conf), \
$(wildcard $(TEST)/$(ARCH).conf))
ifeq ($(CONF_FILE),)
CONF_FILE = $(TEST)/default.conf
endif
ifeq ($(TEST),float)
CFLAGS += -DTEST_max
else
CFLAGS += -DTEST_$(TEST)
endif
include $(ZEPHYR_BASE)/Makefile.test
ifeq ($(ARCH),ARM)
ifneq ($(TEST),min)
$(error 'reg' and 'max' test do not currently build for ARM)
endif
endif

View file

@ -1,98 +0,0 @@
Title: Nanokernel Footprint Measurement
Description:
This project is designed to characterize the memory requirements of a
nanokernel-only image running on an Atom target.
The project can be built using several configurations:
minimal (a "do nothing" image that has support for few kernel capabilities)
-------
- Background task is only task in system; no fibers are utilized.
- Background task simply runs an endless loop that increments a global variable.
- No system timer support.
- ISR for the spurious interrupt handling is present.
- IDT and stack memory sizes are very limited.
regular (a "typical" image that has support for some kernel capabilities)
-------
- As for "minimal" configuration, except as noted below.
- Supports larger IDT and utilizes larger stacks.
- A statically linked dummy ISR is present.
- Background task also starts a fiber.
- Fiber prints a message to the console via printk().
- Supports system timer, along with NANO_TIMER objects.
- Links in support for NANO_SEM objects.
maximal (a "complex" image that has support for many kernel capabilities)
-------
- As for "regular" configuration, except as noted below.
- Supports full IDT and utilizes even larger stacks.
- Background task dynamically links in the dummy ISR, rather than having
it statically linked.
- Fiber prints a message to the console via printf(), rather than printk().
- Links in support for NANO_LIFO, NANO_STACK, and NANO_FIFO objects.
- Adds floating point support (for x87 FPU, including SSE).
--------------------------------------------------------------------------------
Building and Running Project:
This nanokernel project does not generate any output in the default case
(TEST=min). In the regular case (TEST=reg) and the maximal case (TEST=max),
it outputs to the console. It can be built and executed on QEMU as follows:
make TEST=min qemu (minimal configuration)
make TEST=reg qemu (regular configuration)
make TEST=max qemu (maximal configuration)
--------------------------------------------------------------------------------
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:
The resulting image is bootable for all configurations, but produces different
output in each case.
minimal
-------
This configuration does NOT produce any output. To observe its operation,
invoke it using gdb and observe that:
- main() increments "i" each time it loops
- the kernel's timer ISR increments "nanoTicks" on a regular basis
regular
-------
This configuration prints the following message to the console:
Running regular nanokernel configuration
maximal
-------
This configuration prints the following message to the console:
Running maximal nanokernel configuration
--------------------------------------------------------------------------------
Additional notes:
Various host utilities (such as the Unix "size" utility) can be used to
determine the footprint of the resulting zephyr.elf image.

View file

@ -1,8 +0,0 @@
CONFIG_PRINTK=y
CONFIG_STDOUT_CONSOLE=y
CONFIG_IDT_NUM_VECTORS=256
CONFIG_FLOAT=y
CONFIG_SSE=y
CONFIG_FP_SHARING=y
CONFIG_LEGACY_KERNEL=y

View file

@ -1,3 +0,0 @@
CONFIG_SERIAL=n
CONFIG_IPM=n
CONFIG_LEGACY_KERNEL=y

View file

@ -1,5 +0,0 @@
CONFIG_PRINTK=y
CONFIG_STDOUT_CONSOLE=y
CONFIG_NUM_IRQS=43
CONFIG_FAULT_DUMP=2
CONFIG_LEGACY_KERNEL=y

View file

@ -1,4 +0,0 @@
CONFIG_PRINTK=y
CONFIG_STDOUT_CONSOLE=y
CONFIG_IDT_NUM_VECTORS=256
CONFIG_LEGACY_KERNEL=y

View file

@ -1,4 +0,0 @@
CONFIG_PRINTK=y
CONFIG_STDOUT_CONSOLE=y
CONFIG_IDT_NUM_VECTORS=256
CONFIG_LEGACY_KERNEL=y

View file

@ -1,10 +0,0 @@
CONFIG_ISR_STACK_SIZE=128
CONFIG_MAIN_STACK_SIZE=128
CONFIG_PRINTK=n
CONFIG_NUM_IRQS=1
CONFIG_FAULT_DUMP=0
CONFIG_CONSOLE=n
CONFIG_SERIAL=n
CONFIG_ERRNO=n
CONFIG_IPM=n
CONFIG_LEGACY_KERNEL=y

View file

@ -1,9 +0,0 @@
CONFIG_ISR_STACK_SIZE=128
CONFIG_MAIN_STACK_SIZE=128
CONFIG_PRINTK=n
CONFIG_NUM_IRQS=1
CONFIG_FAULT_DUMP=0
CONFIG_CONSOLE=n
CONFIG_SERIAL=n
CONFIG_ERRNO=n
CONFIG_LEGACY_KERNEL=y

View file

@ -1,10 +0,0 @@
CONFIG_ISR_STACK_SIZE=128
CONFIG_MAIN_STACK_SIZE=128
CONFIG_SYS_CLOCK_TICKS_PER_SEC=0
CONFIG_PRINTK=n
CONFIG_CONSOLE=n
CONFIG_SERIAL=n
CONFIG_IPM=n
CONFIG_GPIO=n
CONFIG_ERRNO=n
CONFIG_LEGACY_KERNEL=y

View file

@ -1,18 +0,0 @@
CONFIG_ISR_STACK_SIZE=128
CONFIG_MAIN_STACK_SIZE=128
CONFIG_SYS_CLOCK_TICKS_PER_SEC=0
CONFIG_PRINTK=n
CONFIG_HPET_TIMER_IRQ_PRIORITY=2
CONFIG_IDT_NUM_VECTORS=36
CONFIG_CONSOLE=n
CONFIG_SERIAL=n
CONFIG_PINMUX=n
CONFIG_I2C=n
CONFIG_GPIO=n
CONFIG_PWM=n
CONFIG_SPI=n
CONFIG_ADC=n
CONFIG_SHARED_IRQ=n
CONFIG_PCI_LEGACY_BRIDGE=n
CONFIG_ERRNO=n
CONFIG_LEGACY_KERNEL=y

View file

@ -1,10 +0,0 @@
CONFIG_ISR_STACK_SIZE=128
CONFIG_MAIN_STACK_SIZE=128
CONFIG_SYS_CLOCK_TICKS_PER_SEC=0
CONFIG_PRINTK=n
CONFIG_HPET_TIMER_IRQ_PRIORITY=2
CONFIG_IDT_NUM_VECTORS=64
CONFIG_CONSOLE=n
CONFIG_SERIAL=n
CONFIG_ERRNO=n
CONFIG_LEGACY_KERNEL=y

View file

@ -1,12 +0,0 @@
CONFIG_ISR_STACK_SIZE=128
CONFIG_MAIN_STACK_SIZE=128
CONFIG_SYS_CLOCK_TICKS_PER_SEC=0
CONFIG_PRINTK=n
CONFIG_HPET_TIMER_IRQ_PRIORITY=2
CONFIG_IDT_NUM_VECTORS=33
CONFIG_CONSOLE=n
CONFIG_SERIAL=n
CONFIG_IPM=n
CONFIG_GPIO=n
CONFIG_ERRNO=n
CONFIG_LEGACY_KERNEL=y

View file

@ -1,3 +0,0 @@
CONFIG_SERIAL=n
CONFIG_IPM=n
CONFIG_LEGACY_KERNEL=y

View file

@ -1,6 +0,0 @@
CONFIG_ISR_STACK_SIZE=512
CONFIG_MAIN_STACK_SIZE=512
CONFIG_PRINTK=y
CONFIG_NUM_IRQS=43
CONFIG_FAULT_DUMP=1
CONFIG_LEGACY_KERNEL=y

View file

@ -1,4 +0,0 @@
CONFIG_ISR_STACK_SIZE=512
CONFIG_MAIN_STACK_SIZE=512
CONFIG_PRINTK=y
CONFIG_LEGACY_KERNEL=y

View file

@ -1,5 +0,0 @@
CONFIG_ISR_STACK_SIZE=512
CONFIG_MAIN_STACK_SIZE=512
CONFIG_PRINTK=y
CONFIG_IDT_NUM_VECTORS=128
CONFIG_LEGACY_KERNEL=y

View file

@ -1 +0,0 @@
obj-y = nanokernel_footprint.o

View file

@ -1,134 +0,0 @@
/* nanokernel_footprint.c - nanokernel footprint */
/*
* Copyright (c) 2013-2014 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr.h>
#include <toolchain.h>
volatile int i = 0; /* counter used by background task */
#ifndef TEST_min
#include <misc/printk.h>
#include <stdio.h>
#define IRQ_LINE 11 /* just some random value w/o driver conflicts */
#define IRQ_PRIORITY 3
#define TEST_SOFT_INT 64
#ifdef TEST_max
#define FIBER_STACK_SIZE 1024
#else
#define FIBER_STACK_SIZE 512
#endif /* TEST_max */
#ifdef TEST_max
#define MESSAGE "Running maximal nanokernel configuration\n"
#else
#define MESSAGE "Running regular nanokernel configuration\n"
#endif /* TEST_max */
typedef void* (*pfunc) (void*);
/* stack used by fiber */
static char __stack pStack[FIBER_STACK_SIZE];
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,
/* 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
/* stacks */
(pfunc)k_stack_init,
(pfunc)k_stack_push,
(pfunc)k_stack_pop,
/* queues */
(pfunc)k_queue_init,
(pfunc)k_queue_append,
(pfunc)k_queue_prepend,
(pfunc)k_queue_append_list,
(pfunc)k_queue_merge_slist,
(pfunc)k_queue_get,
#endif
};
/**
*
* @brief Dummy ISR
*
* @return N/A
*/
void dummyIsr(void *unused)
{
ARG_UNUSED(unused);
}
/**
*
* @brief Trivial fiber
*
* @param message Message to be printed.
* @param arg1 Unused.
*
* @return N/A
*/
static void fiberEntry(int message, int arg1)
{
ARG_UNUSED(arg1);
#ifdef TEST_max
printf("%s", (char *)message);
#else
printk("%s", (char *)message);
#endif /* TEST_max */
}
#endif /* !TEST_min */
/**
*
* @brief Mainline for background task
*
* This routine simply increments a global counter.
* (Gdb can be used to observe the counter as it increases.)
*
* @return N/A
*/
void main(void)
{
#ifdef TEST_reg
IRQ_CONNECT(IRQ_LINE, IRQ_PRIORITY, dummyIsr, NULL, 0);
#endif
#ifndef TEST_min
/* start a trivial fiber */
task_fiber_start(pStack, FIBER_STACK_SIZE, fiberEntry, (int) MESSAGE,
(int) func_array, 10, 0);
#endif /* !TEST_min */
while (1) {
i++;
}
}

View file

@ -1,25 +0,0 @@
[footprint-min]
tags = legacy footprint
extra_args = TEST=min
platform_exclude = tinytile
build_only = true
[footprint-reg]
tags = legacy footprint
extra_args = TEST=reg
platform_exclude = tinytile
build_only = true
[footprint-max]
tags = legacy footprint
extra_args = TEST=max
platform_exclude = tinytile
build_only = true
[footprint-float]
tags = legacy footprint
extra_args = TEST=float
build_only = true
arch_whitelist = x86
platform_exclude = tinytile
filter = not CONFIG_CPU_MINUTEIA