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