source:
benchmark/schedext/cfa1.cfa@
c93fd72
| Last change on this file since c93fd72 was b4107c8, checked in by , 6 years ago | |
|---|---|
|
|
| File size: 645 bytes | |
| Rev | Line | |
|---|---|---|
| [73abe95] | 1 | #include <kernel.hfa> |
| 2 | #include <monitor.hfa> | |
| 3 | #include <thread.hfa> | |
| [9f0b975] | 4 | #include <stdio.h> |
| 5 | ||
| 6 | #include "bench.h" | |
| 7 | ||
| 8 | volatile int go = 0; | |
| 9 | ||
| 10 | monitor M {}; | |
| 11 | M m1; | |
| 12 | ||
| 13 | void __attribute__((noinline)) call( M & mutex a1 ) {} | |
| 14 | ||
| 15 | int __attribute__((noinline)) wait( M & mutex a1 ) { | |
| 16 | go = 1; | |
| [b4107c8] | 17 | for ( i; times ) { |
| 18 | waitfor(call, a1); | |
| 19 | } | |
| [9f0b975] | 20 | go = 0; |
| 21 | return 0; | |
| 22 | } | |
| 23 | ||
| 24 | thread T {}; | |
| 25 | void ^?{}( T & mutex this ) {} | |
| [dc33b5b] | 26 | void main( T & ) { |
| [9f0b975] | 27 | while(go == 0) { yield(); } |
| [b4107c8] | 28 | BENCH( |
| 29 | while(go == 1) { call(m1); }, | |
| 30 | result | |
| 31 | ) | |
| 32 | printf( "%g\n", result ); | |
| [9f0b975] | 33 | } |
| 34 | ||
| [b4107c8] | 35 | int main( int argc, char * argv[] ) { |
| 36 | BENCH_START() | |
| [9f0b975] | 37 | T t; |
| [b4107c8] | 38 | return wait( m1 ); |
| [dc33b5b] | 39 | } |
| [b4107c8] | 40 | |
| 41 | // Local Variables: // | |
| 42 | // tab-width: 4 // | |
| 43 | // End: // |
Note:
See TracBrowser
for help on using the repository browser.