aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-02-28 09:39:02 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-02-28 09:39:02 +0000
commiteb75c053eb46cbeb4ad9c0b7b179ba1acb20eba4 (patch)
tree94c9d04cbf65ba20f6734f4d9ecd2a315acaf4a9
parentc6a781e7ae3e8f8dffca1aa5917cd99f47741cbf (diff)
downloadChibiOS-eb75c053eb46cbeb4ad9c0b7b179ba1acb20eba4.tar.gz
ChibiOS-eb75c053eb46cbeb4ad9c0b7b179ba1acb20eba4.tar.bz2
ChibiOS-eb75c053eb46cbeb4ad9c0b7b179ba1acb20eba4.zip
Added new benchmarks about semaphores and mutexes to the test suite.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@804 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--docs/src/stacks.dox7
-rw-r--r--readme.txt2
-rw-r--r--test/testbmk.c89
-rw-r--r--todo.txt3
4 files changed, 96 insertions, 5 deletions
diff --git a/docs/src/stacks.dox b/docs/src/stacks.dox
index e824ea04a..a27c2e1b9 100644
--- a/docs/src/stacks.dox
+++ b/docs/src/stacks.dox
@@ -33,7 +33,8 @@
* stack. This is an important feature in a multithreaded environment,
* without a dedicated interrupt stack each thread has to reserve
* enough space, for interrupts servicing, within its own stack. This space,
- * multiplied by the total threads number, can be a significant RAM waste.
+ * multiplied by the total threads number, can amount to a significant RAM
+ * overhead.
* - <b>Thread Stack</b>, each thread has a dedicated stack for its own
* execution and context switch.
* - <b>Other Stacks</b>, some architectures (ARM) can have other stacks but
@@ -46,7 +47,7 @@
* Assign too much space to a stack wastes RAM, assign too little space
* leads to crashes or, worst scenario, hard to track instability.
*
- * <h2>Assign the correct size</h2>
+ * <h2>Assigning the correct size</h2>
* You may try to examine the asm listings in order to calculate the exact
* stack requirements but this requires much time, experience and patience.<br>
* An alternative way is to use an interactive method. Follow this procedure
@@ -78,7 +79,7 @@
* .
* <h2>Final Notes</h2>
* Some useful info:
- * - Stack overflows are the most common source of problems during development,
+ * - Stack overflows are the most common problems source during development,
* when in trouble with crashes or anomalous behaviors always first verify
* stack sizes.
* - The required stack size can, and very often does change when changing
diff --git a/readme.txt b/readme.txt
index 4ab964c0c..f716b9422 100644
--- a/readme.txt
+++ b/readme.txt
@@ -102,7 +102,7 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
implemented on all ports.
- Improvements to the test suite, added a new level of indirection that allows
to make tests depend on the configuration options without have to put #ifs
- into the test main module.
+ into the test main module. New benchmarks about semaphores and mutexes.
*** 1.1.0unstable ***
- FIX: Modified the default value for the STM32 HSI setup it was 1, it should
diff --git a/test/testbmk.c b/test/testbmk.c
index c3a69a5b2..10a4ea439 100644
--- a/test/testbmk.c
+++ b/test/testbmk.c
@@ -22,6 +22,7 @@
#include "test.h"
static Semaphore sem1;
+static Mutex mtx1;
static msg_t thread1(void *p) {
msg_t msg;
@@ -328,6 +329,90 @@ const struct testcase testbmk8 = {
bmk8_execute
};
+static char *bmk9_gettest(void) {
+
+ return "Benchmark, semaphores wait/signal";
+}
+
+static void bmk9_setup(void) {
+
+ chSemInit(&sem1, 1);
+}
+
+static void bmk9_execute(void) {
+ uint32_t n = 0;
+
+ test_wait_tick();
+ test_start_timer(1000);
+ do {
+ chSemWait(&sem1);
+ chSemSignal(&sem1);
+ chSemWait(&sem1);
+ chSemSignal(&sem1);
+ chSemWait(&sem1);
+ chSemSignal(&sem1);
+ chSemWait(&sem1);
+ chSemSignal(&sem1);
+ n++;
+#if defined(WIN32)
+ ChkIntSources();
+#endif
+ } while (!test_timer_done);
+ test_print("--- Score : ");
+ test_printn(n * 4);
+ test_println(" wait+signal/S");
+}
+
+const struct testcase testbmk9 = {
+ bmk9_gettest,
+ bmk9_setup,
+ NULL,
+ bmk9_execute
+};
+
+#if CH_USE_MUTEXES
+static char *bmk10_gettest(void) {
+
+ return "Benchmark, mutexes lock/unlock";
+}
+
+static void bmk10_setup(void) {
+
+ chMtxInit(&mtx1);
+}
+
+static void bmk10_execute(void) {
+ uint32_t n = 0;
+
+ test_wait_tick();
+ test_start_timer(1000);
+ do {
+ chMtxLock(&mtx1);
+ chMtxUnlock();
+ chMtxLock(&mtx1);
+ chMtxUnlock();
+ chMtxLock(&mtx1);
+ chMtxUnlock();
+ chMtxLock(&mtx1);
+ chMtxUnlock();
+ n++;
+#if defined(WIN32)
+ ChkIntSources();
+#endif
+ } while (!test_timer_done);
+ test_print("--- Score : ");
+ test_printn(n * 4);
+ test_println(" lock+unlock/S");
+}
+
+const struct testcase testbmk10 = {
+ bmk10_gettest,
+ bmk10_setup,
+ NULL,
+ bmk10_execute
+};
+#endif
+
/*
* Test sequence for benchmarks pattern.
*/
@@ -341,6 +426,10 @@ const struct testcase *patternbmk[] = {
&testbmk6,
&testbmk7,
&testbmk8,
+ &testbmk9,
+#if CH_USE_MUTEXES
+ &testbmk10,
+#endif
#endif
NULL
};
diff --git a/todo.txt b/todo.txt
index 4bb9af76d..42de67a75 100644
--- a/todo.txt
+++ b/todo.txt
@@ -21,8 +21,9 @@ After 1.0.0:
* Idle loop hook macro.
* Switch the configuration options to TRUE/FALSE rather than def/undef.
* Remove port_puts() from all the ports.
-- Stack sizes article into the documentation.
+* Stack sizes article into the documentation.
- Find out and document main stack settings in MSP430 and AVR runtimes.
+- Logo...
After 1.2.0:
X Abstract I/O channels rather than just serial ports.