source: benchmark/schedext/cfa2.cfa@ 6b6a3b8

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 6b6a3b8 was b4107c8, checked in by Peter A. Buhr <pabuhr@…>, 6 years ago

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

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