source: src/benchmark/schedint/upp.cc @ 9f0b975

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 9f0b975 was 9f0b975, checked in by Thierry Delisle <tdelisle@…>, 6 years ago

added behcnmarks for signal and waitfor

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