summaryrefslogtreecommitdiff
path: root/samples/microkernel/benchmark/app_kernel/src
diff options
context:
space:
mode:
Diffstat (limited to 'samples/microkernel/benchmark/app_kernel/src')
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/event_b.c110
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/fifo_b.c32
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/fifo_r.c8
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/mailbox_b.c38
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/mailbox_r.c39
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/master.c89
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/master.h28
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/memmap_b.c10
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/mempool_b.c12
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/mutex_b.c10
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/nop_b.c8
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/pipe_b.c169
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/pipe_r.c125
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/receiver.c10
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/receiver.h2
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/sema_b.c42
-rw-r--r--samples/microkernel/benchmark/app_kernel/src/sema_r.c42
17 files changed, 393 insertions, 381 deletions
diff --git a/samples/microkernel/benchmark/app_kernel/src/event_b.c b/samples/microkernel/benchmark/app_kernel/src/event_b.c
index 0c5c77f00..b78443997 100644
--- a/samples/microkernel/benchmark/app_kernel/src/event_b.c
+++ b/samples/microkernel/benchmark/app_kernel/src/event_b.c
@@ -66,7 +66,7 @@ int example_handler (int event);
*/
void event_test(void)
- {
+{
int nReturn;
int nCounter;
uint32_t et; /* elapsed time */
@@ -74,107 +74,107 @@ void event_test(void)
PRINT_STRING(dashline, output_file);
et = BENCH_START();
for (nCounter = 0; nCounter < NR_OF_EVENT_RUNS; nCounter++) {
- nReturn = task_event_send(TEST_EVENT);
+ nReturn = task_event_send(TEST_EVENT);
#ifdef EVENT_CHECK
- if (nReturn != RC_OK) {
- PRINT_STRING(EventSignalErr, output_file);
- return; /* error */
- }
+ if (nReturn != RC_OK) {
+ PRINT_STRING(EventSignalErr, output_file);
+ return; /* error */
+ }
#endif /* EVENT_CHECK */
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "Signal enabled event",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_EVENT_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_EVENT_RUNS));
et = BENCH_START();
for (nCounter = 0; nCounter < NR_OF_EVENT_RUNS; nCounter++) {
- nReturn = task_event_send(TEST_EVENT);
+ nReturn = task_event_send(TEST_EVENT);
#ifdef EVENT_CHECK
- if (nReturn != RC_OK) {
- PRINT_STRING(EventSignalErr, output_file);
- task_sleep(SLEEP_TIME);
- return; /* error */
- }
+ if (nReturn != RC_OK) {
+ PRINT_STRING(EventSignalErr, output_file);
+ task_sleep(SLEEP_TIME);
+ return; /* error */
+ }
#endif /* EVENT_CHECK */
- nReturn = task_event_recv(TEST_EVENT);
+ nReturn = task_event_recv(TEST_EVENT);
#ifdef EVENT_CHECK
- if (nReturn != RC_OK) {
- PRINT_STRING(EventTestErr, output_file);
- task_sleep(SLEEP_TIME);
- return; /* error */
- }
+ if (nReturn != RC_OK) {
+ PRINT_STRING(EventTestErr, output_file);
+ task_sleep(SLEEP_TIME);
+ return; /* error */
+ }
#endif /* EVENT_CHECK */
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "Signal event & Test event",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_EVENT_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_EVENT_RUNS));
et = BENCH_START();
for (nCounter = 0; nCounter < NR_OF_EVENT_RUNS; nCounter++) {
- nReturn = task_event_send(TEST_EVENT);
+ nReturn = task_event_send(TEST_EVENT);
#ifdef EVENT_CHECK
- if (nReturn != RC_OK) {
- PRINT_STRING(EventSignalErr, output_file);
- return; /* error */
- }
+ if (nReturn != RC_OK) {
+ PRINT_STRING(EventSignalErr, output_file);
+ return; /* error */
+ }
#endif /* EVENT_CHECK */
- nReturn = task_event_recv_wait(TEST_EVENT);
+ nReturn = task_event_recv_wait(TEST_EVENT);
#ifdef EVENT_CHECK
- if (nReturn != RC_OK) {
- PRINT_STRING(EventTestErr, output_file);
- return; /* error */
- }
+ if (nReturn != RC_OK) {
+ PRINT_STRING(EventTestErr, output_file);
+ return; /* error */
+ }
#endif /* EVENT_CHECK */
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "Signal event & TestW event",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_EVENT_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_EVENT_RUNS));
PRINT_STRING("| Signal event with installed handler"
- " |\n", output_file);
+ " |\n", output_file);
nReturn = task_event_set_handler (TEST_EVENT, example_handler);
if (nReturn != RC_OK) {
- PRINT_F(output_file, "-------- Error installing event handler.\n");
- task_sleep(SLEEP_TIME);
- return; /* error */
+ PRINT_F(output_file, "-------- Error installing event handler.\n");
+ task_sleep(SLEEP_TIME);
+ return; /* error */
}
for (nCounter = 0; nCounter < NR_OF_EVENT_RUNS; nCounter++) {
- nReturn = task_event_send(TEST_EVENT);
+ nReturn = task_event_send(TEST_EVENT);
#ifdef EVENT_CHECK
- if (nReturn != RC_OK) {
- PRINT_STRING(EventSignalErr, output_file);
- task_sleep(SLEEP_TIME);
- return; /* error */
- }
- if (nEventValue != TEST_EVENT + 1) {
- PRINT_STRING(EventHandlerErr, output_file);
- task_sleep(SLEEP_TIME);
- return; /* error */
- }
+ if (nReturn != RC_OK) {
+ PRINT_STRING(EventSignalErr, output_file);
+ task_sleep(SLEEP_TIME);
+ return; /* error */
+ }
+ if (nEventValue != TEST_EVENT + 1) {
+ PRINT_STRING(EventHandlerErr, output_file);
+ task_sleep(SLEEP_TIME);
+ return; /* error */
+ }
#endif /* EVENT_CHECK */
- nEventValue = 0;
+ nEventValue = 0;
}
nReturn = task_event_set_handler (TEST_EVENT, NULL);
if (nReturn != RC_OK) {
- PRINT_F(output_file, "Error removing event handler.\n");
- task_sleep(SLEEP_TIME);
- return; /* error */
+ PRINT_F(output_file, "Error removing event handler.\n");
+ task_sleep(SLEEP_TIME);
+ return; /* error */
}
PRINT_STRING("| Handler responds OK"
- " |\n",
- output_file);
+ " |\n",
+ output_file);
return; /* success */
- }
+}
/*******************************************************************************
@@ -190,10 +190,10 @@ void event_test(void)
*/
int example_handler (int event)
- {
+{
nEventValue = event + 1;
return 1;
- }
+}
#endif /* EVENT_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/fifo_b.c b/samples/microkernel/benchmark/app_kernel/src/fifo_b.c
index a133bbf53..57b2ebd5e 100644
--- a/samples/microkernel/benchmark/app_kernel/src/fifo_b.c
+++ b/samples/microkernel/benchmark/app_kernel/src/fifo_b.c
@@ -44,73 +44,73 @@
*/
void queue_test(void)
- {
+{
uint32_t et; /* elapsed time */
int i;
PRINT_STRING(dashline, output_file);
et = BENCH_START();
for (i = 0; i < NR_OF_FIFO_RUNS; i++) {
- task_fifo_put_wait(DEMOQX1, data_bench);
+ task_fifo_put_wait(DEMOQX1, data_bench);
}
et = TIME_STAMP_DELTA_GET(et);
PRINT_F(output_file, FORMAT, "enqueue 1 byte msg in FIFO",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_FIFO_RUNS; i++) {
- task_fifo_get_wait(DEMOQX1, data_bench);
+ task_fifo_get_wait(DEMOQX1, data_bench);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "dequeue 1 byte msg in FIFO",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_FIFO_RUNS; i++) {
- task_fifo_put_wait(DEMOQX4, data_bench);
+ task_fifo_put_wait(DEMOQX4, data_bench);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "enqueue 4 bytes msg in FIFO",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_FIFO_RUNS; i++) {
- task_fifo_get_wait(DEMOQX4, data_bench);
+ task_fifo_get_wait(DEMOQX4, data_bench);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "dequeue 4 bytes msg in FIFO",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
task_sem_give(STARTRCV);
et = BENCH_START();
for (i = 0; i < NR_OF_FIFO_RUNS; i++) {
- task_fifo_put_wait(DEMOQX1, data_bench);
+ task_fifo_put_wait(DEMOQX1, data_bench);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT,
- "enqueue 1 byte msg in FIFO to a waiting higher priority task",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
+ "enqueue 1 byte msg in FIFO to a waiting higher priority task",
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_FIFO_RUNS; i++) {
- task_fifo_put_wait(DEMOQX4, data_bench);
+ task_fifo_put_wait(DEMOQX4, data_bench);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT,
- "enqueue 4 bytes in FIFO to a waiting higher priority task",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
- }
+ "enqueue 4 bytes in FIFO to a waiting higher priority task",
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_FIFO_RUNS));
+}
#endif /* FIFO_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/fifo_r.c b/samples/microkernel/benchmark/app_kernel/src/fifo_r.c
index 7d3c4e6ad..185794740 100644
--- a/samples/microkernel/benchmark/app_kernel/src/fifo_r.c
+++ b/samples/microkernel/benchmark/app_kernel/src/fifo_r.c
@@ -46,16 +46,16 @@
*/
void dequtask(void)
- {
+{
int x, i;
for (i = 0; i < NR_OF_FIFO_RUNS; i++) {
- task_fifo_get_wait(DEMOQX1, &x);
+ task_fifo_get_wait(DEMOQX1, &x);
}
for (i = 0; i < NR_OF_FIFO_RUNS; i++) {
- task_fifo_get_wait(DEMOQX4, &x);
- }
+ task_fifo_get_wait(DEMOQX4, &x);
}
+}
#endif /* FIFO_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/mailbox_b.c b/samples/microkernel/benchmark/app_kernel/src/mailbox_b.c
index 867cd971c..1af847cae 100644
--- a/samples/microkernel/benchmark/app_kernel/src/mailbox_b.c
+++ b/samples/microkernel/benchmark/app_kernel/src/mailbox_b.c
@@ -100,7 +100,7 @@ void mailbox_put(uint32_t size, int count, uint32_t *time);
*/
void mailbox_test(void)
- {
+{
uint32_t putsize;
uint32_t puttime;
int putcount;
@@ -109,14 +109,14 @@ void mailbox_test(void)
PRINT_STRING(dashline, output_file);
PRINT_STRING("| "
- "M A I L B O X M E A S U R E M E N T S"
- " |\n", output_file);
+ "M A I L B O X M E A S U R E M E N T S"
+ " |\n", output_file);
PRINT_STRING(dashline, output_file);
PRINT_STRING("| Send mailbox message to waiting high "
- "priority task and wait |\n", output_file);
+ "priority task and wait |\n", output_file);
PRINT_F(output_file, "| repeat for %4d times and take the "
- "average |\n",
- NR_OF_MBOX_RUNS);
+ "average |\n",
+ NR_OF_MBOX_RUNS);
PRINT_STRING(dashline, output_file);
PRINT_HEADER();
PRINT_STRING(dashline, output_file);
@@ -131,14 +131,14 @@ void mailbox_test(void)
PRINT_ONE_RESULT();
EmptyMsgPutTime = puttime;
for (putsize = 8; putsize <= MESSAGE_SIZE; putsize <<= 1) {
- mailbox_put(putsize, putcount, &puttime);
- task_fifo_get_wait(MB_COMM, &getinfo); /* waiting for ack */
- PRINT_ONE_RESULT();
+ mailbox_put(putsize, putcount, &puttime);
+ task_fifo_get_wait(MB_COMM, &getinfo); /* waiting for ack */
+ PRINT_ONE_RESULT();
}
PRINT_STRING(dashline, output_file);
PRINT_OVERHEAD();
PRINT_XFER_RATE();
- }
+}
/*******************************************************************************
@@ -147,15 +147,15 @@ void mailbox_test(void)
*
* RETURNS: N/A
*
+ * @param size The size of the data chunk.
+ * @param count Number of data chunks.
+ * @param time The total time.
+ *
* \NOMANUAL
*/
-void mailbox_put(
- uint32_t size, /* the size of the data chunk */
- int count, /* number of data chunks */
- uint32_t *time /* the total time */
- )
- {
+void mailbox_put(uint32_t size, int count, uint32_t *time)
+{
int i;
unsigned int t;
@@ -163,15 +163,15 @@ void mailbox_put(
Message.tx_data = data_bench;
Message.size = size;
- /* first sync with the receiver */
+ /* first sync with the receiver */
task_sem_give(SEM0);
t = BENCH_START();
for (i = 0; i < count; i++) {
- task_mbox_put_wait(MAILB1, 1, &Message);
+ task_mbox_put_wait(MAILB1, 1, &Message);
}
t = TIME_STAMP_DELTA_GET(t);
*time = SYS_CLOCK_HW_CYCLES_TO_NS_AVG(t, count);
check_result();
- }
+}
#endif /* MAILBOX_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/mailbox_r.c b/samples/microkernel/benchmark/app_kernel/src/mailbox_r.c
index edf598a0d..3723d5676 100644
--- a/samples/microkernel/benchmark/app_kernel/src/mailbox_r.c
+++ b/samples/microkernel/benchmark/app_kernel/src/mailbox_r.c
@@ -56,7 +56,7 @@ int mailbox_get(kmbox_t mailbox,int size,int count,unsigned int* time);
*/
void mailrecvtask(void)
- {
+{
int getsize;
unsigned int gettime;
int getcount;
@@ -72,13 +72,13 @@ void mailrecvtask(void)
task_fifo_put_wait(MB_COMM, &getinfo); /* acknowledge to master */
for (getsize = 8; getsize <= MESSAGE_SIZE; getsize <<= 1) {
- mailbox_get(MAILB1, getsize, getcount, &gettime);
- getinfo.time = gettime;
- getinfo.size = getsize;
- getinfo.count = getcount;
- task_fifo_put_wait(MB_COMM, &getinfo); /* acknowledge to master */
- }
+ mailbox_get(MAILB1, getsize, getcount, &gettime);
+ getinfo.time = gettime;
+ getinfo.size = getsize;
+ getinfo.count = getcount;
+ task_fifo_put_wait(MB_COMM, &getinfo); /* acknowledge to master */
}
+}
/*******************************************************************************
@@ -87,16 +87,16 @@ void mailrecvtask(void)
*
* RETURNS: 0
*
+ * @param mailbox The mailbox to read data from.
+ * @param size Size of each data portion.
+ * @param count Number of data portions.
+ * @param time Resulting time.
+ *
* \NOMANUAL
*/
-int mailbox_get(
- kmbox_t mailbox, /* the mailbox to read data from */
- int size, /* size of each data portion */
- int count, /* number of data portions */
- unsigned int* time /* resulting time */
- )
- {
+int mailbox_get(kmbox_t mailbox, int size, int count, unsigned int* time)
+{
int i;
unsigned int t;
struct k_msg Message;
@@ -105,18 +105,19 @@ int mailbox_get(
Message.rx_data = data_recv;
Message.size = size;
- /* sync with the sender */
+ /* sync with the sender */
task_sem_take_wait(SEM0);
t = BENCH_START();
for (i = 0; i < count; i++) {
- task_mbox_get_wait(mailbox, &Message);
+ task_mbox_get_wait(mailbox, &Message);
}
t = TIME_STAMP_DELTA_GET(t);
*time = SYS_CLOCK_HW_CYCLES_TO_NS_AVG(t, count);
- if (bench_test_end() < 0)
- PRINT_OVERFLOW_ERROR();
- return 0;
+ if (bench_test_end() < 0) {
+ PRINT_OVERFLOW_ERROR();
}
+ return 0;
+}
#endif /* MAILBOX_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/master.c b/samples/microkernel/benchmark/app_kernel/src/master.c
index 3700ec70b..87ab14f3c 100644
--- a/samples/microkernel/benchmark/app_kernel/src/master.c
+++ b/samples/microkernel/benchmark/app_kernel/src/master.c
@@ -45,8 +45,7 @@ char Msg[MAX_MSG];
char data_bench[OCTET_TO_SIZEOFUNIT(MESSAGE_SIZE)];
#ifdef PIPE_BENCH
-kpipe_t TestPipes[] = {
-PIPE_NOBUFF, PIPE_SMALLBUFF, PIPE_BIGBUFF};
+kpipe_t TestPipes[] = {PIPE_NOBUFF, PIPE_SMALLBUFF, PIPE_BIGBUFF};
#endif
const char dashline[] =
"|--------------------------------------"
@@ -83,22 +82,22 @@ int kbhit(void)
*
* RETURNS: N/A
*
+ * @param continuously Run test till the user presses the key.
+ * @param autorun Expect user input.
+ *
* \NOMANUAL
*/
-void init_output(
- int *continuously, /* run test till the user presses the key */
- int *autorun /* expect user input */
- )
- {
+void init_output(int *continuously, int *autorun)
+{
ARG_UNUSED(continuously);
ARG_UNUSED(autorun);
- /*
- * send all printf and fprintf to console
- */
+ /*
+ * send all printf and fprintf to console
+ */
output_file = stdout;
- }
+}
/*******************************************************************************
*
@@ -110,8 +109,8 @@ void init_output(
*/
void output_close(void)
- {
- }
+{
+}
/* no need to wait for user key press when using console */
#define WAIT_FOR_USER() {}
@@ -128,7 +127,7 @@ void output_close(void)
/* see config.h to select or to unselect*/
void BenchTask(void)
- {
+{
int autorun = 0, continuously = 0;
init_output(&continuously, &autorun);
@@ -136,40 +135,40 @@ void BenchTask(void)
PRINT_STRING(newline, output_file);
do {
- PRINT_STRING(dashline, output_file);
- PRINT_STRING("| S I M P L E S E R V I C E "
- "M E A S U R E M E N T S | nsec |\n",
- output_file);
- PRINT_STRING(dashline, output_file);
- task_start(RECVTASK);
- call_test();
- queue_test();
- sema_test();
- mutex_test();
- memorymap_test();
- mempool_test();
- event_test();
- mailbox_test();
- pipe_test();
- PRINT_STRING("| END OF TESTS "
- " |\n",
- output_file);
- PRINT_STRING(dashline, output_file);
- PRINT_STRING("VXMICRO PROJECT EXECUTION SUCCESSFUL\n",output_file);
- }
- while (continuously && !kbhit());
+ PRINT_STRING(dashline, output_file);
+ PRINT_STRING("| S I M P L E S E R V I C E "
+ "M E A S U R E M E N T S | nsec |\n",
+ output_file);
+ PRINT_STRING(dashline, output_file);
+ task_start(RECVTASK);
+ call_test();
+ queue_test();
+ sema_test();
+ mutex_test();
+ memorymap_test();
+ mempool_test();
+ event_test();
+ mailbox_test();
+ pipe_test();
+ PRINT_STRING("| END OF TESTS "
+ " |\n",
+ output_file);
+ PRINT_STRING(dashline, output_file);
+ PRINT_STRING("VXMICRO PROJECT EXECUTION SUCCESSFUL\n",output_file);
+ } while (continuously && !kbhit());
WAIT_FOR_USER();
- /*
- * Make a 2 second delay. sys_clock_ticks_per_sec in this context is
- * a number of system times ticks in a second.
- */
- if (autorun)
- task_sleep(2 * sys_clock_ticks_per_sec);
+ /*
+ * Make a 2 second delay. sys_clock_ticks_per_sec in this context is
+ * a number of system times ticks in a second.
+ */
+ if (autorun) {
+ task_sleep(2 * sys_clock_ticks_per_sec);
+ }
output_close();
- }
+}
/*******************************************************************************
@@ -182,6 +181,6 @@ void BenchTask(void)
*/
void dummy_test(void)
- {
+{
return;
- }
+}
diff --git a/samples/microkernel/benchmark/app_kernel/src/master.h b/samples/microkernel/benchmark/app_kernel/src/master.h
index 33b2d3392..6adc1e1a2 100644
--- a/samples/microkernel/benchmark/app_kernel/src/master.h
+++ b/samples/microkernel/benchmark/app_kernel/src/master.h
@@ -148,33 +148,31 @@ extern void event_test(void);
* is defined in the main file
*/
-#define PRINT_F(stream, fmt, ...) \
- { \
+#define PRINT_F(stream, fmt, ...) \
+{ \
snprintf(sline, SLINE_LEN, fmt, ##__VA_ARGS__); \
- PRINT_STRING(sline, stream); \
- }
+ PRINT_STRING(sline, stream); \
+}
#define PRINT_OVERFLOW_ERROR() \
- PRINT_F(output_file, \
- __FILE__":%d Error: tick occured\n", __LINE__)
+ PRINT_F(output_file, __FILE__":%d Error: tick occured\n", __LINE__)
static inline uint32_t BENCH_START(void)
- {
+{
uint32_t et;
bench_test_start();
et = TIME_STAMP_DELTA_GET(0);
return et;
- }
+}
#define check_result() \
- { \
- if (bench_test_end() < 0) \
- { \
- PRINT_OVERFLOW_ERROR(); \
- return; /* error */ \
- } \
- }
+{ \
+ if (bench_test_end() < 0) { \
+ PRINT_OVERFLOW_ERROR(); \
+ return; /* error */ \
+ } \
+}
#endif /* _MASTER_H */
diff --git a/samples/microkernel/benchmark/app_kernel/src/memmap_b.c b/samples/microkernel/benchmark/app_kernel/src/memmap_b.c
index 03e72be19..06777cb61 100644
--- a/samples/microkernel/benchmark/app_kernel/src/memmap_b.c
+++ b/samples/microkernel/benchmark/app_kernel/src/memmap_b.c
@@ -46,7 +46,7 @@
*/
void memorymap_test(void)
- {
+{
uint32_t et; /* elapsed time */
int i;
void* p;
@@ -54,14 +54,14 @@ void memorymap_test(void)
PRINT_STRING(dashline, output_file);
et = BENCH_START();
for (i = 0; i < NR_OF_MAP_RUNS; i++) {
- task_mem_map_alloc_wait(MAP1, &p);
- task_mem_map_free(MAP1, &p);
+ task_mem_map_alloc_wait(MAP1, &p);
+ task_mem_map_free(MAP1, &p);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "average alloc and dealloc memory page",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, (2 * NR_OF_MAP_RUNS)));
- }
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, (2 * NR_OF_MAP_RUNS)));
+}
#endif /* MEMMAP_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/mempool_b.c b/samples/microkernel/benchmark/app_kernel/src/mempool_b.c
index 6130e3cdb..7401c1652 100644
--- a/samples/microkernel/benchmark/app_kernel/src/mempool_b.c
+++ b/samples/microkernel/benchmark/app_kernel/src/mempool_b.c
@@ -44,7 +44,7 @@
*/
void mempool_test(void)
- {
+{
uint32_t et; /* elapsed time */
int i;
struct k_block block;
@@ -52,15 +52,15 @@ void mempool_test(void)
PRINT_STRING(dashline, output_file);
et = BENCH_START();
for (i = 0; i < NR_OF_POOL_RUNS; i++) {
- task_mem_pool_alloc_wait(&block, DEMOPOOL, 16);
- task_mem_pool_free(&block);
+ task_mem_pool_alloc_wait(&block, DEMOPOOL, 16);
+ task_mem_pool_free(&block);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT,
- "average alloc and dealloc memory pool block",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, (2 * NR_OF_POOL_RUNS)));
- }
+ "average alloc and dealloc memory pool block",
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, (2 * NR_OF_POOL_RUNS)));
+}
#endif /* MEMPOOL_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/mutex_b.c b/samples/microkernel/benchmark/app_kernel/src/mutex_b.c
index 4b05baf76..07fcce479 100644
--- a/samples/microkernel/benchmark/app_kernel/src/mutex_b.c
+++ b/samples/microkernel/benchmark/app_kernel/src/mutex_b.c
@@ -44,21 +44,21 @@
*/
void mutex_test(void)
- {
+{
uint32_t et; /* elapsed time */
int i;
PRINT_STRING(dashline, output_file);
et = BENCH_START();
for (i = 0; i < NR_OF_MUTEX_RUNS; i++) {
- task_mutex_lock_wait(DEMO_MUTEX);
- task_mutex_unlock(DEMO_MUTEX);
+ task_mutex_lock_wait(DEMO_MUTEX);
+ task_mutex_unlock(DEMO_MUTEX);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "average lock and unlock mutex",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, (2 * NR_OF_MUTEX_RUNS)));
- }
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, (2 * NR_OF_MUTEX_RUNS)));
+}
#endif /* MUTEX_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/nop_b.c b/samples/microkernel/benchmark/app_kernel/src/nop_b.c
index 61e25b322..82c992a8b 100644
--- a/samples/microkernel/benchmark/app_kernel/src/nop_b.c
+++ b/samples/microkernel/benchmark/app_kernel/src/nop_b.c
@@ -48,19 +48,19 @@ extern void _task_nop(void);
*/
void call_test(void)
- {
+{
uint32_t et; /* Elapsed Time */
int i;
et = BENCH_START();
for (i = 0; i < NR_OF_NOP_RUNS; i++) {
- _task_nop();
+ _task_nop();
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "minimum VxMicro call time",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_NOP_RUNS));
- }
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_NOP_RUNS));
+}
#endif /* MICROKERNEL_CALL_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/pipe_b.c b/samples/microkernel/benchmark/app_kernel/src/pipe_b.c
index 9a71bdc52..dba6168c3 100644
--- a/samples/microkernel/benchmark/app_kernel/src/pipe_b.c
+++ b/samples/microkernel/benchmark/app_kernel/src/pipe_b.c
@@ -117,7 +117,7 @@ int pipeput(kpipe_t pipe, K_PIPE_OPTION
*/
void pipe_test(void)
- {
+{
uint32_t putsize;
int getsize;
uint32_t puttime[3];
@@ -130,76 +130,76 @@ void pipe_test(void)
task_sem_reset(SEM0);
task_sem_give(STARTRCV);
- /* action: */
+ /* action: */
- /* non-buffered operation, matching (ALL_N) */
+ /* non-buffered operation, matching (ALL_N) */
PRINT_STRING(dashline, output_file);
PRINT_STRING("| "
- "C H A N N E L M E A S U R E M E N T S"
- " |\n", output_file);
+ "C H A N N E L M E A S U R E M E N T S"
+ " |\n", output_file);
PRINT_STRING(dashline, output_file);
PRINT_STRING("| Send data into a pipe towards a "
- "receiving high priority task and wait |\n",
- output_file);
+ "receiving high priority task and wait |\n",
+ output_file);
PRINT_STRING(dashline, output_file);
PRINT_STRING("| "
- "matching sizes (_ALL_N)"
- " |\n", output_file);
+ "matching sizes (_ALL_N)"
+ " |\n", output_file);
PRINT_STRING(dashline, output_file);
PRINT_ALL_TO_N_HEADER_UNIT();
PRINT_STRING(dashline, output_file);
PRINT_STRING("| put | get | no buf | small buf| big buf |"
- " no buf | small buf| big buf |\n", output_file);
+ " no buf | small buf| big buf |\n", output_file);
PRINT_STRING(dashline, output_file);
for (putsize = 8; putsize <= MESSAGE_SIZE_PIPE; putsize <<= 1) {
- for (pipe = 0; pipe < 3; pipe++) {
- putcount = NR_OF_PIPE_RUNS;
- pipeput(TestPipes[pipe], _ALL_N, putsize, putcount,
- &puttime[pipe]);
+ for (pipe = 0; pipe < 3; pipe++) {
+ putcount = NR_OF_PIPE_RUNS;
+ pipeput(TestPipes[pipe], _ALL_N, putsize, putcount,
+ &puttime[pipe]);
- task_fifo_get_wait(CH_COMM, &getinfo); /* waiting for ack */
- }
- PRINT_ALL_TO_N();
+ task_fifo_get_wait(CH_COMM, &getinfo); /* waiting for ack */
+ }
+ PRINT_ALL_TO_N();
}
PRINT_STRING(dashline, output_file);
- /* Test with two different sender priorities */
+ /* Test with two different sender priorities */
for (prio = 0; prio < 2; prio++) {
- /* non-buffered operation, non-matching (1_TO_N) */
- if (prio == 0) {
- PRINT_STRING("| "
- "non-matching sizes (1_TO_N) to higher priority"
- " |\n", output_file);
- TaskPrio = task_priority_get();
- }
- if (prio == 1) {
- PRINT_STRING("| "
- "non-matching sizes (1_TO_N) to lower priority"
- " |\n", output_file);
- task_priority_set(task_id_get(), TaskPrio - 2);
- }
- PRINT_STRING(dashline, output_file);
- PRINT_1_TO_N_HEADER();
- PRINT_STRING("| put | get | no buf | small buf| big buf | "
- "no buf | small buf| big buf |\n", output_file);
- PRINT_STRING(dashline, output_file);
+ /* non-buffered operation, non-matching (1_TO_N) */
+ if (prio == 0) {
+ PRINT_STRING("| "
+ "non-matching sizes (1_TO_N) to higher priority"
+ " |\n", output_file);
+ TaskPrio = task_priority_get();
+ }
+ if (prio == 1) {
+ PRINT_STRING("| "
+ "non-matching sizes (1_TO_N) to lower priority"
+ " |\n", output_file);
+ task_priority_set(task_id_get(), TaskPrio - 2);
+ }
+ PRINT_STRING(dashline, output_file);
+ PRINT_1_TO_N_HEADER();
+ PRINT_STRING("| put | get | no buf | small buf| big buf | "
+ "no buf | small buf| big buf |\n", output_file);
+ PRINT_STRING(dashline, output_file);
- for (putsize = 8; putsize <= (MESSAGE_SIZE_PIPE); putsize <<= 1) {
- putcount = MESSAGE_SIZE_PIPE / putsize;
- for (pipe = 0; pipe < 3; pipe++) {
- pipeput(TestPipes[pipe], _1_TO_N, putsize,
- putcount, &puttime[pipe]);
- /* size*count == MESSAGE_SIZE_PIPE */
- task_fifo_get_wait(CH_COMM, &getinfo); /* waiting for ack */
- getsize = getinfo.size;
+ for (putsize = 8; putsize <= (MESSAGE_SIZE_PIPE); putsize <<= 1) {
+ putcount = MESSAGE_SIZE_PIPE / putsize;
+ for (pipe = 0; pipe < 3; pipe++) {
+ pipeput(TestPipes[pipe], _1_TO_N, putsize,
+ putcount, &puttime[pipe]);
+ /* size*count == MESSAGE_SIZE_PIPE */
+ task_fifo_get_wait(CH_COMM, &getinfo); /* waiting for ack */
+ getsize = getinfo.size;
+ }
+ PRINT_1_TO_N();
}
- PRINT_1_TO_N();
- }
- PRINT_STRING(dashline, output_file);
- task_priority_set(task_id_get(), TaskPrio);
- }
+ PRINT_STRING(dashline, output_file);
+ task_priority_set(task_id_get(), TaskPrio);
}
+}
/*******************************************************************************
@@ -208,60 +208,63 @@ void pipe_test(void)
*
* RETURNS: 0 on success, 1 on error
*
+ * @param pipe The pipe to be tested.
+ * @param option _ALL_TO_N or _1_TO_N.
+ * @param size Data chunk size.
+ * @param count Number of data chunks.
+ * @param time Total write time.
+ *
* \NOMANUAL
*/
-int pipeput(
- kpipe_t pipe, /* The pipe to be tested */
- K_PIPE_OPTION option, /* _ALL_TO_N or _1_TO_N */
- int size, /* data chunk size */
- int count, /* number of data chunks */
- uint32_t *time /* total write time */
- )
- {
+int pipeput(kpipe_t pipe, K_PIPE_OPTION option, int size, int count, uint32_t *time)
+{
int i;
unsigned int t;
int sizexferd_total = 0;
int size2xfer_total = size * count;
- /* first sync with the receiver */
+ /* first sync with the receiver */
task_sem_give(SEM0);
t = BENCH_START();
for (i = 0; _1_TO_N == option || (i < count); i++) {
- int sizexferd = 0;
- int size2xfer = min(size, size2xfer_total - sizexferd_total);
- int ret;
+ int sizexferd = 0;
+ int size2xfer = min(size, size2xfer_total - sizexferd_total);
+ int ret;
- ret = task_pipe_put_wait(pipe, data_bench, size2xfer,
- &sizexferd, option);
- if (RC_OK != ret)
- return 1;
- if (_ALL_N == option && sizexferd != size2xfer)
- return 1;
+ ret = task_pipe_put_wait(pipe, data_bench, size2xfer,
+ &sizexferd, option);
+ if (RC_OK != ret) {
+ return 1;
+ }
+ if (_ALL_N == option && sizexferd != size2xfer) {
+ return 1;
+ }
- sizexferd_total += sizexferd;
- if (size2xfer_total == sizexferd_total)
- break;
+ sizexferd_total += sizexferd;
+ if (size2xfer_total == sizexferd_total) {
+ break;
+ }
- if (size2xfer_total < sizexferd_total)
- return 1;
+ if (size2xfer_total < sizexferd_total) {
+ return 1;
+ }
}
t = TIME_STAMP_DELTA_GET(t);
*time = SYS_CLOCK_HW_CYCLES_TO_NS_AVG(t, count);
if (bench_test_end() < 0) {
- if (high_timer_overflow()) {
- PRINT_STRING("| Timer overflow. Results are invalid ",
- output_file);
- }
- else {
- PRINT_STRING("| Tick occured. Results may be inaccurate ",
- output_file);
- }
- PRINT_STRING(" |\n",
- output_file);
+ if (high_timer_overflow()) {
+ PRINT_STRING("| Timer overflow. Results are invalid ",
+ output_file);
+ }
+ else {
+ PRINT_STRING("| Tick occured. Results may be inaccurate ",
+ output_file);
+ }
+ PRINT_STRING(" |\n", output_file);
}
return 0;
- }
+}
#endif /* PIPE_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/pipe_r.c b/samples/microkernel/benchmark/app_kernel/src/pipe_r.c
index 1737d4301..7aa8322cd 100644
--- a/samples/microkernel/benchmark/app_kernel/src/pipe_r.c
+++ b/samples/microkernel/benchmark/app_kernel/src/pipe_r.c
@@ -39,7 +39,7 @@
* Function prototypes.
*/
int pipeget(kpipe_t pipe, K_PIPE_OPTION option,
- int size, int count, unsigned int* time);
+ int size, int count, unsigned int* time);
/*
* Function declarations.
@@ -57,7 +57,7 @@ int pipeget(kpipe_t pipe, K_PIPE_OPTION option,
*/
void piperecvtask(void)
- {
+{
int getsize;
unsigned int gettime;
int getcount;
@@ -65,37 +65,37 @@ void piperecvtask(void)
int prio;
GetInfo getinfo;
- /* matching (ALL_N) */
+ /* matching (ALL_N) */
for (getsize = 8; getsize <= MESSAGE_SIZE_PIPE; getsize <<= 1) {
- for (pipe = 0; pipe < 3; pipe++) {
- getcount = NR_OF_PIPE_RUNS;
- pipeget(TestPipes[pipe], _ALL_N, getsize,
- getcount, &gettime);
- getinfo.time = gettime;
- getinfo.size = getsize;
- getinfo.count = getcount;
- task_fifo_put_wait(CH_COMM, &getinfo); /* acknowledge to master */
- }
+ for (pipe = 0; pipe < 3; pipe++) {
+ getcount = NR_OF_PIPE_RUNS;
+ pipeget(TestPipes[pipe], _ALL_N, getsize,
+ getcount, &gettime);
+ getinfo.time = gettime;
+ getinfo.size = getsize;
+ getinfo.count = getcount;
+ task_fifo_put_wait(CH_COMM, &getinfo); /* acknowledge to master */
+ }
}
for (prio = 0; prio < 2; prio++) {
- /* non-matching (1_TO_N) */
- for (getsize = (MESSAGE_SIZE_PIPE); getsize >= 8; getsize >>= 1) {
- getcount = MESSAGE_SIZE_PIPE / getsize;
- for (pipe = 0; pipe < 3; pipe++) {
- /* size*count == MESSAGE_SIZE_PIPE */
- pipeget(TestPipes[pipe], _1_TO_N,
- getsize, getcount, &gettime);
- getinfo.time = gettime;
- getinfo.size = getsize;
- getinfo.count = getcount;
- task_fifo_put_wait(CH_COMM, &getinfo); /* acknowledge to master */
+ /* non-matching (1_TO_N) */
+ for (getsize = (MESSAGE_SIZE_PIPE); getsize >= 8; getsize >>= 1) {
+ getcount = MESSAGE_SIZE_PIPE / getsize;
+ for (pipe = 0; pipe < 3; pipe++) {
+ /* size*count == MESSAGE_SIZE_PIPE */
+ pipeget(TestPipes[pipe], _1_TO_N,
+ getsize, getcount, &gettime);
+ getinfo.time = gettime;
+ getinfo.size = getsize;
+ getinfo.count = getcount;
+ task_fifo_put_wait(CH_COMM, &getinfo); /* acknowledge to master */
+ }
}
- }
}
- }
+}
/*******************************************************************************
@@ -104,61 +104,66 @@ void piperecvtask(void)
*
* RETURNS: 0 on success, 1 on error
*
+ * @param pipe Pipe to read data from.
+ * @param option _ALL_TO_N or _1_TO_N.
+ * @param size Data chunk size.
+ * @param count Number of data chunks.
+ * @param time Total write time.
+ *
* \NOMANUAL
*/
-int pipeget(
- kpipe_t pipe, /* pipe to read data from */
- K_PIPE_OPTION option, /* _ALL_TO_N or _1_TO_N */
- int size, /* data chunk size */
- int count, /* number of data chunks */
- unsigned int* time /* total write time */
- )
- {
+int pipeget(kpipe_t pipe, K_PIPE_OPTION option, int size, int count,
+ unsigned int* time)
+{
int i;
unsigned int t;
int sizexferd_total = 0;
int size2xfer_total = size * count;
- /* sync with the sender */
+ /* sync with the sender */
task_sem_take_wait(SEM0);
t = BENCH_START();
for (i = 0; _1_TO_N == option || (i < count); i++) {
- int sizexferd = 0;
- int size2xfer = min(size, size2xfer_total - sizexferd_total);
- int ret;
-
- ret = task_pipe_get_wait(pipe, data_recv, size2xfer,
- &sizexferd, option);
- if (RC_OK != ret)
- return 1;
+ int sizexferd = 0;
+ int size2xfer = min(size, size2xfer_total - sizexferd_total);
+ int ret;
+
+ ret = task_pipe_get_wait(pipe, data_recv, size2xfer,
+ &sizexferd, option);
+ if (RC_OK != ret) {
+ return 1;
+ }
- if (_ALL_N == option && sizexferd != size2xfer)
- return 1;
+ if (_ALL_N == option && sizexferd != size2xfer) {
+ return 1;
+ }
- sizexferd_total += sizexferd;
- if (size2xfer_total == sizexferd_total)
- break;
+ sizexferd_total += sizexferd;
+ if (size2xfer_total == sizexferd_total) {
+ break;
+ }
- if (size2xfer_total < sizexferd_total)
- return 1;
+ if (size2xfer_total < sizexferd_total) {
+ return 1;
+ }
}
t = TIME_STAMP_DELTA_GET(t);
*time = SYS_CLOCK_HW_CYCLES_TO_NS_AVG(t, count);
if (bench_test_end() < 0) {
- if (high_timer_overflow()) {
- PRINT_STRING("| Timer overflow. Results are invalid ",
- output_file);
- }
- else {
- PRINT_STRING("| Tick occured. Results may be inaccurate ",
- output_file);
- }
- PRINT_STRING(" |\n",
- output_file);
+ if (high_timer_overflow()) {
+ PRINT_STRING("| Timer overflow. Results are invalid ",
+ output_file);
+ }
+ else {
+ PRINT_STRING("| Tick occured. Results may be inaccurate ",
+ output_file);
+ }
+ PRINT_STRING(" |\n",
+ output_file);
}
return 0;
- }
+}
#endif /* PIPE_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/receiver.c b/samples/microkernel/benchmark/app_kernel/src/receiver.c
index 8f543d9d6..1e51fe9f1 100644
--- a/samples/microkernel/benchmark/app_kernel/src/receiver.c
+++ b/samples/microkernel/benchmark/app_kernel/src/receiver.c
@@ -41,9 +41,7 @@
#include "receiver.h"
-char data_recv[OCTET_TO_SIZEOFUNIT(MESSAGE_SIZE)] = {
- 0
- };
+char data_recv[OCTET_TO_SIZEOFUNIT(MESSAGE_SIZE)] = { 0 };
void dequtask(void);
void waittask(void);
@@ -60,8 +58,8 @@ void piperecvtask(void);
*/
void recvtask(void)
- {
- /* order must be compatible with master.c ! */
+{
+ /* order must be compatible with master.c ! */
#ifdef FIFO_BENCH
task_sem_take_wait(STARTRCV);
dequtask();
@@ -78,4 +76,4 @@ void recvtask(void)
task_sem_take_wait(STARTRCV);
piperecvtask();
#endif
- }
+}
diff --git a/samples/microkernel/benchmark/app_kernel/src/receiver.h b/samples/microkernel/benchmark/app_kernel/src/receiver.h
index b1da20f7e..c025692c3 100644
--- a/samples/microkernel/benchmark/app_kernel/src/receiver.h
+++ b/samples/microkernel/benchmark/app_kernel/src/receiver.h
@@ -42,7 +42,7 @@ typedef struct {
int count;
unsigned int time;
int size;
- } GetInfo;
+} GetInfo;
/* global data */
extern char data_recv[OCTET_TO_SIZEOFUNIT(MESSAGE_SIZE)];
diff --git a/samples/microkernel/benchmark/app_kernel/src/sema_b.c b/samples/microkernel/benchmark/app_kernel/src/sema_b.c
index e63fd7592..94c085aa7 100644
--- a/samples/microkernel/benchmark/app_kernel/src/sema_b.c
+++ b/samples/microkernel/benchmark/app_kernel/src/sema_b.c
@@ -45,104 +45,104 @@
*/
void sema_test(void)
- {
+{
uint32_t et; /* elapsed Time */
int i;
PRINT_STRING(dashline, output_file);
et = BENCH_START();
for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
- task_sem_give(SEM0);
+ task_sem_give(SEM0);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "signal semaphore",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
task_sem_reset(SEM1);
task_sem_give(STARTRCV);
et = BENCH_START();
for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
- task_sem_give(SEM1);
+ task_sem_give(SEM1);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "signal to waiting high pri task",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
- task_sem_give(SEM1);
+ task_sem_give(SEM1);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT,
- "signal to waiting high pri task, with timeout",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
+ "signal to waiting high pri task, with timeout",
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
- task_sem_give(SEM2);
+ task_sem_give(SEM2);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "signal to waitm (2)",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
- task_sem_give(SEM2);
+ task_sem_give(SEM2);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "signal to waitm (2), with timeout",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
- task_sem_give(SEM3);
+ task_sem_give(SEM3);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "signal to waitm (3)",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
- task_sem_give(SEM3);
+ task_sem_give(SEM3);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "signal to waitm (3), with timeout",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
- task_sem_give(SEM4);
+ task_sem_give(SEM4);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "signal to waitm (4)",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
et = BENCH_START();
for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
- task_sem_give(SEM4);
+ task_sem_give(SEM4);
}
et = TIME_STAMP_DELTA_GET(et);
check_result();
PRINT_F(output_file, FORMAT, "signal to waitm (4), with timeout",
- SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
- }
+ SYS_CLOCK_HW_CYCLES_TO_NS_AVG(et, NR_OF_SEMA_RUNS));
+}
#endif /* SEMA_BENCH */
diff --git a/samples/microkernel/benchmark/app_kernel/src/sema_r.c b/samples/microkernel/benchmark/app_kernel/src/sema_r.c
index c08d27779..5b02dc263 100644
--- a/samples/microkernel/benchmark/app_kernel/src/sema_r.c
+++ b/samples/microkernel/benchmark/app_kernel/src/sema_r.c
@@ -47,7 +47,7 @@
*/
void waittask(void)
- {
+{
int i;
ksem_t slist[5];
@@ -58,27 +58,35 @@ void waittask(void)
slist[3] = ENDLIST;
slist[4] = ENDLIST;
- for (i = 0; i < NR_OF_SEMA_RUNS; i++)
- task_sem_take_wait(SEM1);
- for (i = 0; i < NR_OF_SEMA_RUNS; i++)
- task_sem_take_wait_timeout(SEM1, SEMA_WAIT_TIME);
+ for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
+ task_sem_take_wait(SEM1);
+ }
+ for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
+ task_sem_take_wait_timeout(SEM1, SEMA_WAIT_TIME);
+ }
- for (i = 0; i < NR_OF_SEMA_RUNS; i++)
- task_sem_group_take_wait(slist);
- for (i = 0; i < NR_OF_SEMA_RUNS; i++)
- task_sem_group_take_wait_timeout(slist, SEMA_WAIT_TIME);
+ for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
+ task_sem_group_take_wait(slist);
+ }
+ for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
+ task_sem_group_take_wait_timeout(slist, SEMA_WAIT_TIME);
+ }
slist[2] = SEM3;
- for (i = 0; i < NR_OF_SEMA_RUNS; i++)
- task_sem_group_take_wait(slist);
- for (i = 0; i < NR_OF_SEMA_RUNS; i++)
- task_sem_group_take_wait_timeout(slist, SEMA_WAIT_TIME);
+ for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
+ task_sem_group_take_wait(slist);
+ }
+ for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
+ task_sem_group_take_wait_timeout(slist, SEMA_WAIT_TIME);
+ }
slist[3] = SEM4;
- for (i = 0; i < NR_OF_SEMA_RUNS; i++)
- task_sem_group_take_wait(slist);
- for (i = 0; i < NR_OF_SEMA_RUNS; i++)
- task_sem_group_take_wait_timeout(slist, SEMA_WAIT_TIME);
+ for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
+ task_sem_group_take_wait(slist);
+ }
+ for (i = 0; i < NR_OF_SEMA_RUNS; i++) {
+ task_sem_group_take_wait_timeout(slist, SEMA_WAIT_TIME);
}
+}
#endif /* SEMA_BENCH */