source:
src/benchmark/ctxswitch/cfa_cor.c
@
034165a
Last change on this file since 034165a was 034165a, checked in by , 5 years ago | |
---|---|
|
|
File size: 516 bytes |
Rev | Line | |
---|---|---|
[de90452] | 1 | #include <fstream> |
2 | #include <stdlib> | |
[29f44a74] | 3 | #include <thread> |
[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 | ||
[f1dd17a] | 13 | void main( GreatSuspender & this ) |
[de90452] | 14 | { |
15 | while( true ) { | |
16 | suspend(); | |
17 | } | |
18 | } | |
19 | ||
[f1dd17a] | 20 | void resumer( GreatSuspender & this, const unsigned int NoOfTimes ) { |
[de90452] | 21 | for ( volatile unsigned int i = 0; i < NoOfTimes; i += 1 ) { |
22 | resume( this ); | |
23 | } | |
24 | } | |
25 | ||
[034165a] | 26 | int main(int argc, char* argv[]) { |
[de90452] | 27 | GreatSuspender s; |
28 | ||
[034165a] | 29 | BENCH( |
30 | resumer( s, NoOfTimes );, | |
31 | result | |
32 | ) | |
[de90452] | 33 | |
[034165a] | 34 | sout | result | endl; |
[de90452] | 35 | } |
Note: See TracBrowser
for help on using the repository browser.