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