ADT
        arm-eh
        ast-experimental
        cleanup-dtors
        enum
        forall-pointer-decay
        jacob/cs343-translation
        jenkins-sandbox
        new-ast
        new-ast-unique-expr
        pthread-emulation
        qualifiedEnum
      
      
        
          | Last change
 on this file since 09ab71a was             5e49e47, checked in by Thierry Delisle <tdelisle@…>, 7 years ago | 
        
          | 
Fix code rot in benchmark (not jenkins)
 | 
        
          | 
              
Property                 mode
 set to                 100644 | 
        
          | File size:
            692 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, m2; | 
|---|
|  | 14 |  | 
|---|
|  | 15 | void __attribute__((noinline)) call( M & mutex a1, M & mutex a2 ) {} | 
|---|
|  | 16 |  | 
|---|
|  | 17 | int  __attribute__((noinline)) wait( M & mutex a1, M & mutex a2 ) { | 
|---|
|  | 18 | go = 1; | 
|---|
|  | 19 | BENCH( | 
|---|
|  | 20 | for (size_t i = 0; i < n; i++) { | 
|---|
|  | 21 | waitfor(call, a1, a2); | 
|---|
|  | 22 | }, | 
|---|
|  | 23 | result | 
|---|
|  | 24 | ) | 
|---|
|  | 25 |  | 
|---|
|  | 26 | printf("%llu\n", result); | 
|---|
|  | 27 | go = 0; | 
|---|
|  | 28 | return 0; | 
|---|
|  | 29 | } | 
|---|
|  | 30 |  | 
|---|
|  | 31 | thread T {}; | 
|---|
|  | 32 | void ^?{}( T & mutex this ) {} | 
|---|
|  | 33 | void main( T & this ) { | 
|---|
|  | 34 | while(go == 0) { yield(); } | 
|---|
|  | 35 | while(go == 1) { call(m1, m2); } | 
|---|
|  | 36 |  | 
|---|
|  | 37 | } | 
|---|
|  | 38 |  | 
|---|
|  | 39 | int main(int margc, char* margv[]) { | 
|---|
|  | 40 | argc = margc; | 
|---|
|  | 41 | argv = margv; | 
|---|
|  | 42 | T t; | 
|---|
|  | 43 | return wait(m1, m2); | 
|---|
|  | 44 | } | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.