source:
benchmark/schedext/upp.cc
@
b4107c8
Last change on this file since b4107c8 was b4107c8, checked in by , 3 years ago | |
---|---|
|
|
File size: 550 bytes |
Rev | Line | |
---|---|---|
[9f0b975] | 1 | #include <cstdio> |
2 | ||
3 | #include "bench.h" | |
4 | ||
5 | volatile int go = 0; | |
6 | ||
7 | _Monitor M { | |
8 | public: | |
9 | void __attribute__((noinline)) call() {} | |
10 | ||
11 | int __attribute__((noinline)) wait() { | |
12 | go = 1; | |
[b4107c8] | 13 | for (size_t i = 0; i < times; i++) { |
14 | _Accept(call); | |
15 | } | |
[9f0b975] | 16 | go = 0; |
17 | return 0; | |
18 | } | |
19 | }; | |
20 | ||
21 | M m; | |
22 | ||
23 | _Task T { | |
24 | void main() { | |
25 | while(go == 0) { yield(); } | |
[b4107c8] | 26 | BENCH( |
27 | while(go == 1) { m.call(); }, | |
28 | result | |
29 | ) | |
30 | printf( "%g\n", result ); | |
[9f0b975] | 31 | } |
32 | }; | |
33 | ||
[b4107c8] | 34 | int main( int argc, char * argv[] ) { |
35 | BENCH_START() | |
[9f0b975] | 36 | T t; |
37 | return m.wait(); | |
[dc33b5b] | 38 | } |
[b4107c8] | 39 | |
40 | // Local Variables: // | |
41 | // tab-width: 4 // | |
42 | // End: // |
Note: See TracBrowser
for help on using the repository browser.