Last change
on this file since 9c447e2 was
2316525,
checked in by Peter A. Buhr <pabuhr@…>, 5 years ago
|
update benchmarks for concurrency paper
|
-
Property mode set to
100644
|
File size:
588 bytes
|
Line | |
---|
1 | #include <thread.hfa> |
---|
2 | #include <monitor.hfa> |
---|
3 | |
---|
4 | #include "../bench.h" |
---|
5 | |
---|
6 | monitor M {} m1, m2, m3, m4; |
---|
7 | void __attribute__((noinline)) call( M & mutex m1, M & mutex m2, M & mutex m3, M & mutex m4 ) {} |
---|
8 | |
---|
9 | volatile bool go = false; |
---|
10 | |
---|
11 | void call() { |
---|
12 | go = true; |
---|
13 | for ( times ) { |
---|
14 | call( m1, m2, m3, m4 ); |
---|
15 | } |
---|
16 | go = false; |
---|
17 | } |
---|
18 | thread T {}; |
---|
19 | void main( T & this ) { |
---|
20 | while ( ! go ); |
---|
21 | while ( go ) { call( m1, m2, m3, m4 ); } |
---|
22 | } |
---|
23 | int main( int argc, char * argv[] ) { |
---|
24 | BENCH_START() |
---|
25 | T t; |
---|
26 | BENCH( |
---|
27 | call( m1, m2 ), |
---|
28 | result |
---|
29 | ) |
---|
30 | printf( "%g\n", result ); |
---|
31 | } |
---|
32 | |
---|
33 | // Local Variables: // |
---|
34 | // tab-width: 4 // |
---|
35 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.