source:
benchmark/ctxswitch/cfa_cor_then.cfa@
7ff35e0e
| Last change on this file since 7ff35e0e was 2316525, checked in by , 6 years ago | |
|---|---|
|
|
| File size: 427 bytes | |
| Rev | Line | |
|---|---|---|
| [5b11c25] | 1 | #include <kernel.hfa> |
| 2 | #include <thread.hfa> | |
| 3 | ||
| 4 | #include "bench.h" | |
| 5 | ||
| 6 | void noOp(void) {} | |
| 7 | ||
| [2316525] | 8 | coroutine C {} c; |
| [5b11c25] | 9 | |
| [2316525] | 10 | void ?{}( C & this ) { |
| [5b11c25] | 11 | prime(this); |
| 12 | } | |
| 13 | ||
| [2316525] | 14 | void main( __attribute__((unused)) C & this ) { |
| 15 | while () { | |
| [5b11c25] | 16 | suspend_then(noOp); |
| 17 | } | |
| 18 | } | |
| 19 | ||
| [b4107c8] | 20 | int main( int argc, char * argv[] ) { |
| 21 | BENCH_START() | |
| [5b11c25] | 22 | BENCH( |
| [2316525] | 23 | for ( times ) { |
| 24 | resume( c ); | |
| [5b11c25] | 25 | }, |
| 26 | result | |
| 27 | ) | |
| [b4107c8] | 28 | printf( "%g\n", result ); |
| [dc33b5b] | 29 | } |
| [b4107c8] | 30 | |
| 31 | // Local Variables: // | |
| 32 | // tab-width: 4 // | |
| 33 | // End: // |
Note:
See TracBrowser
for help on using the repository browser.