From e35d406ad6b59984f63a70a8df0e56d665557327 Mon Sep 17 00:00:00 2001 From: asterix Date: Tue, 11 May 2010 13:59:20 +0000 Subject: [PATCH] Add benchmark modules. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3652 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/benchmark/kernel_footprint.c | 87 +++++++++++++++++++++++++++++ bertos/benchmark/kernel_footprint.h | 46 +++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 bertos/benchmark/kernel_footprint.c create mode 100644 bertos/benchmark/kernel_footprint.h diff --git a/bertos/benchmark/kernel_footprint.c b/bertos/benchmark/kernel_footprint.c new file mode 100644 index 00000000..111b7910 --- /dev/null +++ b/bertos/benchmark/kernel_footprint.c @@ -0,0 +1,87 @@ +/** + * \file + * + * + * \author Luca Ottaviano + * \author Andrea Righi + * \author Daniele Basile + * + * \brief Kernel footprint benchmark. + */ + +#include "kernel_footprint.h" + +#include + +#include +#include +#include + +MsgPort in_port; + +static void init(void) +{ + IRQ_ENABLE; + proc_init(); +} + +static PROC_DEFINE_STACK(proc1_stack, KERN_MINSTACKSIZE); + +static NORETURN void proc1_main(void) +{ + int i; + for(;;) + { + i++; + } +} + +void kernel_footprint(void) +{ + init(); + + // generate code for process + struct Process *p = proc_new(proc1_main, 0, sizeof(proc1_stack), proc1_stack); + proc_setPri(p, 5); + proc_yield(); + + // generate code for msg + Msg msg; + msg_initPort(&in_port, event_createSignal(p, SIG_USER1)); + msg_put(&in_port, &msg); + msg_peek(&in_port); + Msg *msg_re = msg_get(&in_port); + msg_reply(msg_re); + + // generate code for signals + sig_send(p, SIG_USER0); + sig_wait(SIG_USER0); +} diff --git a/bertos/benchmark/kernel_footprint.h b/bertos/benchmark/kernel_footprint.h new file mode 100644 index 00000000..64a33e40 --- /dev/null +++ b/bertos/benchmark/kernel_footprint.h @@ -0,0 +1,46 @@ +/** + * \file + * + * + * \author Daniele Basile + * + * \brief Kernel footprint benchmark. + * + * $WIZ$ module_name = "kernel_footprint" + * $WIZ$ module_depends = "kfile", "kern", "signal", "msg", "event" + */ + +#ifndef BENCHMARK_KERNEL_FOOTPRINT_H +#define BENCHMARK_KERNEL_FOOTPRINT_H + +void kernel_footprint(void); + +#endif /* BENCHMARK_KERNEL_FOOTPRINT_H */ -- 2.25.1