[riot-notifications] [RIOT-OS/RIOT] tests: add test for context switch from ISR (#16284)

benpicco notifications at github.com
Wed Jul 21 00:45:37 CEST 2021


@benpicco commented on this pull request.



> @@ -0,0 +1,16 @@
+Testing Context Switches from ISR under Load
+============================================
+
+This tests lunches two threads, t1 and t2, which each try to lock its own mutex for 500 times. A

![](https://i.imgur.com/ok65CYj.gif)

> + *
+ * @}
+ */
+
+#include <stdint.h>
+#include <stdatomic.h>
+#include <stdio.h>
+
+#include "macros/units.h"
+#include "mutex.h"
+#include "periph/timer.h"
+#include "random.h"
+#include "thread.h"
+
+#ifndef TIMER
+#define TIMER               0

```suggestion
#define TIMER               TIMER_DEV(0)
```

makes the code a bit nicer to read

> +#include "mutex.h"
+#include "periph/timer.h"
+#include "random.h"
+#include "thread.h"
+
+#ifndef TIMER
+#define TIMER               0
+#endif
+#ifndef CHANNEL
+#define CHANNEL               0
+#endif
+#ifndef TEST_REPETITIONS
+#define TEST_REPETITIONS    500
+#endif
+#ifndef TEST_TIMEOUT_SHORT
+#define TEST_TIMEOUT_SHORT  8

```suggestion
#define TEST_TIMEOUT_TICKS_SHORT  8
```

> +#include "thread.h"
+
+#ifndef TIMER
+#define TIMER               0
+#endif
+#ifndef CHANNEL
+#define CHANNEL               0
+#endif
+#ifndef TEST_REPETITIONS
+#define TEST_REPETITIONS    500
+#endif
+#ifndef TEST_TIMEOUT_SHORT
+#define TEST_TIMEOUT_SHORT  8
+#endif
+#ifndef TEST_TIMEOUT_LONG
+#define TEST_TIMEOUT_LONG   1000

```suggestion
#define TEST_TIMEOUT_TICKS_LONG   1000
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16284#pullrequestreview-711119267
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210720/ede69c0b/attachment.htm>


More information about the notifications mailing list