17#include <rusefi/true_false.h>
18#include "efifeatures.h"
75 chMsgRelease(tp, msg);
83static unsigned int msg_loop_test(Thread *tp) {
89 (void)chMsgSend(tp, 1);
95 (void)chMsgSend(tp, 0);
111 threads[0] = chThdCreateStatic(
wa[0], WA_SIZE, chThdGetPriority()-1,
thread1, NULL);
122 "Benchmark, messages #1",
140 threads[0] = chThdCreateStatic(
wa[0], WA_SIZE, chThdGetPriority()+1,
thread1, NULL);
151 "Benchmark, messages #2",
175 threads[0] = chThdCreateStatic(
wa[0], WA_SIZE, chThdGetPriority()+1,
thread1, NULL);
176 threads[1] = chThdCreateStatic(
wa[1], WA_SIZE, chThdGetPriority()-2,
thread2, NULL);
177 threads[2] = chThdCreateStatic(
wa[2], WA_SIZE, chThdGetPriority()-3,
thread2, NULL);
178 threads[3] = chThdCreateStatic(
wa[3], WA_SIZE, chThdGetPriority()-4,
thread2, NULL);
179 threads[4] = chThdCreateStatic(
wa[4], WA_SIZE, chThdGetPriority()-5,
thread2, NULL);
190 "Benchmark, messages #3",
208 Thread *self = chThdSelf();
213 chSchGoSleepS(THD_STATE_SUSPENDED);
214 msg = self->p_u.rdymsg;
215 }
while (msg == RDY_OK);
224 tp =
threads[0] = chThdCreateStatic(
wa[0], WA_SIZE, chThdGetPriority()+1,
thread4, NULL);
230 chSchWakeupS(tp, RDY_OK);
231 chSchWakeupS(tp, RDY_OK);
232 chSchWakeupS(tp, RDY_OK);
233 chSchWakeupS(tp, RDY_OK);
236#if defined(SIMULATOR)
241 chSchWakeupS(tp, RDY_TIMEOUT);
251 "Benchmark, context switch",
272 tprio_t prio = chThdGetPriority() - 1;
276 chThdWait(chThdCreateStatic(wap, WA_SIZE, prio,
thread2, NULL));
278#if defined(SIMULATOR)
288 "Benchmark, threads, full cycle",
311 tprio_t prio = chThdGetPriority() + 1;
315 chThdCreateStatic(wap, WA_SIZE, prio,
thread2, NULL);
317#if defined(SIMULATOR)
327 "Benchmark, threads, create only",
347 while (!chThdShouldTerminate())
360 threads[0] = chThdCreateStatic(
wa[0], WA_SIZE, chThdGetPriority()+5,
thread3, NULL);
361 threads[1] = chThdCreateStatic(
wa[1], WA_SIZE, chThdGetPriority()+4,
thread3, NULL);
362 threads[2] = chThdCreateStatic(
wa[2], WA_SIZE, chThdGetPriority()+3,
thread3, NULL);
363 threads[3] = chThdCreateStatic(
wa[3], WA_SIZE, chThdGetPriority()+2,
thread3, NULL);
364 threads[4] = chThdCreateStatic(
wa[4], WA_SIZE, chThdGetPriority()+1,
thread3, NULL);
370 chSemReset(&
sem1, 0);
372#if defined(SIMULATOR)
377 chSemReset(&
sem1, 0);
388 "Benchmark, mass reschedule, 5 threads",
411 (*(uint32_t *)p) += 4;
412#if defined(SIMULATOR)
415 }
while(!chThdShouldTerminate());
425 threads[0] = chThdCreateStatic(
wa[0], WA_SIZE, chThdGetPriority()-1,
thread8, (
void *)&n);
426 threads[1] = chThdCreateStatic(
wa[1], WA_SIZE, chThdGetPriority()-1,
thread8, (
void *)&n);
427 threads[2] = chThdCreateStatic(
wa[2], WA_SIZE, chThdGetPriority()-1,
thread8, (
void *)&n);
428 threads[3] = chThdCreateStatic(
wa[3], WA_SIZE, chThdGetPriority()-1,
thread8, (
void *)&n);
429 threads[4] = chThdCreateStatic(
wa[4], WA_SIZE, chThdGetPriority()-1,
thread8, (
void *)&n);
431 chThdSleepSeconds(1);
441 "Benchmark, round robin context switching",
460 static uint8_t ib[16];
461 static InputQueue iq;
463 chIQInit(&iq, ib,
sizeof(ib), NULL, NULL);
479#if defined(SIMULATOR)
489 "Benchmark, I/O Queues throughput",
508 static VirtualTimer vt1, vt2;
515 chVTSetI(&vt1, 1,
tmo, NULL);
516 chVTSetI(&vt2, 10000,
tmo, NULL);
521#if defined(SIMULATOR)
531 "Benchmark, virtual timers set/reset",
568#if defined(SIMULATOR)
578 "Benchmark, semaphores wait/signal",
616#if defined(SIMULATOR)
626 "Benchmark, mutexes lock/unlock",
644 PORT_IDLE_THREAD_STACK_SIZE +
645 (
sizeof(Thread) +
sizeof(
struct intctx) +
646 sizeof(
struct extctx) +
647 PORT_INT_REQUIRED_STACK) * 2);
691 "Benchmark, RAM footprint",
701#if !TEST_NO_BENCHMARKS
typedef __attribute__
Ignition Mode.
void test_wait_threads(void)
Waits for the completion of all the test-spawned threads.
void test_printn(uint32_t n)
Prints a decimal unsigned number.
thread_t * threads[MAX_THREADS]
void test_terminate_threads(void)
Sets a termination request in all the test-spawned threads.
systime_t test_wait_tick(void)
Delays execution until next system time tick.
void test_start_timer(unsigned ms)
Starts the test timer.
void test_print(const char *msgp)
Prints a line without final end-of-line.
bool test_timer_done
Set to TRUE when the test timer reaches its deadline.
void test_println(const char *msgp)
Prints a line.
Structure representing a test case.
ROMCONST struct testcase *ROMCONST patternbmk[]
Test sequence for benchmarks.
static void bmk7_setup(void)
ROMCONST struct testcase testbmk13
ROMCONST struct testcase testbmk11
static void bmk12_setup(void)
static void bmk8_execute(void)
ROMCONST struct testcase testbmk12
ROMCONST struct testcase testbmk3
ROMCONST struct testcase testbmk7
static msg_t thread2(void *p)
ROMCONST struct testcase testbmk1
static void bmk10_execute(void)
ROMCONST struct testcase testbmk9
static void bmk7_execute(void)
static msg_t thread3(void *p)
static void bmk2_execute(void)
ROMCONST struct testcase testbmk6
static void bmk13_execute(void)
ROMCONST struct testcase testbmk5
static void bmk1_execute(void)
ROMCONST struct testcase testbmk4
static void bmk3_execute(void)
ROMCONST struct testcase testbmk2
static msg_t thread8(void *p)
static void bmk12_execute(void)
static void bmk4_execute(void)
static void bmk5_execute(void)
ROMCONST struct testcase testbmk8
ROMCONST struct testcase testbmk10
static void bmk6_execute(void)
static void bmk9_execute(void)
static void bmk11_execute(void)
static void tmo(void *param)
static void bmk11_setup(void)
static msg_t thread1(void *p)
static tstrWifiInitParam param