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