ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 2316525 was
2316525,
checked in by Peter A. Buhr <pabuhr@…>, 4 years ago
|
update benchmarks for concurrency paper
|
-
Property mode set to
100644
|
File size:
731 bytes
|
Rev | Line | |
---|
[73abe95] | 1 | #include <kernel.hfa> |
---|
| 2 | #include <monitor.hfa> |
---|
| 3 | #include <thread.hfa> |
---|
[9f0b975] | 4 | #include <stdio.h> |
---|
| 5 | |
---|
| 6 | #include "bench.h" |
---|
| 7 | |
---|
| 8 | volatile int go = 0; |
---|
| 9 | |
---|
[2316525] | 10 | monitor M {} m1, m2, m3, m4; |
---|
[9f0b975] | 11 | |
---|
[2316525] | 12 | void __attribute__((noinline)) call( M & mutex p1, M & mutex p2, M & mutex p3, M & mutex p4 ) {} |
---|
[9f0b975] | 13 | |
---|
[2316525] | 14 | void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2, M & mutex p3, M & mutex p4 ) { |
---|
[9f0b975] | 15 | go = 1; |
---|
[2316525] | 16 | for ( times ) { |
---|
| 17 | waitfor( call : p1, p2, p3, p4 ); |
---|
[b4107c8] | 18 | } |
---|
[9f0b975] | 19 | go = 0; |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | thread T {}; |
---|
[dc33b5b] | 23 | void main( T & ) { |
---|
[2316525] | 24 | while( go == 0 ) { yield(); } |
---|
[b4107c8] | 25 | BENCH( |
---|
[2316525] | 26 | while( go == 1 ) { call( m1, m2, m3, m4 ); }, |
---|
[b4107c8] | 27 | result |
---|
| 28 | ) |
---|
| 29 | printf( "%g\n", result ); |
---|
[9f0b975] | 30 | } |
---|
| 31 | |
---|
[b4107c8] | 32 | int main( int argc, char * argv[] ) { |
---|
| 33 | BENCH_START() |
---|
[9f0b975] | 34 | T t; |
---|
[2316525] | 35 | wait( m1, m2, m3, m4 ); |
---|
[dc33b5b] | 36 | } |
---|
[b4107c8] | 37 | |
---|
| 38 | // Local Variables: // |
---|
| 39 | // tab-width: 4 // |
---|
| 40 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.