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