ADTarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 6a9d4b4 was
5e49e47,
checked in by Thierry Delisle <tdelisle@…>, 6 years ago
|
Fix code rot in benchmark (not jenkins)
|
-
Property mode set to
100644
|
File size:
784 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 | int argc; |
---|
| 9 | char** argv; |
---|
| 10 | volatile int go = 0; |
---|
| 11 | |
---|
| 12 | condition c; |
---|
| 13 | monitor M {}; |
---|
| 14 | M m1, m2, m3, m4; |
---|
| 15 | |
---|
| 16 | void __attribute__((noinline)) call( M & mutex a1, M & mutex a2, M & mutex a3, M & mutex a4 ) { |
---|
[4cedd9f] | 17 | signal(c); |
---|
[9f0b975] | 18 | } |
---|
| 19 | |
---|
| 20 | int __attribute__((noinline)) wait( M & mutex a1, M & mutex a2, M & mutex a3, M & mutex a4 ) { |
---|
| 21 | go = 1; |
---|
| 22 | BENCH( |
---|
| 23 | for (size_t i = 0; i < n; i++) { |
---|
[4cedd9f] | 24 | wait(c); |
---|
[9f0b975] | 25 | }, |
---|
| 26 | result |
---|
| 27 | ) |
---|
| 28 | |
---|
| 29 | printf("%llu\n", result); |
---|
| 30 | go = 0; |
---|
| 31 | return 0; |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | thread T {}; |
---|
| 35 | void ^?{}( T & mutex this ) {} |
---|
| 36 | void main( T & this ) { |
---|
| 37 | while(go == 0) { yield(); } |
---|
| 38 | while(go == 1) { call(m1, m2, m3, m4); } |
---|
| 39 | |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | int main(int margc, char* margv[]) { |
---|
| 43 | argc = margc; |
---|
| 44 | argv = margv; |
---|
| 45 | T t; |
---|
| 46 | return wait(m1, m2, m3, m4); |
---|
| 47 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.