ADT
aaron-thesis
arm-eh
ast-experimental
cleanup-dtors
deferred_resn
demangler
enum
forall-pointer-decay
jacob/cs343-translation
jenkins-sandbox
new-ast
new-ast-unique-expr
new-env
no_list
persistent-indexer
pthread-emulation
qualifiedEnum
resolv-new
with_gc
Last change
on this file since df7a162 was bb7e3d4, checked in by Thierry Delisle <tdelisle@…>, 8 years ago |
Removed second processor in scheduling benchmark, since it was creating too much contention
|
-
Property mode
set to
100644
|
File size:
567 bytes
|
Line | |
---|
1 | #include <cstdio>
|
---|
2 |
|
---|
3 | #include "bench.h"
|
---|
4 |
|
---|
5 | int argc;
|
---|
6 | char** argv;
|
---|
7 | volatile int go = 0;
|
---|
8 |
|
---|
9 | _Monitor M {
|
---|
10 | uCondition cond;
|
---|
11 | public:
|
---|
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 |
|
---|
31 | M m;
|
---|
32 |
|
---|
33 | _Task T {
|
---|
34 | void main() {
|
---|
35 | while(go == 0) { yield(); }
|
---|
36 | while(go == 1) { m.call(); }
|
---|
37 |
|
---|
38 | }
|
---|
39 | };
|
---|
40 |
|
---|
41 | int main(int margc, char* margv[]) {
|
---|
42 | argc = margc;
|
---|
43 | argv = margv;
|
---|
44 | T t;
|
---|
45 | return m.wait();
|
---|
46 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.