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