source: benchmark/schedint/upp.cc @ 8e3034d

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 8e3034d was 26fd986, checked in by Peter A. Buhr <pabuhr@…>, 4 years ago

update benchmarks for concurrency paper

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