source:
benchmark/ctxswitch/upp_cor.cc@
8e27ac45
| Last change on this file since 8e27ac45 was 2316525, checked in by , 6 years ago | |
|---|---|
|
|
| File size: 376 bytes | |
| Rev | Line | |
|---|---|---|
| [b7170a64] | 1 | #include <cstdio> |
| 2 | ||
| 3 | #include "bench.h" | |
| 4 | ||
| [2316525] | 5 | _Coroutine C { |
| [b7170a64] | 6 | void main() { |
| 7 | while( true ) { | |
| 8 | suspend(); | |
| 9 | } | |
| 10 | } | |
| [b4107c8] | 11 | public: |
| 12 | void do_resume() { | |
| 13 | resume(); | |
| 14 | } | |
| [2316525] | 15 | } c; |
| [b4107c8] | 16 | int main( int argc, char * argv[] ) { |
| 17 | BENCH_START() | |
| [b7170a64] | 18 | BENCH( |
| [b4107c8] | 19 | for (size_t i = 0; i < times; i++) { |
| [2316525] | 20 | c.do_resume(); |
| [b7170a64] | 21 | }, |
| 22 | result | |
| 23 | ) | |
| [b4107c8] | 24 | printf( "%g\n", result ); |
| [dc33b5b] | 25 | } |
| [b4107c8] | 26 | |
| 27 | // Local Variables: // | |
| 28 | // tab-width: 4 // | |
| 29 | // End: // |
Note:
See TracBrowser
for help on using the repository browser.