Ignore:
Timestamp:
Jan 19, 2020, 4:16:27 PM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
f090750
Parents:
9e63a2b
Message:

update benchmarks for concurrency paper

File:
1 edited

Legend:

Unmodified
Added
Removed
  • benchmark/schedint/cfa2.cfa

    r9e63a2b r2316525  
    44#include <stdio.h>
    55
    6 #include "bench.h"
     6#include "../bench.h"
    77
    88volatile int go = 0;
     9condition c;
     10monitor M {} m1, m2;
    911
    10 condition c;
    11 monitor M {};
    12 M m1, m2;
    13 
    14 void __attribute__((noinline)) call( M & mutex a1, M & mutex a2 ) {
    15         signal(c);
     12void __attribute__((noinline)) call( M & mutex p1, M & mutex p2 ) {
     13        signal( c );
    1614}
    1715
    18 int  __attribute__((noinline)) wait( M & mutex a1, M & mutex a2 ) {
     16void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2 ) {
    1917        go = 1;
     18        for ( times ) {
     19                wait( c );
     20        }
     21        go = 0;
     22}
     23
     24thread T {};
     25void main( T & ) {
     26        while ( go == 0 ) { yield(); }
    2027        BENCH(
    21                 for ( i; times ) {
    22                         wait(c);
    23                 },
     28                while ( go == 1 ) { call( m1, m2 ); },
    2429                result
    2530        )
    2631        printf( "%g\n", result );
    27         go = 0;
    28         return 0;
    29 }
    30 
    31 thread T {};
    32 void ^?{}( T & mutex this ) {}
    33 void main( T & ) {
    34         while(go == 0) { yield(); }
    35         while(go == 1) { call(m1, m2); }
    36 
    3732}
    3833
     
    4035        BENCH_START()
    4136        T t;
    42         return wait(m1, m2);
     37        wait( m1, m2 );
    4338}
    4439
Note: See TracChangeset for help on using the changeset viewer.