source: benchmark/schedint/cfa2.cfa @ b4107c8

arm-ehenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-expr
Last change on this file since b4107c8 was b4107c8, checked in by Peter A. Buhr <pabuhr@…>, 3 years ago

update existing benchmarks for changes to bench.h, add new benchmarks in new programming languages

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