source:
benchmark/schedext/cfa1.cfa@
ba417e2
      
      | Last change on this file since ba417e2 was dc33b5b, checked in by , 6 years ago | |
|---|---|
            
  | 
        |
| File size: 640 bytes | |
| Rev | Line | |
|---|---|---|
| [73abe95] | 1 | #include <kernel.hfa> | 
| 2 | #include <monitor.hfa> | |
| 3 | #include <thread.hfa> | |
| [9f0b975] | 4 | #include <stdio.h> | 
| 5 | ||
| 6 | #include "bench.h" | |
| 7 | ||
| 8 | int argc; | |
| 9 | char** argv; | |
| 10 | volatile int go = 0; | |
| 11 | ||
| 12 | monitor M {}; | |
| 13 | M m1; | |
| 14 | ||
| 15 | void __attribute__((noinline)) call( M & mutex a1 ) {} | |
| 16 | ||
| 17 | int __attribute__((noinline)) wait( M & mutex a1 ) { | |
| 18 | go = 1; | |
| 19 | BENCH( | |
| [dc33b5b] | 20 | for ( i; n ) { | 
| [9f0b975] | 21 | waitfor(call, a1); | 
| 22 | }, | |
| 23 | result | |
| 24 | ) | |
| 25 | ||
| [dc33b5b] | 26 | printf("%g\n", result); | 
| [9f0b975] | 27 | go = 0; | 
| 28 | return 0; | |
| 29 | } | |
| 30 | ||
| 31 | thread T {}; | |
| 32 | void ^?{}( T & mutex this ) {} | |
| [dc33b5b] | 33 | void main( T & ) { | 
| [9f0b975] | 34 | while(go == 0) { yield(); } | 
| 35 | while(go == 1) { call(m1); } | |
| 36 | ||
| 37 | } | |
| 38 | ||
| [dc33b5b] | 39 | int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) { | 
| [9f0b975] | 40 | T t; | 
| 41 | return wait(m1); | |
| [dc33b5b] | 42 | } | 
  Note:
 See   TracBrowser
 for help on using the repository browser.