ADTast-experimentalpthread-emulation
Last change
on this file since e228f46 was
51493a4,
checked in by Peter A. Buhr <pabuhr@…>, 5 years ago
|
start directory for full-contention mutex tests
|
-
Property mode set to
100644
|
File size:
512 bytes
|
Rev | Line | |
---|
[51493a4] | 1 | #include <cstdio> |
---|
| 2 | |
---|
| 3 | #include "../bench.h" |
---|
| 4 | |
---|
| 5 | _Monitor MyMonitor { |
---|
| 6 | public: |
---|
| 7 | void __attribute__((noinline)) call() {} |
---|
| 8 | } m; |
---|
| 9 | |
---|
| 10 | volatile bool go = false; |
---|
| 11 | |
---|
| 12 | void call() { |
---|
| 13 | go = true; |
---|
| 14 | for ( size_t i = 0; i < times; i += 1 ) { |
---|
| 15 | m.call(); |
---|
| 16 | } |
---|
| 17 | go = false; |
---|
| 18 | } |
---|
| 19 | _Task T { |
---|
| 20 | void main() { |
---|
| 21 | while ( ! go ); |
---|
| 22 | while ( go ) { m.call(); } |
---|
| 23 | } |
---|
| 24 | }; |
---|
| 25 | int main( int argc, char * argv[] ) { |
---|
| 26 | BENCH_START() |
---|
| 27 | uProcessor p; |
---|
| 28 | T t; |
---|
| 29 | BENCH( |
---|
| 30 | call(), |
---|
| 31 | result |
---|
| 32 | ) |
---|
| 33 | printf( "%g\n", result ); |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | // Local Variables: // |
---|
| 37 | // tab-width: 4 // |
---|
| 38 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.