ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since b4107c8 was
b4107c8,
checked in by Peter A. Buhr <pabuhr@…>, 5 years ago
|
update existing benchmarks for changes to bench.h, add new benchmarks in new programming languages
|
-
Property mode set to
100644
|
File size:
653 bytes
|
Line | |
---|
1 | #include <kernel.hfa> |
---|
2 | #include <monitor.hfa> |
---|
3 | #include <thread.hfa> |
---|
4 | #include <stdio.h> |
---|
5 | |
---|
6 | #include "bench.h" |
---|
7 | |
---|
8 | volatile int go = 0; |
---|
9 | |
---|
10 | condition c; |
---|
11 | monitor M {}; |
---|
12 | M m1; |
---|
13 | |
---|
14 | void __attribute__((noinline)) call( M & mutex a1 ) { |
---|
15 | signal(c); |
---|
16 | } |
---|
17 | |
---|
18 | int __attribute__((noinline)) wait( M & mutex a1 ) { |
---|
19 | go = 1; |
---|
20 | BENCH( |
---|
21 | for ( i; n ) { |
---|
22 | wait(c); |
---|
23 | }, |
---|
24 | result |
---|
25 | ) |
---|
26 | printf( "%g\n", result ); |
---|
27 | go = 0; |
---|
28 | return 0; |
---|
29 | } |
---|
30 | |
---|
31 | thread T {}; |
---|
32 | void ^?{}( T & mutex ) {} |
---|
33 | void main( T & ) { |
---|
34 | while(go == 0) { yield(); } |
---|
35 | while(go == 1) { call(m1); } |
---|
36 | |
---|
37 | } |
---|
38 | |
---|
39 | int main( int argc, char * argv[] ) { |
---|
40 | BENCH_START() |
---|
41 | T t; |
---|
42 | return wait(m1); |
---|
43 | } |
---|
44 | |
---|
45 | // Local Variables: // |
---|
46 | // tab-width: 4 // |
---|
47 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.