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