source:
benchmark/ctxswitch/cfa_thrd2.cfa@
2a3f0d9
| Last change on this file since 2a3f0d9 was 2316525, checked in by , 6 years ago | |
|---|---|
|
|
| File size: 395 bytes | |
| Rev | Line | |
|---|---|---|
| [73abe95] | 1 | #include <thread.hfa> |
| [6810fcb] | 2 | |
| 3 | #include "bench.h" | |
| 4 | ||
| 5 | volatile bool done = false; | |
| 6 | ||
| 7 | thread Fibre {}; | |
| 8 | ||
| [ffe2fad] | 9 | void main(__attribute__((unused)) Fibre & this) { |
| [2316525] | 10 | while ( ! done ) { |
| [6810fcb] | 11 | yield(); |
| 12 | } | |
| 13 | } | |
| 14 | ||
| [b4107c8] | 15 | int main( int argc, char * argv[] ) { |
| 16 | BENCH_START() | |
| [6810fcb] | 17 | Fibre f1; |
| 18 | BENCH( | |
| [2316525] | 19 | for ( times ) { |
| [6810fcb] | 20 | yield(); |
| 21 | }, | |
| 22 | result | |
| 23 | ) | |
| [b4107c8] | 24 | printf( "%g\n", result ); |
| [6810fcb] | 25 | done = true; |
| [dc33b5b] | 26 | } |
| [b4107c8] | 27 | |
| 28 | // Local Variables: // | |
| 29 | // tab-width: 4 // | |
| 30 | // End: // |
Note:
See TracBrowser
for help on using the repository browser.