source: benchmark/schedext/cfa4.cfa @ 9e63a2b

arm-ehjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-expr
Last change on this file since 9e63a2b was cca568e, checked in by Peter A. Buhr <pabuhr@…>, 23 months ago

change all example waitfor statements from comma separate to colon

  • Property mode set to 100644
File size: 780 bytes
Line 
1#include <kernel.hfa>
2#include <monitor.hfa>
3#include <thread.hfa>
4#include <stdio.h>
5
6#include "bench.h"
7
8volatile int go = 0;
9
10monitor M {};
11M m1, m2, m3, m4;
12
13void __attribute__((noinline)) call( M & mutex a1, M & mutex a2, M & mutex a3, M & mutex a4 ) {}
14
15int  __attribute__((noinline)) wait( M & mutex a1, M & mutex a2, M & mutex a3, M & mutex a4 ) {
16        go = 1;
17        for ( i; times ) {
18                waitfor( call : a1, a2, a3, a4 );
19        }
20        go = 0;
21        return 0;
22}
23
24thread T {};
25void ^?{}( T & mutex this ) {}
26void main( T & ) {
27        while(go == 0) { yield(); }
28        BENCH(
29                while(go == 1) { call(m1, m2, m3, m4); },
30                result
31        )
32        printf( "%g\n", result );
33}
34
35int main( int argc, char * argv[] ) {
36        BENCH_START()
37        T t;
38        return wait( m1, m2, m3, m4 );
39}
40
41// Local Variables: //
42// tab-width: 4 //
43// End: //
Note: See TracBrowser for help on using the repository browser.