source: benchmark/schedext/cfa1.cfa@ 5ee7d36

ADT arm-eh ast-experimental enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since 5ee7d36 was 2316525, checked in by Peter A. Buhr <pabuhr@…>, 6 years ago

update benchmarks for concurrency paper

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