source: benchmark/schedint/cfa1.cfa @ 26fd986

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

update benchmarks for concurrency paper

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