source:
benchmark/schedint/cfa1.cfa
@
96f5b30
Last change on this file since 96f5b30 was 6e540ea, checked in by , 5 years ago | |
---|---|
|
|
File size: 657 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 | condition c; | |
11 | monitor M {}; | |
12 | M m1; | |
13 | ||
14 | void __attribute__((noinline)) call( M & mutex a1 ) { | |
[4cedd9f] | 15 | signal(c); |
[9f0b975] | 16 | } |
17 | ||
18 | int __attribute__((noinline)) wait( M & mutex a1 ) { | |
19 | go = 1; | |
20 | BENCH( | |
[6e540ea] | 21 | for ( i; times ) { |
[4cedd9f] | 22 | wait(c); |
[9f0b975] | 23 | }, |
24 | result | |
25 | ) | |
[b4107c8] | 26 | printf( "%g\n", result ); |
[9f0b975] | 27 | go = 0; |
28 | return 0; | |
29 | } | |
30 | ||
31 | thread T {}; | |
[dc33b5b] | 32 | void ^?{}( T & mutex ) {} |
33 | void main( T & ) { | |
[9f0b975] | 34 | while(go == 0) { yield(); } |
35 | while(go == 1) { call(m1); } | |
36 | ||
37 | } | |
38 | ||
[b4107c8] | 39 | int main( int argc, char * argv[] ) { |
40 | BENCH_START() | |
[9f0b975] | 41 | T t; |
42 | return wait(m1); | |
[dc33b5b] | 43 | } |
[b4107c8] | 44 | |
45 | // Local Variables: // | |
46 | // tab-width: 4 // | |
47 | // End: // |
Note: See TracBrowser
for help on using the repository browser.