source:
tests/preempt_longrun/processor.c@
8d25360
| Last change on this file since 8d25360 was dc8511c, checked in by , 7 years ago | |
|---|---|
|
|
| File size: 580 bytes | |
| Line | |
|---|---|
| 1 | #include <kernel.hfa> |
| 2 | #include <thread.hfa> |
| 3 | #include <time.hfa> |
| 4 | |
| 5 | #include <unistd.h> |
| 6 | |
| 7 | #include "long_tests.hfa" |
| 8 | |
| 9 | #ifndef PREEMPTION_RATE |
| 10 | #error PREEMPTION_RATE not defined in makefile |
| 11 | #endif |
| 12 | |
| 13 | Duration default_preemption() { |
| 14 | return PREEMPTION_RATE; |
| 15 | } |
| 16 | |
| 17 | static const unsigned long N = 50_000ul; |
| 18 | |
| 19 | int main(int argc, char* argv[]) { |
| 20 | processor * p[15]; |
| 21 | for ( int pi = 0; pi < 15; pi++ ) { |
| 22 | p[pi] = new(); |
| 23 | } |
| 24 | for ( int i = 0; TEST(i < N); i++) { |
| 25 | int pi = i % 15; |
| 26 | delete( p[pi] ); |
| 27 | p[pi] = new(); |
| 28 | KICK_WATCHDOG; |
| 29 | } |
| 30 | for ( int pi = 0; pi < 15; pi++ ) { |
| 31 | delete( p[pi] ); |
| 32 | } |
| 33 | } |
Note:
See TracBrowser
for help on using the repository browser.