source: benchmark/schedint/cfa1.cfa @ 1e2de89

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 1e2de89 was 26fd986, checked in by Peter A. Buhr <pabuhr@…>, 5 years ago

update benchmarks for concurrency paper

  • Property mode set to 100644
File size: 634 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
10condition c;
11monitor M {} m1;
12
13void __attribute__((noinline)) call( M & mutex p1 ) {
14        signal( c );
15}
16void __attribute__((noinline)) wait( M & mutex p1 ) {
17        go = 1;
18        for ( times ) {
19                wait( c );
20        }
21}
22
23thread T {};
24void main( T & ) {
25        while ( go == 0 ) { yield(); } // waiter must start first
26        BENCH(
27                for ( times ) { call( m1 ); },
28                result
29        )
30        printf( "%g\n", result );
31}
32
33int main( int argc, char * argv[] ) {
34        BENCH_START()
35        T t;
36        wait( m1 );
37}
38
39// Local Variables: //
40// tab-width: 4 //
41// End: //
Note: See TracBrowser for help on using the repository browser.