- Timestamp:
- Jan 21, 2020, 6:14:34 PM (5 years ago)
- 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:
- 5518719
- Parents:
- c12869e
- Location:
- benchmark
- Files:
-
- 2 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/Makefile.am
rc12869e r26fd986 11 11 ## Created On : Sun May 31 09:08:15 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Mon Jan 20 11:50:13202014 ## Update Count : 2 4413 ## Last Modified On : Tue Jan 21 17:56:31 2020 14 ## Update Count : 250 15 15 ############################################################################### 16 16 … … 75 75 .ONESHELL: # use one shell to execute recipe 76 76 .NOTPARALLEL: 77 .PHONY: compile.csv basic.csv ctxswitch.csv mutex.csv s ignal.csv78 79 ## ========================================================================================================= 80 81 all : basic$(EXEEXT) ctxswitch$(EXEEXT) mutex$(EXEEXT) s ignal$(EXEEXT) waitfor$(EXEEXT) creation$(EXEEXT)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) 82 82 83 83 basic_loop_DURATION = 15000000000 … … 91 91 ctxswitch_DURATION = 100000000 92 92 93 mutex_java_DURATION = 1000000093 #mutex_java_DURATION = 10000000 94 94 mutex_DURATION = 50000000 95 95 96 s ignal_pthread_DURATION = 100000097 s ignal_java_DURATION = $(signal_pthread_DURATION)98 s ignal_rust_DURATION = $(signal_pthread_DURATION)99 s ignal_DURATION = 10000000100 101 waitfor_DURATION = 1000000096 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 102 102 103 103 creation_pthread_DURATION = 250000 104 creation_rust_DURATION = ${creation_pthread_DURATION} 104 creation_rust_thread_DURATION = ${creation_pthread_DURATION} 105 creation_java_thread_DURATION = ${creation_pthread_DURATION} 105 106 creation_cfa_coroutine_DURATION = 100000000 106 107 creation_cfa_coroutine_eager_DURATION = 10000000 … … 151 152 +make mutex.csv 152 153 -+make mutex.diff.csv 153 +make s ignal.csv154 -+make s ignal.diff.csv154 +make schedint.csv 155 -+make schedint.diff.csv 155 156 @DOifskipcompile@ 156 157 cat compile.csv … … 163 164 cat mutex.csv 164 165 -cat mutex.diff.csv 165 cat s ignal.csv166 -cat s ignal.diff.csv166 cat schedint.csv 167 -cat schedint.diff.csv 167 168 168 169 compile.csv: … … 198 199 $(srcdir)/fixcsv.sh $@ 199 200 200 s ignal.csv:201 echo "s ignal-1,signal-2,waitfor-1,waitfor-2" > $@202 +make s ignal-cfa1.runquiet >> $@ && echo -n ',' >> $@203 +make s ignal-cfa2.runquiet >> $@ && echo -n ',' >> $@204 +make waitfor-cfa1.runquiet >> $@ && echo -n ',' >> $@205 +make waitfor-cfa2.runquiet >> $@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 >> $@ 206 207 $(srcdir)/fixcsv.sh $@ 207 208 … … 351 352 ## ========================================================================================================= 352 353 353 signal$(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 362 signal-pthread$(EXEEXT): 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): 364 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa1.cfa 365 366 schedint-cfa2$(EXEEXT): 367 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa2.cfa 368 369 schedint-cfa4$(EXEEXT): 370 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa4.cfa 371 372 schedint-upp$(EXEEXT): 373 $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedint/upp.cc 374 375 schedint-rust$(EXEEXT): 376 $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/schedint/rust.rs 377 378 schedint-java$(EXEEXT): 379 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java 380 echo "#!/bin/sh" > a.out 381 echo "java JavaThread" >> a.out 382 chmod a+x a.out 383 384 schedint-pthread$(EXEEXT): 363 385 $(BENCH_V_CC)$(COMPILE) $(srcdir)/schedint/pthreads.c 364 386 365 signal-upp$(EXEEXT): 366 $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedint/upp.cc 367 368 signal-cfa1$(EXEEXT): 369 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa1.cfa 370 371 signal-cfa2$(EXEEXT): 372 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa2.cfa 373 374 signal-cfa4$(EXEEXT): 375 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa4.cfa 376 377 signal-rust$(EXEEXT): 378 $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/schedint/rust.rs 379 380 signal-java$(EXEEXT): 381 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java 382 echo "#!/bin/sh" > a.out 383 echo "java JavaThread" >> a.out 384 chmod a+x a.out 385 386 ## ========================================================================================================= 387 388 waitfor$(EXEEXT) : \ 389 waitfor-cfa1.run \ 390 waitfor-cfa2.run \ 391 waitfor-cfa4.run \ 392 waitfor-upp.run 393 394 waitfor-upp$(EXEEXT): 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): 397 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa1.cfa 398 399 schedext-cfa2$(EXEEXT): 400 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa2.cfa 401 402 schedext-cfa4$(EXEEXT): 403 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa4.cfa 404 405 schedext-upp$(EXEEXT): 395 406 $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedext/upp.cc 396 407 397 waitfor-cfa1$(EXEEXT): 398 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa1.cfa 399 400 waitfor-cfa2$(EXEEXT): 401 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa2.cfa 402 403 waitfor-cfa4$(EXEEXT): 404 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa4.cfa 408 schedext-goroutine$(EXEEXT): 409 $(BENCH_V_GOC)go build -o a.out $(srcdir)/schedext/goroutine.go 410 405 411 406 412 ## ========================================================================================================= 407 413 408 414 creation$(EXEEXT) : \ 415 creation-cfa_generator.run \ 409 416 creation-cfa_coroutine.run \ 410 417 creation-cfa_coroutine_eager.run \ … … 419 426 creation-pthread.run 420 427 428 creation-cfa_generator$(EXEEXT): 429 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_gen.cfa 430 421 431 creation-cfa_coroutine$(EXEEXT): 422 432 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_cor.cfa … … 450 460 $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/creation/rust_thrd.rs 451 461 452 creation-java $(EXEEXT):462 creation-java_thread$(EXEEXT): 453 463 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/creation/JavaThread.java 454 464 echo "#!/bin/sh" > a.out -
benchmark/Makefile.in
rc12869e r26fd986 427 427 ctxswitch_cfa_generator_DURATION = 5000000000 428 428 ctxswitch_DURATION = 100000000 429 mutex_java_DURATION = 10000000 429 430 #mutex_java_DURATION = 10000000 430 431 mutex_DURATION = 50000000 431 s ignal_pthread_DURATION = 1000000432 s ignal_java_DURATION = $(signal_pthread_DURATION)433 s ignal_rust_DURATION = $(signal_pthread_DURATION)434 s ignal_DURATION = 10000000435 waitfor_DURATION = 10000000432 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 436 437 creation_pthread_DURATION = 250000 437 creation_rust_DURATION = ${creation_pthread_DURATION} 438 creation_rust_thread_DURATION = ${creation_pthread_DURATION} 439 creation_java_thread_DURATION = ${creation_pthread_DURATION} 438 440 creation_cfa_coroutine_DURATION = 100000000 439 441 creation_cfa_coroutine_eager_DURATION = 10000000 … … 784 786 .ONESHELL: # use one shell to execute recipe 785 787 .NOTPARALLEL: 786 .PHONY: compile.csv basic.csv ctxswitch.csv mutex.csv s ignal.csv787 788 all : basic$(EXEEXT) ctxswitch$(EXEEXT) mutex$(EXEEXT) s ignal$(EXEEXT) waitfor$(EXEEXT) creation$(EXEEXT)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) 789 791 790 792 %.run : %$(EXEEXT) ${REPEAT} … … 825 827 +make mutex.csv 826 828 -+make mutex.diff.csv 827 +make s ignal.csv828 -+make s ignal.diff.csv829 +make schedint.csv 830 -+make schedint.diff.csv 829 831 @DOifskipcompile@ 830 832 cat compile.csv … … 837 839 cat mutex.csv 838 840 -cat mutex.diff.csv 839 cat s ignal.csv840 -cat s ignal.diff.csv841 cat schedint.csv 842 -cat schedint.diff.csv 841 843 842 844 compile.csv: … … 872 874 $(srcdir)/fixcsv.sh $@ 873 875 874 s ignal.csv:875 echo "s ignal-1,signal-2,waitfor-1,waitfor-2" > $@876 +make s ignal-cfa1.runquiet >> $@ && echo -n ',' >> $@877 +make s ignal-cfa2.runquiet >> $@ && echo -n ',' >> $@878 +make waitfor-cfa1.runquiet >> $@ && echo -n ',' >> $@879 +make waitfor-cfa2.runquiet >> $@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 >> $@ 880 882 $(srcdir)/fixcsv.sh $@ 881 883 … … 989 991 chmod a+x a.out 990 992 991 signal$(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 1000 signal-pthread$(EXEEXT): 1001 $(BENCH_V_CC)$(COMPILE) $(srcdir)/schedint/pthreads.c 1002 1003 signal-upp$(EXEEXT): 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): 1003 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa1.cfa 1004 1005 schedint-cfa2$(EXEEXT): 1006 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa2.cfa 1007 1008 schedint-cfa4$(EXEEXT): 1009 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa4.cfa 1010 1011 schedint-upp$(EXEEXT): 1004 1012 $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedint/upp.cc 1005 1013 1006 signal-cfa1$(EXEEXT): 1007 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa1.cfa 1008 1009 signal-cfa2$(EXEEXT): 1010 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa2.cfa 1011 1012 signal-cfa4$(EXEEXT): 1013 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa4.cfa 1014 1015 signal-rust$(EXEEXT): 1014 schedint-rust$(EXEEXT): 1016 1015 $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/schedint/rust.rs 1017 1016 1018 s ignal-java$(EXEEXT):1017 schedint-java$(EXEEXT): 1019 1018 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java 1020 1019 echo "#!/bin/sh" > a.out … … 1022 1021 chmod a+x a.out 1023 1022 1024 waitfor$(EXEEXT) : \ 1025 waitfor-cfa1.run \ 1026 waitfor-cfa2.run \ 1027 waitfor-cfa4.run \ 1028 waitfor-upp.run 1029 1030 waitfor-upp$(EXEEXT): 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): 1034 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa1.cfa 1035 1036 schedext-cfa2$(EXEEXT): 1037 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa2.cfa 1038 1039 schedext-cfa4$(EXEEXT): 1040 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa4.cfa 1041 1042 schedext-upp$(EXEEXT): 1031 1043 $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedext/upp.cc 1032 1044 1033 waitfor-cfa1$(EXEEXT): 1034 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa1.cfa 1035 1036 waitfor-cfa2$(EXEEXT): 1037 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa2.cfa 1038 1039 waitfor-cfa4$(EXEEXT): 1040 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa4.cfa 1045 schedext-goroutine$(EXEEXT): 1046 $(BENCH_V_GOC)go build -o a.out $(srcdir)/schedext/goroutine.go 1041 1047 1042 1048 creation$(EXEEXT) : \ 1049 creation-cfa_generator.run \ 1043 1050 creation-cfa_coroutine.run \ 1044 1051 creation-cfa_coroutine_eager.run \ … … 1053 1060 creation-pthread.run 1054 1061 1062 creation-cfa_generator$(EXEEXT): 1063 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_gen.cfa 1064 1055 1065 creation-cfa_coroutine$(EXEEXT): 1056 1066 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_cor.cfa … … 1084 1094 $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/creation/rust_thrd.rs 1085 1095 1086 creation-java $(EXEEXT):1096 creation-java_thread$(EXEEXT): 1087 1097 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/creation/JavaThread.java 1088 1098 echo "#!/bin/sh" > a.out -
benchmark/creation/cfa_cor.cfa
rc12869e r26fd986 1 #include <stdio.h>2 #include <coroutine.hfa>3 4 1 #include "bench.h" 5 2 6 coroutine MyCoroutine {}; 7 void ?{}( MyCoroutine & this ) { 8 #ifdef EAGER 9 resume( this ); 10 #endif 11 } 12 void main( MyCoroutine & ) {} 3 typedef struct { 4 void * next; 5 } C; 13 6 14 7 int main( int argc, char * argv[] ) { … … 16 9 BENCH( 17 10 for ( times ) { 18 MyCoroutinec;11 C c; 19 12 }, 20 13 result -
benchmark/schedext/cfa1.cfa
rc12869e r26fd986 6 6 #include "../bench.h" 7 7 8 volatile int go = 0;9 10 8 monitor M {} m1; 11 9 12 10 void __attribute__((noinline)) call( M & mutex p1 ) {} 13 14 11 void __attribute__((noinline)) wait( M & mutex p1 ) { 15 go = 1;16 12 for ( times ) { 17 13 waitfor( call : p1 ); 18 14 } 19 go = 0;20 15 } 21 16 22 17 thread T {}; 23 18 void main( T & ) { 24 while ( go == 0 ) { yield(); }25 19 BENCH( 26 while ( go == 1) { call( m1 ); },20 for ( times ) { call( m1 ); }, 27 21 result 28 22 ) -
benchmark/schedext/cfa2.cfa
rc12869e r26fd986 4 4 #include <stdio.h> 5 5 6 #include "bench.h" 7 8 volatile int go = 0; 6 #include "../bench.h" 9 7 10 8 monitor M {} m1, m2; 11 9 12 10 void __attribute__((noinline)) call( M & mutex p1, M & mutex p2 ) {} 13 14 11 void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2 ) { 15 go = 1;16 12 for ( times ) { 17 13 waitfor( call : p1, p2 ); 18 14 } 19 go = 0;20 15 } 21 22 16 thread T {}; 23 17 void main( T & ) { 24 while( go == 0 ) { yield(); }25 18 BENCH( 26 while ( go == 1 ) { call( m1, m2 ); }, 19 for ( times ) { 20 call( m1, m2 ); 21 }, 27 22 result 28 23 ) -
benchmark/schedext/cfa4.cfa
rc12869e r26fd986 4 4 #include <stdio.h> 5 5 6 #include "bench.h" 7 8 volatile int go = 0; 6 #include "../bench.h" 9 7 10 8 monitor M {} m1, m2, m3, m4; 11 9 12 10 void __attribute__((noinline)) call( M & mutex p1, M & mutex p2, M & mutex p3, M & mutex p4 ) {} 13 14 11 void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2, M & mutex p3, M & mutex p4 ) { 15 go = 1;16 12 for ( times ) { 17 13 waitfor( call : p1, p2, p3, p4 ); 18 14 } 19 go = 0;20 15 } 21 22 16 thread T {}; 23 17 void main( T & ) { 24 while( go == 0 ) { yield(); }25 18 BENCH( 26 while( go == 1 ) { call( m1, m2, m3, m4 ); }, 19 for ( times ) { 20 call( m1, m2, m3, m4 ); 21 }, 27 22 result 28 23 ) -
benchmark/schedext/upp.cc
rc12869e r26fd986 3 3 #include "bench.h" 4 4 5 volatile int go = 0;6 7 5 _Monitor M { 8 6 public: 9 7 void __attribute__((noinline)) call() {} 10 11 int __attribute__((noinline)) wait() { 12 go = 1; 8 void __attribute__((noinline)) wait() { 13 9 for ( size_t i = 0; i < times; i++ ) { 14 10 _Accept(call); 15 11 } 16 go = 0;17 return 0;18 12 } 19 13 } m; … … 21 15 _Task T { 22 16 void main() { 23 while ( go == 0 ) { yield(); }24 17 BENCH( 25 while ( go == 1 ) { m.call(); }, 18 for ( size_t i = 0; i < times; i++ ) { 19 m.call(); 20 }, 26 21 result 27 22 ) … … 33 28 BENCH_START() 34 29 T t; 35 returnm.wait();30 m.wait(); 36 31 } 37 32 -
benchmark/schedint/JavaThread.java
rc12869e r26fd986 63 63 synchronized(m) { 64 64 s.start(); 65 while( ! Monitor.go ) {65 while( ! Monitor.go ) { // waiter must start first 66 66 Thread.yield(); 67 67 } -
benchmark/schedint/cfa1.cfa
rc12869e r26fd986 7 7 8 8 volatile int go = 0; 9 9 10 condition c; 10 11 monitor M {} m1; … … 13 14 signal( c ); 14 15 } 15 16 16 void __attribute__((noinline)) wait( M & mutex p1 ) { 17 17 go = 1; … … 19 19 wait( c ); 20 20 } 21 go = 0;22 21 } 23 22 24 23 thread T {}; 25 24 void main( T & ) { 26 while ( go == 0 ) { yield(); } 25 while ( go == 0 ) { yield(); } // waiter must start first 27 26 BENCH( 28 while ( go == 1) { call( m1 ); },27 for ( times ) { call( m1 ); }, 29 28 result 30 29 ) -
benchmark/schedint/cfa2.cfa
rc12869e r26fd986 7 7 8 8 volatile int go = 0; 9 9 10 condition c; 10 11 monitor M {} m1, m2; … … 13 14 signal( c ); 14 15 } 15 16 16 void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2 ) { 17 17 go = 1; … … 19 19 wait( c ); 20 20 } 21 go = 0;22 21 } 23 22 24 23 thread T {}; 25 24 void main( T & ) { 26 while ( go == 0 ) { yield(); } 25 while ( go == 0 ) { yield(); } // waiter must start first 27 26 BENCH( 28 while ( go == 1) { call( m1, m2 ); },27 for ( times ) { call( m1, m2 ); }, 29 28 result 30 29 ) -
benchmark/schedint/cfa4.cfa
rc12869e r26fd986 4 4 #include <stdio.h> 5 5 6 #include " bench.h"6 #include "../bench.h" 7 7 8 8 volatile int go = 0; 9 9 10 condition c; 10 11 monitor M {} m1, m2, m3, m4; … … 13 14 signal( c ); 14 15 } 15 16 16 void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2, M & mutex p3, M & mutex p4 ) { 17 17 go = 1; … … 19 19 wait( c ); 20 20 } 21 go = 0;22 21 } 23 22 24 23 thread T {}; 25 24 void main( T & ) { 26 while ( go == 0 ) { yield(); } 25 while ( go == 0 ) { yield(); } // waiter must start first 27 26 BENCH( 28 while ( go == 1) { call( m1, m2, m3, m4 ); },27 for ( times ) { call( m1, m2, m3, m4 ); }, 29 28 result 30 29 ) -
benchmark/schedint/pthreads.c
rc12869e r26fd986 6 6 volatile int go = 0; 7 7 8 pthread_mutex_t m; 8 9 pthread_cond_t c; 9 pthread_mutex_t m;10 10 11 11 void __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 ); 15 15 } 16 16 17 int__attribute__((noinline)) wait() {17 void __attribute__((noinline)) wait() { 18 18 pthread_mutex_lock(&m); 19 19 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 20 30 BENCH( 21 for (size_t i = 0; i < times; i++) { 22 pthread_cond_wait(&c, &m); 23 }, 31 while ( go == 1 ) { call(); }, 24 32 result 25 33 ) 26 34 printf( "%g\n", result ); 27 go = 0;28 pthread_mutex_unlock(&m);29 return 0;30 }31 32 void* thread_main(__attribute__((unused)) void * arg ) {33 while(go == 0) { sched_yield(); }34 while(go == 1) { call(); }35 35 return NULL; 36 36 } … … 39 39 BENCH_START() 40 40 pthread_t thread; 41 if ( pthread_create(&thread, NULL, thread_main, NULL) < 0) {41 if ( pthread_create( &thread, NULL, thread_main, NULL ) < 0 ) { 42 42 perror( "failure" ); 43 43 return 1; 44 44 } 45 45 wait(); 46 if ( pthread_join( thread, NULL) < 0) {46 if ( pthread_join( thread, NULL ) < 0 ) { 47 47 perror( "failure" ); 48 48 return 1; -
benchmark/schedint/rust.rs
rc12869e r26fd986 18 18 19 19 let th = thread::spawn( move || { 20 while *m2.lock().unwrap() == 0 { 20 while *m2.lock().unwrap() == 0 { // waiter must start first 21 21 thread::yield_now(); 22 22 } -
benchmark/schedint/upp.cc
rc12869e r26fd986 11 11 cond.signal(); 12 12 } 13 void __attribute__((noinline)) wait() { 14 go = 1; 15 for ( size_t i = 0; i < times; i++ ) { 16 cond.wait(); 17 } 18 } 19 } m; 13 20 14 int __attribute__((noinline)) wait() { 15 go = 1; 21 _Task T { 22 void main() { 23 while ( go == 0 ) { yield(); } // waiter must start first 16 24 BENCH( 17 for ( size_t i = 0; i < times; i++) {18 cond.wait();25 for ( size_t i = 0; i < times; i++ ) { 26 m.call(); 19 27 }, 20 28 result 21 29 ) 22 30 printf( "%g\n", result ); 23 go = 0;24 return 0;25 }26 };27 28 M m;29 30 _Task T {31 void main() {32 while(go == 0) { yield(); }33 while(go == 1) { m.call(); }34 35 31 } 36 32 }; … … 39 35 BENCH_START() 40 36 T t; 41 returnm.wait();37 m.wait(); 42 38 } 43 39
Note: See TracChangeset
for help on using the changeset viewer.