source: benchmark/schedint/cfa4.cfa @ 013b028

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

update benchmarks for concurrency paper

  • Property mode set to 100644
File size: 754 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, m2, m3, m4;
12
13void __attribute__((noinline)) call( M & mutex p1, M & mutex p2, M & mutex p3, M & mutex p4 ) {
14        signal( c );
15}
16void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2, M & mutex p3, M & mutex p4 ) {
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, m2, m3, m4 ); },
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, m2, m3, m4 );
37}
38
39// Local Variables: //
40// tab-width: 4 //
41// End: //
Note: See TracBrowser for help on using the repository browser.