source:
benchmark/ctxswitch/cfa_cor.cfa@
ca0f061f
| Last change on this file since ca0f061f was 5e49e47, checked in by , 7 years ago | |
|---|---|
|
|
| File size: 400 bytes | |
| Rev | Line | |
|---|---|---|
| [b7170a64] | 1 | #include <stdio.h> |
| [73abe95] | 2 | #include <kernel.hfa> |
| 3 | #include <thread.hfa> | |
| [de90452] | 4 | |
| [8cb6fcd] | 5 | #include "bench.h" |
| [de90452] | 6 | |
| [b510ac2] | 7 | coroutine GreatSuspender {}; |
| [de90452] | 8 | |
| [f1dd17a] | 9 | void ?{}( GreatSuspender & this ) { |
| [de90452] | 10 | prime(this); |
| 11 | } | |
| 12 | ||
| [b7170a64] | 13 | void main( GreatSuspender & this ) { |
| [de90452] | 14 | while( true ) { |
| 15 | suspend(); | |
| 16 | } | |
| 17 | } | |
| 18 | ||
| [034165a] | 19 | int main(int argc, char* argv[]) { |
| [de90452] | 20 | GreatSuspender s; |
| 21 | ||
| [034165a] | 22 | BENCH( |
| [b7170a64] | 23 | for (size_t i = 0; i < n; i++) { |
| 24 | resume( s ); | |
| 25 | }, | |
| [034165a] | 26 | result |
| 27 | ) | |
| [de90452] | 28 | |
| [b7170a64] | 29 | printf("%llu\n", result); |
| [de90452] | 30 | } |
Note:
See TracBrowser
for help on using the repository browser.