ADT
        arm-eh
        ast-experimental
        enum
        forall-pointer-decay
        jacob/cs343-translation
        new-ast
        new-ast-unique-expr
        pthread-emulation
        qualifiedEnum
      
      
        
          | 
            Last change
 on this file since 7d0881c was             dc33b5b, checked in by Peter A. Buhr <pabuhr@…>, 6 years ago           | 
        
        
          | 
             
update benchmarks and add benchmarks for qthreads 
 
           | 
        
        
          
            
              - 
Property                 mode
 set to                 
100644
               
             
           | 
        
        
          | 
            File size:
            776 bytes
           | 
        
      
      
| Line |   | 
|---|
| 1 | #include <kernel.hfa>
 | 
|---|
| 2 | #include <monitor.hfa>
 | 
|---|
| 3 | #include <thread.hfa>
 | 
|---|
| 4 | #include <stdio.h>
 | 
|---|
| 5 | 
 | 
|---|
| 6 | #include "bench.h"
 | 
|---|
| 7 | 
 | 
|---|
| 8 | int argc;
 | 
|---|
| 9 | char** argv;
 | 
|---|
| 10 | volatile int go = 0;
 | 
|---|
| 11 | 
 | 
|---|
| 12 | condition c;
 | 
|---|
| 13 | monitor M {};
 | 
|---|
| 14 | M m1, m2, m3, m4;
 | 
|---|
| 15 | 
 | 
|---|
| 16 | void __attribute__((noinline)) call( M & mutex a1, M & mutex a2, M & mutex a3, M & mutex a4 ) {
 | 
|---|
| 17 |         signal(c);
 | 
|---|
| 18 | }
 | 
|---|
| 19 | 
 | 
|---|
| 20 | int  __attribute__((noinline)) wait( M & mutex a1, M & mutex a2, M & mutex a3, M & mutex a4 ) {
 | 
|---|
| 21 |         go = 1;
 | 
|---|
| 22 |         BENCH(
 | 
|---|
| 23 |                 for ( i; n ) {
 | 
|---|
| 24 |                         wait(c);
 | 
|---|
| 25 |                 },
 | 
|---|
| 26 |                 result
 | 
|---|
| 27 |         )
 | 
|---|
| 28 | 
 | 
|---|
| 29 |         printf("%g\n", result);
 | 
|---|
| 30 |         go = 0;
 | 
|---|
| 31 |         return 0;
 | 
|---|
| 32 | }
 | 
|---|
| 33 | 
 | 
|---|
| 34 | thread T {};
 | 
|---|
| 35 | void ^?{}( T & mutex this ) {}
 | 
|---|
| 36 | void main( T & ) {
 | 
|---|
| 37 |         while(go == 0) { yield(); }
 | 
|---|
| 38 |         while(go == 1) { call(m1, m2, m3, m4); }
 | 
|---|
| 39 | 
 | 
|---|
| 40 | }
 | 
|---|
| 41 | 
 | 
|---|
| 42 | int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) {
 | 
|---|
| 43 |         T t;
 | 
|---|
| 44 |         return wait(m1, m2, m3, m4);
 | 
|---|
| 45 | }
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.