ADT
        aaron-thesis
        arm-eh
        ast-experimental
        cleanup-dtors
        deferred_resn
        demangler
        enum
        forall-pointer-decay
        jacob/cs343-translation
        jenkins-sandbox
        new-ast
        new-ast-unique-expr
        new-env
        no_list
        persistent-indexer
        pthread-emulation
        qualifiedEnum
        with_gc
      
      
        
          | Last change
 on this file since a02842f was             b7170a64, checked in by Thierry Delisle <tdelisle@…>, 8 years ago | 
        
          | 
Updated the creation and ctxswitch benchmark to all be consistent and flexible
 | 
        
          | 
              
Property                 mode
 set to                 100644 | 
        
          | File size:
            375 bytes | 
      
      
| Line |  | 
|---|
| 1 | #include <cstdio> | 
|---|
| 2 |  | 
|---|
| 3 | #include "bench.h" | 
|---|
| 4 |  | 
|---|
| 5 | _Coroutine GreatSuspender { | 
|---|
| 6 | public: | 
|---|
| 7 | GreatSuspender() { | 
|---|
| 8 | resume(); | 
|---|
| 9 | } | 
|---|
| 10 |  | 
|---|
| 11 | void do_resume() { | 
|---|
| 12 | resume(); | 
|---|
| 13 | } | 
|---|
| 14 | private: | 
|---|
| 15 | void main() { | 
|---|
| 16 | while( true ) { | 
|---|
| 17 | suspend(); | 
|---|
| 18 | } | 
|---|
| 19 | } | 
|---|
| 20 | }; | 
|---|
| 21 |  | 
|---|
| 22 | int main(int argc, char* argv[]) { | 
|---|
| 23 | GreatSuspender s; | 
|---|
| 24 |  | 
|---|
| 25 | BENCH( | 
|---|
| 26 | for (size_t i = 0; i < n; i++) { | 
|---|
| 27 | s.do_resume(); | 
|---|
| 28 | }, | 
|---|
| 29 | result | 
|---|
| 30 | ) | 
|---|
| 31 |  | 
|---|
| 32 | printf("%llu\n", result); | 
|---|
| 33 | } | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.