source:
benchmark/schedext/upp.cc
@
2316525
Last change on this file since 2316525 was 2316525, checked in by , 4 years ago | |
---|---|
|
|
File size: 554 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; | |
[2316525] | 13 | for ( size_t i = 0; i < times; i++ ) { |
[b4107c8] | 14 | _Accept(call); |
15 | } | |
[9f0b975] | 16 | go = 0; |
17 | return 0; | |
18 | } | |
[2316525] | 19 | } m; |
[9f0b975] | 20 | |
21 | _Task T { | |
22 | void main() { | |
[2316525] | 23 | while ( go == 0 ) { yield(); } |
[b4107c8] | 24 | BENCH( |
[2316525] | 25 | while ( go == 1 ) { m.call(); }, |
[b4107c8] | 26 | result |
27 | ) | |
28 | printf( "%g\n", result ); | |
[9f0b975] | 29 | } |
30 | }; | |
31 | ||
[b4107c8] | 32 | int main( int argc, char * argv[] ) { |
33 | BENCH_START() | |
[9f0b975] | 34 | T t; |
35 | return m.wait(); | |
[dc33b5b] | 36 | } |
[b4107c8] | 37 | |
38 | // Local Variables: // | |
39 | // tab-width: 4 // | |
40 | // End: // |
Note: See TracBrowser
for help on using the repository browser.