mirror of https://github.com/rusefi/ChibiOS.git
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@330 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
d7443aaab6
commit
558007d1cf
|
@ -21,6 +21,15 @@
|
||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
|
static msg_t thread1(void *p) {
|
||||||
|
msg_t msg;
|
||||||
|
|
||||||
|
do {
|
||||||
|
chMsgRelease(msg = chMsgWait());
|
||||||
|
} while (msg);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
__attribute__((noinline))
|
__attribute__((noinline))
|
||||||
static unsigned int msg_loop_test(Thread *tp) {
|
static unsigned int msg_loop_test(Thread *tp) {
|
||||||
|
|
||||||
|
@ -28,12 +37,13 @@ static unsigned int msg_loop_test(Thread *tp) {
|
||||||
test_wait_tick();
|
test_wait_tick();
|
||||||
test_start_timer(1000);
|
test_start_timer(1000);
|
||||||
do {
|
do {
|
||||||
(void)chMsgSend(tp, 0);
|
(void)chMsgSend(tp, 1);
|
||||||
n++;
|
n++;
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
ChkIntSources();
|
ChkIntSources();
|
||||||
#endif
|
#endif
|
||||||
} while (!test_timer_done);
|
} while (!test_timer_done);
|
||||||
|
(void)chMsgSend(tp, 0);
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,13 +58,6 @@ static void bmk1_setup(void) {
|
||||||
static void bmk1_teardown(void) {
|
static void bmk1_teardown(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static msg_t thread1(void *p) {
|
|
||||||
|
|
||||||
while (!chThdShouldTerminate())
|
|
||||||
chMsgRelease(chMsgWait());
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void bmk1_execute(void) {
|
static void bmk1_execute(void) {
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
|
|
||||||
|
@ -93,7 +96,6 @@ static void bmk2_execute(void) {
|
||||||
threads[0] = chThdCreate(chThdGetPriority()+1, 0, wa[0], STKSIZE, thread1, 0);
|
threads[0] = chThdCreate(chThdGetPriority()+1, 0, wa[0], STKSIZE, thread1, 0);
|
||||||
n = msg_loop_test(threads[0]);
|
n = msg_loop_test(threads[0]);
|
||||||
chThdTerminate(threads[0]);
|
chThdTerminate(threads[0]);
|
||||||
chMsgSend(threads[0], 0);
|
|
||||||
test_wait_threads();
|
test_wait_threads();
|
||||||
test_print("--- Score : ");
|
test_print("--- Score : ");
|
||||||
test_printn(n);
|
test_printn(n);
|
||||||
|
@ -109,6 +111,11 @@ const struct testcase testbmk2 = {
|
||||||
bmk2_execute
|
bmk2_execute
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static msg_t thread2(void *p) {
|
||||||
|
|
||||||
|
return (msg_t)p;
|
||||||
|
}
|
||||||
|
|
||||||
static char *bmk3_gettest(void) {
|
static char *bmk3_gettest(void) {
|
||||||
|
|
||||||
return "Benchmark, context switch #3, 4 threads in ready list";
|
return "Benchmark, context switch #3, 4 threads in ready list";
|
||||||
|
@ -120,11 +127,6 @@ static void bmk3_setup(void) {
|
||||||
static void bmk3_teardown(void) {
|
static void bmk3_teardown(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static msg_t thread2(void *p) {
|
|
||||||
|
|
||||||
return (msg_t)p;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void bmk3_execute(void) {
|
static void bmk3_execute(void) {
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
|
|
||||||
|
@ -135,7 +137,6 @@ static void bmk3_execute(void) {
|
||||||
threads[4] = chThdCreate(chThdGetPriority()-5, 0, wa[4], STKSIZE, thread2, 0);
|
threads[4] = chThdCreate(chThdGetPriority()-5, 0, wa[4], STKSIZE, thread2, 0);
|
||||||
n = msg_loop_test(threads[0]);
|
n = msg_loop_test(threads[0]);
|
||||||
chThdTerminate(threads[0]);
|
chThdTerminate(threads[0]);
|
||||||
chMsgSend(threads[0], 0);
|
|
||||||
test_wait_threads();
|
test_wait_threads();
|
||||||
test_print("--- Score : ");
|
test_print("--- Score : ");
|
||||||
test_printn(n);
|
test_printn(n);
|
||||||
|
|
Loading…
Reference in New Issue