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