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 580c11b 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:
584 bytes
|
| Line | |
|---|
| 1 | #include <cstdio>
|
|---|
| 2 |
|
|---|
| 3 | #include "bench.h"
|
|---|
| 4 |
|
|---|
| 5 | volatile int go = 0;
|
|---|
| 6 |
|
|---|
| 7 | _Monitor M {
|
|---|
| 8 | uCondition cond;
|
|---|
| 9 | public:
|
|---|
| 10 | void __attribute__((noinline)) call() {
|
|---|
| 11 | cond.signal();
|
|---|
| 12 | }
|
|---|
| 13 |
|
|---|
| 14 | int __attribute__((noinline)) wait() {
|
|---|
| 15 | go = 1;
|
|---|
| 16 | BENCH(
|
|---|
| 17 | for (size_t i = 0; i < n; i++) {
|
|---|
| 18 | cond.wait();
|
|---|
| 19 | },
|
|---|
| 20 | result
|
|---|
| 21 | )
|
|---|
| 22 | printf( "%g\n", result );
|
|---|
| 23 | go = 0;
|
|---|
| 24 | return 0;
|
|---|
| 25 | }
|
|---|
| 26 | };
|
|---|
| 27 |
|
|---|
| 28 | M m;
|
|---|
| 29 |
|
|---|
| 30 | _Task T {
|
|---|
| 31 | void main() {
|
|---|
| 32 | while(go == 0) { yield(); }
|
|---|
| 33 | while(go == 1) { m.call(); }
|
|---|
| 34 |
|
|---|
| 35 | }
|
|---|
| 36 | };
|
|---|
| 37 |
|
|---|
| 38 | int main( int argc, char * argv[] ) {
|
|---|
| 39 | BENCH_START()
|
|---|
| 40 | T t;
|
|---|
| 41 | return m.wait();
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 | // Local Variables: //
|
|---|
| 45 | // tab-width: 4 //
|
|---|
| 46 | // End: //
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.