From 7433c0200be24ba10a441a146d2d313a4acb27ec Mon Sep 17 00:00:00 2001 From: arighi Date: Thu, 13 May 2010 16:35:43 +0000 Subject: [PATCH] benchmark: add semaphore code to the kernel_footprint benchmark. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3693 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/benchmark/kernel_footprint.c | 35 ++++++++++++++++++----------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/bertos/benchmark/kernel_footprint.c b/bertos/benchmark/kernel_footprint.c index 111b7910..b3cd0458 100644 --- a/bertos/benchmark/kernel_footprint.c +++ b/bertos/benchmark/kernel_footprint.c @@ -44,6 +44,7 @@ #include #include #include +#include MsgPort in_port; @@ -66,22 +67,30 @@ static NORETURN void proc1_main(void) void kernel_footprint(void) { - init(); + init(); // generate code for process - struct Process *p = proc_new(proc1_main, 0, sizeof(proc1_stack), proc1_stack); - proc_setPri(p, 5); - proc_yield(); + 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); + 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); + // generate code for signals + sig_send(p, SIG_USER0); + + // generate code for msg + Semaphore sem; + sem_init(&sem); + sem_obtain(&sem); + sem_release(&sem); + + sig_wait(SIG_USER0); } -- 2.25.1