source:
benchmark/ctxswitch/cfa_gen.cfa@
6e540ea
| Last change on this file since 6e540ea was b4107c8, checked in by , 6 years ago | |
|---|---|
|
|
| File size: 458 bytes | |
| Rev | Line | |
|---|---|---|
| [fe065c3] | 1 | #include "../bench.h" |
| 2 | ||
| 3 | typedef struct { | |
| 4 | void * next; | |
| 5 | } GreatSuspender; | |
| 6 | ||
| 7 | void comain( GreatSuspender * this ) { | |
| [b4107c8] | 8 | if ( __builtin_expect(this->next != 0, 1) ) goto *(this->next); |
| 9 | this->next = &&s1; | |
| [fe065c3] | 10 | for () { |
| [b4107c8] | 11 | return; |
| [fe065c3] | 12 | s1: ; |
| 13 | } | |
| 14 | } | |
| 15 | ||
| [b4107c8] | 16 | int main( int argc, char * argv[] ) { |
| 17 | BENCH_START() | |
| 18 | GreatSuspender s = { 0 }; | |
| [fe065c3] | 19 | BENCH( |
| [b4107c8] | 20 | for ( i; times ) { |
| [fe065c3] | 21 | comain( &s ); |
| 22 | }, | |
| 23 | result | |
| 24 | ) | |
| [b4107c8] | 25 | printf( "%g\n", result ); |
| [fe065c3] | 26 | } |
| [b4107c8] | 27 | |
| 28 | // Local Variables: // | |
| 29 | // tab-width: 4 // | |
| 30 | // End: // |
Note:
See TracBrowser
for help on using the repository browser.