From 4507047a830c080ebaf43526a043657a6580d088 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 6 Jul 2008 08:45:08 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@336 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- readme.txt | 1 + test/test.c | 1 + test/testbmk.c | 49 +++++++++++++++++++++++++++++++++++++++++++------ test/testbmk.h | 3 ++- 4 files changed, 47 insertions(+), 7 deletions(-) diff --git a/readme.txt b/readme.txt index 59428015d..4f5e701cb 100644 --- a/readme.txt +++ b/readme.txt @@ -82,6 +82,7 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process, to the chThdCreate(). - OPT: Improvements to the test framework, now a virtual timer is used instead of software loops into the bechmarks in order to have more stable results. +- New benchmark added to the test suite. - Added the C++ wrapper entries to the documentation. - Fixed the documentation entry for the chThdCreate() API. diff --git a/test/test.c b/test/test.c index 5f78c8526..3f2cc9514 100644 --- a/test/test.c +++ b/test/test.c @@ -43,6 +43,7 @@ static const struct testcase *tests[] = { &testbmk3, &testbmk4, &testbmk5, + &testbmk6, NULL }; diff --git a/test/testbmk.c b/test/testbmk.c index a75ccddc2..392297782 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -191,7 +191,7 @@ const struct testcase testbmk4 = { static char *bmk5_gettest(void) { - return "Benchmark, I/O Queues throughput"; + return "Benchmark, threads creation/termination, optimal"; } static void bmk5_setup(void) { @@ -201,6 +201,43 @@ static void bmk5_teardown(void) { } static void bmk5_execute(void) { + + uint32_t n = 0; + void *wap = wa[0]; + tprio_t prio = chThdGetPriority() + 1; + test_wait_tick(); + test_start_timer(1000); + do { + chThdCreateFast(prio, wap, STKSIZE, thread2); + n++; +#if defined(WIN32) + ChkIntSources(); +#endif + } while (!test_timer_done); + test_print("--- Score : "); + test_printn(n); + test_println(" threads/S"); +} + +const struct testcase testbmk5 = { + bmk5_gettest, + bmk5_setup, + bmk5_teardown, + bmk5_execute +}; + +static char *bmk6_gettest(void) { + + return "Benchmark, I/O Queues throughput"; +} + +static void bmk6_setup(void) { +} + +static void bmk6_teardown(void) { +} + +static void bmk6_execute(void) { static uint8_t ib[16]; static Queue iq; @@ -227,9 +264,9 @@ static void bmk5_execute(void) { test_println(" bytes/S"); } -const struct testcase testbmk5 = { - bmk5_gettest, - bmk5_setup, - bmk5_teardown, - bmk5_execute +const struct testcase testbmk6 = { + bmk6_gettest, + bmk6_setup, + bmk6_teardown, + bmk6_execute }; diff --git a/test/testbmk.h b/test/testbmk.h index 346e4c842..e52abee28 100644 --- a/test/testbmk.h +++ b/test/testbmk.h @@ -20,6 +20,7 @@ #ifndef _TESTBMK_H_ #define _TESTBMK_H_ -extern const struct testcase testbmk1, testbmk2, testbmk3, testbmk4, testbmk5; +extern const struct testcase testbmk1, testbmk2, testbmk3, + testbmk4, testbmk5, testbmk6; #endif /* _TESTBMK_H_ */