Changes in / [5518719:5cdeecd]


Ignore:
Location:
benchmark
Files:
2 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • benchmark/Makefile.am

    r5518719 r5cdeecd  
    1111## Created On       : Sun May 31 09:08:15 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Tue Jan 21 17:56:31 2020
    14 ## Update Count     : 250
     13## Last Modified On : Mon Jan 20 11:50:13 2020
     14## Update Count     : 244
    1515###############################################################################
    1616
     
    7575.ONESHELL:              # use one shell to execute recipe
    7676.NOTPARALLEL:
    77 .PHONY: compile.csv basic.csv ctxswitch.csv mutex.csv schedint.csv
    78 
    79 ## =========================================================================================================
    80 
    81 all : basic$(EXEEXT) ctxswitch$(EXEEXT) mutex$(EXEEXT) schedint$(EXEEXT) schedext$(EXEEXT) creation$(EXEEXT)
     77.PHONY: compile.csv basic.csv ctxswitch.csv mutex.csv signal.csv
     78
     79## =========================================================================================================
     80
     81all : basic$(EXEEXT) ctxswitch$(EXEEXT) mutex$(EXEEXT) signal$(EXEEXT) waitfor$(EXEEXT) creation$(EXEEXT)
    8282
    8383basic_loop_DURATION = 15000000000
     
    9191ctxswitch_DURATION = 100000000
    9292
    93 #mutex_java_DURATION = 10000000
     93mutex_java_DURATION = 10000000
    9494mutex_DURATION = 50000000
    9595
    96 schedint_pthread_DURATION = 1000000
    97 schedint_java_DURATION = $(schedint_pthread_DURATION)
    98 schedint_rust_DURATION = $(schedint_pthread_DURATION)
    99 schedint_DURATION = 10000000
    100 
    101 schedext_DURATION = 10000000
     96signal_pthread_DURATION = 1000000
     97signal_java_DURATION = $(signal_pthread_DURATION)
     98signal_rust_DURATION = $(signal_pthread_DURATION)
     99signal_DURATION = 10000000
     100
     101waitfor_DURATION = 10000000
    102102
    103103creation_pthread_DURATION = 250000
    104 creation_rust_thread_DURATION = ${creation_pthread_DURATION}
    105 creation_java_thread_DURATION = ${creation_pthread_DURATION}
     104creation_rust_DURATION = ${creation_pthread_DURATION}
    106105creation_cfa_coroutine_DURATION = 100000000
    107106creation_cfa_coroutine_eager_DURATION = 10000000
     
    152151        +make mutex.csv
    153152        -+make mutex.diff.csv
    154         +make schedint.csv
    155         -+make schedint.diff.csv
     153        +make signal.csv
     154        -+make signal.diff.csv
    156155@DOifskipcompile@
    157156        cat compile.csv
     
    164163        cat mutex.csv
    165164        -cat mutex.diff.csv
    166         cat schedint.csv
    167         -cat schedint.diff.csv
     165        cat signal.csv
     166        -cat signal.diff.csv
    168167
    169168compile.csv:
     
    199198        $(srcdir)/fixcsv.sh $@
    200199
    201 schedint.csv:
    202         echo "schedint-1,schedint-2,schedext-1,schedext-2" > $@
    203         +make schedint-cfa1.runquiet >> $@ && echo -n ',' >> $@
    204         +make schedint-cfa2.runquiet >> $@ && echo -n ',' >> $@
    205         +make schedext-cfa1.runquiet >> $@ && echo -n ',' >> $@
    206         +make schedext-cfa2.runquiet >> $@
     200signal.csv:
     201        echo "signal-1,signal-2,waitfor-1,waitfor-2" > $@
     202        +make signal-cfa1.runquiet >> $@ && echo -n ',' >> $@
     203        +make signal-cfa2.runquiet >> $@ && echo -n ',' >> $@
     204        +make waitfor-cfa1.runquiet >> $@ && echo -n ',' >> $@
     205        +make waitfor-cfa2.runquiet >> $@
    207206        $(srcdir)/fixcsv.sh $@
    208207
     
    352351## =========================================================================================================
    353352
    354 schedint$(EXEEXT) :             \
    355         schedint-cfa1.run       \
    356         schedint-cfa2.run       \
    357         schedint-cfa4.run       \
    358         schedint-upp.run        \
    359         schedint-rust.run       \
    360         schedint-java.run       \
    361         schedint-pthread.run
    362 
    363 schedint-cfa1$(EXEEXT):
     353signal$(EXEEXT) :               \
     354        signal-cfa1.run         \
     355        signal-cfa2.run         \
     356        signal-cfa4.run         \
     357        signal-upp.run          \
     358        signal-rust.run         \
     359        signal-java.run         \
     360        signal-pthread.run
     361
     362signal-pthread$(EXEEXT):
     363        $(BENCH_V_CC)$(COMPILE) $(srcdir)/schedint/pthreads.c
     364
     365signal-upp$(EXEEXT):
     366        $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedint/upp.cc
     367
     368signal-cfa1$(EXEEXT):
    364369        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa1.cfa
    365370
    366 schedint-cfa2$(EXEEXT):
     371signal-cfa2$(EXEEXT):
    367372        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa2.cfa
    368373
    369 schedint-cfa4$(EXEEXT):
     374signal-cfa4$(EXEEXT):
    370375        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa4.cfa
    371376
    372 schedint-upp$(EXEEXT):
    373         $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedint/upp.cc
    374 
    375 schedint-rust$(EXEEXT):
     377signal-rust$(EXEEXT):
    376378        $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/schedint/rust.rs
    377379
    378 schedint-java$(EXEEXT):
     380signal-java$(EXEEXT):
    379381        $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java
    380382        echo "#!/bin/sh" > a.out
     
    382384        chmod a+x a.out
    383385
    384 schedint-pthread$(EXEEXT):
    385         $(BENCH_V_CC)$(COMPILE) $(srcdir)/schedint/pthreads.c
    386 
    387 ## =========================================================================================================
    388 
    389 schedext$(EXEEXT) :             \
    390         schedext-cfa1.run       \
    391         schedext-cfa2.run       \
    392         schedext-cfa4.run       \
    393         schedext-upp.run        \
    394         schedext-goroutine.run
    395 
    396 schedext-cfa1$(EXEEXT):
     386## =========================================================================================================
     387
     388waitfor$(EXEEXT) :              \
     389        waitfor-cfa1.run        \
     390        waitfor-cfa2.run        \
     391        waitfor-cfa4.run        \
     392        waitfor-upp.run
     393
     394waitfor-upp$(EXEEXT):
     395        $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedext/upp.cc
     396
     397waitfor-cfa1$(EXEEXT):
    397398        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa1.cfa
    398399
    399 schedext-cfa2$(EXEEXT):
     400waitfor-cfa2$(EXEEXT):
    400401        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa2.cfa
    401402
    402 schedext-cfa4$(EXEEXT):
     403waitfor-cfa4$(EXEEXT):
    403404        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa4.cfa
    404405
    405 schedext-upp$(EXEEXT):
    406         $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedext/upp.cc
    407 
    408 schedext-goroutine$(EXEEXT):
    409         $(BENCH_V_GOC)go build -o a.out $(srcdir)/schedext/goroutine.go
    410 
    411 
    412406## =========================================================================================================
    413407
    414408creation$(EXEEXT) :                             \
    415         creation-cfa_generator.run              \
    416409        creation-cfa_coroutine.run              \
    417410        creation-cfa_coroutine_eager.run        \
     
    426419        creation-pthread.run
    427420
    428 creation-cfa_generator$(EXEEXT):
    429         $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_gen.cfa
    430 
    431421creation-cfa_coroutine$(EXEEXT):
    432422        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_cor.cfa
     
    460450        $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/creation/rust_thrd.rs
    461451
    462 creation-java_thread$(EXEEXT):
     452creation-java$(EXEEXT):
    463453        $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/creation/JavaThread.java
    464454        echo "#!/bin/sh" > a.out
  • benchmark/Makefile.in

    r5518719 r5cdeecd  
    427427ctxswitch_cfa_generator_DURATION = 5000000000
    428428ctxswitch_DURATION = 100000000
    429 
    430 #mutex_java_DURATION = 10000000
     429mutex_java_DURATION = 10000000
    431430mutex_DURATION = 50000000
    432 schedint_pthread_DURATION = 1000000
    433 schedint_java_DURATION = $(schedint_pthread_DURATION)
    434 schedint_rust_DURATION = $(schedint_pthread_DURATION)
    435 schedint_DURATION = 10000000
    436 schedext_DURATION = 10000000
     431signal_pthread_DURATION = 1000000
     432signal_java_DURATION = $(signal_pthread_DURATION)
     433signal_rust_DURATION = $(signal_pthread_DURATION)
     434signal_DURATION = 10000000
     435waitfor_DURATION = 10000000
    437436creation_pthread_DURATION = 250000
    438 creation_rust_thread_DURATION = ${creation_pthread_DURATION}
    439 creation_java_thread_DURATION = ${creation_pthread_DURATION}
     437creation_rust_DURATION = ${creation_pthread_DURATION}
    440438creation_cfa_coroutine_DURATION = 100000000
    441439creation_cfa_coroutine_eager_DURATION = 10000000
     
    786784.ONESHELL:              # use one shell to execute recipe
    787785.NOTPARALLEL:
    788 .PHONY: compile.csv basic.csv ctxswitch.csv mutex.csv schedint.csv
    789 
    790 all : basic$(EXEEXT) ctxswitch$(EXEEXT) mutex$(EXEEXT) schedint$(EXEEXT) schedext$(EXEEXT) creation$(EXEEXT)
     786.PHONY: compile.csv basic.csv ctxswitch.csv mutex.csv signal.csv
     787
     788all : basic$(EXEEXT) ctxswitch$(EXEEXT) mutex$(EXEEXT) signal$(EXEEXT) waitfor$(EXEEXT) creation$(EXEEXT)
    791789
    792790%.run : %$(EXEEXT) ${REPEAT}
     
    827825        +make mutex.csv
    828826        -+make mutex.diff.csv
    829         +make schedint.csv
    830         -+make schedint.diff.csv
     827        +make signal.csv
     828        -+make signal.diff.csv
    831829@DOifskipcompile@
    832830        cat compile.csv
     
    839837        cat mutex.csv
    840838        -cat mutex.diff.csv
    841         cat schedint.csv
    842         -cat schedint.diff.csv
     839        cat signal.csv
     840        -cat signal.diff.csv
    843841
    844842compile.csv:
     
    874872        $(srcdir)/fixcsv.sh $@
    875873
    876 schedint.csv:
    877         echo "schedint-1,schedint-2,schedext-1,schedext-2" > $@
    878         +make schedint-cfa1.runquiet >> $@ && echo -n ',' >> $@
    879         +make schedint-cfa2.runquiet >> $@ && echo -n ',' >> $@
    880         +make schedext-cfa1.runquiet >> $@ && echo -n ',' >> $@
    881         +make schedext-cfa2.runquiet >> $@
     874signal.csv:
     875        echo "signal-1,signal-2,waitfor-1,waitfor-2" > $@
     876        +make signal-cfa1.runquiet >> $@ && echo -n ',' >> $@
     877        +make signal-cfa2.runquiet >> $@ && echo -n ',' >> $@
     878        +make waitfor-cfa1.runquiet >> $@ && echo -n ',' >> $@
     879        +make waitfor-cfa2.runquiet >> $@
    882880        $(srcdir)/fixcsv.sh $@
    883881
     
    991989        chmod a+x a.out
    992990
    993 schedint$(EXEEXT) :             \
    994         schedint-cfa1.run       \
    995         schedint-cfa2.run       \
    996         schedint-cfa4.run       \
    997         schedint-upp.run        \
    998         schedint-rust.run       \
    999         schedint-java.run       \
    1000         schedint-pthread.run
    1001 
    1002 schedint-cfa1$(EXEEXT):
     991signal$(EXEEXT) :               \
     992        signal-cfa1.run         \
     993        signal-cfa2.run         \
     994        signal-cfa4.run         \
     995        signal-upp.run          \
     996        signal-rust.run         \
     997        signal-java.run         \
     998        signal-pthread.run
     999
     1000signal-pthread$(EXEEXT):
     1001        $(BENCH_V_CC)$(COMPILE) $(srcdir)/schedint/pthreads.c
     1002
     1003signal-upp$(EXEEXT):
     1004        $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedint/upp.cc
     1005
     1006signal-cfa1$(EXEEXT):
    10031007        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa1.cfa
    10041008
    1005 schedint-cfa2$(EXEEXT):
     1009signal-cfa2$(EXEEXT):
    10061010        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa2.cfa
    10071011
    1008 schedint-cfa4$(EXEEXT):
     1012signal-cfa4$(EXEEXT):
    10091013        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa4.cfa
    10101014
    1011 schedint-upp$(EXEEXT):
    1012         $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedint/upp.cc
    1013 
    1014 schedint-rust$(EXEEXT):
     1015signal-rust$(EXEEXT):
    10151016        $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/schedint/rust.rs
    10161017
    1017 schedint-java$(EXEEXT):
     1018signal-java$(EXEEXT):
    10181019        $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java
    10191020        echo "#!/bin/sh" > a.out
     
    10211022        chmod a+x a.out
    10221023
    1023 schedint-pthread$(EXEEXT):
    1024         $(BENCH_V_CC)$(COMPILE) $(srcdir)/schedint/pthreads.c
    1025 
    1026 schedext$(EXEEXT) :             \
    1027         schedext-cfa1.run       \
    1028         schedext-cfa2.run       \
    1029         schedext-cfa4.run       \
    1030         schedext-upp.run        \
    1031         schedext-goroutine.run
    1032 
    1033 schedext-cfa1$(EXEEXT):
     1024waitfor$(EXEEXT) :              \
     1025        waitfor-cfa1.run        \
     1026        waitfor-cfa2.run        \
     1027        waitfor-cfa4.run        \
     1028        waitfor-upp.run
     1029
     1030waitfor-upp$(EXEEXT):
     1031        $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedext/upp.cc
     1032
     1033waitfor-cfa1$(EXEEXT):
    10341034        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa1.cfa
    10351035
    1036 schedext-cfa2$(EXEEXT):
     1036waitfor-cfa2$(EXEEXT):
    10371037        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa2.cfa
    10381038
    1039 schedext-cfa4$(EXEEXT):
     1039waitfor-cfa4$(EXEEXT):
    10401040        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa4.cfa
    10411041
    1042 schedext-upp$(EXEEXT):
    1043         $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedext/upp.cc
    1044 
    1045 schedext-goroutine$(EXEEXT):
    1046         $(BENCH_V_GOC)go build -o a.out $(srcdir)/schedext/goroutine.go
    1047 
    10481042creation$(EXEEXT) :                             \
    1049         creation-cfa_generator.run              \
    10501043        creation-cfa_coroutine.run              \
    10511044        creation-cfa_coroutine_eager.run        \
     
    10601053        creation-pthread.run
    10611054
    1062 creation-cfa_generator$(EXEEXT):
    1063         $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_gen.cfa
    1064 
    10651055creation-cfa_coroutine$(EXEEXT):
    10661056        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_cor.cfa
     
    10941084        $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/creation/rust_thrd.rs
    10951085
    1096 creation-java_thread$(EXEEXT):
     1086creation-java$(EXEEXT):
    10971087        $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/creation/JavaThread.java
    10981088        echo "#!/bin/sh" > a.out
  • benchmark/creation/cfa_cor.cfa

    r5518719 r5cdeecd  
     1#include <stdio.h>
     2#include <coroutine.hfa>
     3
    14#include "bench.h"
    25
    3 typedef struct {
    4         void * next;
    5 } C;
     6coroutine MyCoroutine {};
     7void ?{}( MyCoroutine & this ) {
     8#ifdef EAGER
     9        resume( this );
     10#endif
     11}
     12void main( MyCoroutine & ) {}
    613
    714int main( int argc, char * argv[] ) {
     
    916        BENCH(
    1017                for ( times ) {
    11                         C c;
     18                        MyCoroutine c;
    1219                },
    1320                result
  • benchmark/schedext/cfa1.cfa

    r5518719 r5cdeecd  
    66#include "../bench.h"
    77
     8volatile int go = 0;
     9
    810monitor M {} m1;
    911
    1012void __attribute__((noinline)) call( M & mutex p1 ) {}
     13
    1114void __attribute__((noinline)) wait( M & mutex p1 ) {
     15        go = 1;
    1216        for ( times ) {
    1317                waitfor( call : p1 );
    1418        }
     19        go = 0;
    1520}
    1621
    1722thread T {};
    1823void main( T & ) {
     24        while ( go == 0 ) { yield(); }
    1925        BENCH(
    20                 for ( times ) { call( m1 ); },
     26                while ( go == 1 ) { call( m1 ); },
    2127                result
    2228        )
  • benchmark/schedext/cfa2.cfa

    r5518719 r5cdeecd  
    44#include <stdio.h>
    55
    6 #include "../bench.h"
     6#include "bench.h"
     7
     8volatile int go = 0;
    79
    810monitor M {} m1, m2;
    911
    1012void __attribute__((noinline)) call( M & mutex p1, M & mutex p2 ) {}
     13
    1114void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2 ) {
     15        go = 1;
    1216        for ( times ) {
    1317                waitfor( call : p1, p2 );
    1418        }
     19        go = 0;
    1520}
     21
    1622thread T {};
    1723void main( T & ) {
     24        while( go == 0 ) { yield(); }
    1825        BENCH(
    19                 for ( times ) {
    20                         call( m1, m2 );
    21                 },
     26                while ( go == 1 ) { call( m1, m2 ); },
    2227                result
    2328        )
  • benchmark/schedext/cfa4.cfa

    r5518719 r5cdeecd  
    44#include <stdio.h>
    55
    6 #include "../bench.h"
     6#include "bench.h"
     7
     8volatile int go = 0;
    79
    810monitor M {} m1, m2, m3, m4;
    911
    1012void __attribute__((noinline)) call( M & mutex p1, M & mutex p2, M & mutex p3, M & mutex p4 ) {}
     13
    1114void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2, M & mutex p3, M & mutex p4 ) {
     15        go = 1;
    1216        for ( times ) {
    1317                waitfor( call : p1, p2, p3, p4 );
    1418        }
     19        go = 0;
    1520}
     21
    1622thread T {};
    1723void main( T & ) {
     24        while( go == 0 ) { yield(); }
    1825        BENCH(
    19                 for ( times ) {
    20                         call( m1, m2, m3, m4 );
    21                 },
     26                while( go == 1 ) { call( m1, m2, m3, m4 ); },
    2227                result
    2328        )
  • benchmark/schedext/upp.cc

    r5518719 r5cdeecd  
    33#include "bench.h"
    44
     5volatile int go = 0;
     6
    57_Monitor M {
    68public:
    79        void __attribute__((noinline)) call() {}
    8         void __attribute__((noinline)) wait() {
     10
     11        int __attribute__((noinline)) wait() {
     12                go = 1;
    913                for ( size_t i = 0; i < times; i++ ) {
    1014                        _Accept(call);
    1115                }
     16                go = 0;
     17                return 0;
    1218        }
    1319} m;
     
    1521_Task T {
    1622        void main() {
     23                while ( go == 0 ) { yield(); }
    1724                BENCH(
    18                         for ( size_t i = 0; i < times; i++ ) {
    19                                 m.call();
    20                         },
     25                        while ( go == 1 ) { m.call(); },
    2126                        result
    2227                )
     
    2833        BENCH_START()
    2934        T t;
    30         m.wait();
     35        return m.wait();
    3136}
    3237
  • benchmark/schedint/JavaThread.java

    r5518719 r5cdeecd  
    6363                synchronized(m) {
    6464                        s.start();
    65                         while( ! Monitor.go ) { // waiter must start first
     65                        while( !Monitor.go ) {
    6666                                Thread.yield();
    6767                        }
  • benchmark/schedint/cfa1.cfa

    r5518719 r5cdeecd  
    77
    88volatile int go = 0;
    9 
    109condition c;
    1110monitor M {} m1;
     
    1413        signal( c );
    1514}
     15
    1616void __attribute__((noinline)) wait( M & mutex p1 ) {
    1717        go = 1;
     
    1919                wait( c );
    2020        }
     21        go = 0;
    2122}
    2223
    2324thread T {};
    2425void main( T & ) {
    25         while ( go == 0 ) { yield(); } // waiter must start first
     26        while ( go == 0 ) { yield(); }
    2627        BENCH(
    27                 for ( times ) { call( m1 ); },
     28                while ( go == 1 ) { call( m1 ); },
    2829                result
    2930        )
  • benchmark/schedint/cfa2.cfa

    r5518719 r5cdeecd  
    77
    88volatile int go = 0;
    9 
    109condition c;
    1110monitor M {} m1, m2;
     
    1413        signal( c );
    1514}
     15
    1616void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2 ) {
    1717        go = 1;
     
    1919                wait( c );
    2020        }
     21        go = 0;
    2122}
    2223
    2324thread T {};
    2425void main( T & ) {
    25         while ( go == 0 ) { yield(); } // waiter must start first
     26        while ( go == 0 ) { yield(); }
    2627        BENCH(
    27                 for ( times ) { call( m1, m2 ); },
     28                while ( go == 1 ) { call( m1, m2 ); },
    2829                result
    2930        )
  • benchmark/schedint/cfa4.cfa

    r5518719 r5cdeecd  
    44#include <stdio.h>
    55
    6 #include "../bench.h"
     6#include "bench.h"
    77
    88volatile int go = 0;
    9 
    109condition c;
    1110monitor M {} m1, m2, m3, m4;
     
    1413        signal( c );
    1514}
     15
    1616void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2, M & mutex p3, M & mutex p4 ) {
    1717        go = 1;
     
    1919                wait( c );
    2020        }
     21        go = 0;
    2122}
    2223
    2324thread T {};
    2425void main( T & ) {
    25         while ( go == 0 ) { yield(); } // waiter must start first
     26        while ( go == 0 ) { yield(); }
    2627        BENCH(
    27                 for ( times ) { call( m1, m2, m3, m4 ); },
     28                while ( go == 1 ) { call( m1, m2, m3, m4 ); },
    2829                result
    2930        )
  • benchmark/schedint/pthreads.c

    r5518719 r5cdeecd  
    66volatile int go = 0;
    77
     8pthread_cond_t c;
    89pthread_mutex_t m;
    9 pthread_cond_t c;
    1010
    1111void __attribute__((noinline)) call() {
    12         pthread_mutex_lock( &m );
    13         pthread_cond_signal( &c );
    14         pthread_mutex_unlock( &m );
     12        pthread_mutex_lock(&m);
     13        pthread_cond_signal(&c);
     14        pthread_mutex_unlock(&m);
    1515}
    1616
    17 void __attribute__((noinline)) wait() {
     17int __attribute__((noinline)) wait() {
    1818        pthread_mutex_lock(&m);
    1919        go = 1;
    20         for ( size_t i = 0; i < times; i++ ) {
    21                 pthread_cond_wait( &c, &m );
    22         }
    23         go = 0;
    24         pthread_mutex_unlock( &m );
    25 }
    26 
    27 void * thread_main( __attribute__((unused)) void * arg ) {
    28         while ( go == 0 ) { sched_yield(); } // waiter must start first
    29         // barging for lock acquire => may not execute N times
    3020        BENCH(
    31                 while ( go == 1 ) { call(); },
     21                for (size_t i = 0; i < times; i++) {
     22                        pthread_cond_wait(&c, &m);
     23                },
    3224                result
    3325        )
    3426        printf( "%g\n", result );
     27        go = 0;
     28        pthread_mutex_unlock(&m);
     29        return 0;
     30}
     31
     32void* thread_main(__attribute__((unused)) void * arg ) {
     33        while(go == 0) { sched_yield(); }
     34        while(go == 1) { call(); }
    3535        return NULL;
    3636}
     
    3939        BENCH_START()
    4040        pthread_t thread;
    41         if ( pthread_create( &thread, NULL, thread_main, NULL ) < 0 ) {
     41        if (pthread_create(&thread, NULL, thread_main, NULL) < 0) {
    4242                perror( "failure" );
    4343                return 1;
    4444        }
    4545        wait();
    46         if ( pthread_join( thread, NULL ) < 0 ) {
     46        if (pthread_join( thread, NULL) < 0) {
    4747                perror( "failure" );
    4848                return 1;
  • benchmark/schedint/rust.rs

    r5518719 r5cdeecd  
    1818
    1919        let th = thread::spawn( move || {
    20                 while *m2.lock().unwrap() == 0 { // waiter must start first
     20                while *m2.lock().unwrap() == 0 {
    2121                        thread::yield_now();
    2222                }
  • benchmark/schedint/upp.cc

    r5518719 r5cdeecd  
    1111                cond.signal();
    1212        }
    13         void __attribute__((noinline)) wait() {
     13
     14        int __attribute__((noinline)) wait() {
    1415                go = 1;
    15                 for ( size_t i = 0; i < times; i++ ) {
    16                         cond.wait();
    17                 }
    18         }
    19 } m;
    20 
    21 _Task T {
    22         void main() {
    23                 while ( go == 0 ) { yield(); } // waiter must start first
    2416                BENCH(
    25                         for ( size_t i = 0; i < times; i++ ) {
    26                                 m.call();
     17                        for (size_t i = 0; i < times; i++) {
     18                                cond.wait();
    2719                        },
    2820                        result
    2921                )
    3022                printf( "%g\n", result );
     23                go = 0;
     24                return 0;
     25        }
     26};
     27
     28M m;
     29
     30_Task T {
     31        void main() {
     32                while(go == 0) { yield(); }
     33                while(go == 1) { m.call(); }
     34
    3135        }
    3236};
     
    3539        BENCH_START()
    3640        T t;
    37         m.wait();
     41        return m.wait();
    3842}
    3943
Note: See TracChangeset for help on using the changeset viewer.