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