- Timestamp:
- Jan 7, 2021, 3:27:00 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 2b4daf2, 64aeca0
- Parents:
- 3c64c668 (diff), eef8dfb (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- benchmark
- Files:
-
- 41 added
- 1 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/Makefile.am
r3c64c668 r58fe85a 11 11 ## Created On : Sun May 31 09:08:15 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Sat Jan 25 09:20:44202014 ## Update Count : 25 513 ## Last Modified On : Tue Mar 10 11:41:18 2020 14 ## Update Count : 258 15 15 ############################################################################### 16 16 … … 19 19 20 20 # applies to both programs 21 include $(top_srcdir)/ src/cfa.make21 include $(top_srcdir)/tools/build/cfa.make 22 22 23 23 AM_CFLAGS = -O2 -Wall -Wextra -I$(srcdir) -lrt -pthread # -Werror … … 66 66 # Dummy hack tricks 67 67 EXTRA_PROGRAMS = dummy # build but do not install 68 dummy_SOURCES = dummyC.c dummyCXX.cpp68 nodist_dummy_SOURCES = dummyC.c dummyCXX.cpp 69 69 70 70 dummyC.c: … … 80 80 ## ========================================================================================================= 81 81 82 all : basic$(EXEEXT) ctxswitch$(EXEEXT) mutex$(EXEEXT) schedint$(EXEEXT) schedext$(EXEEXT) creation$(EXEEXT) 82 # all is used by make dist so ignore it 83 all: 84 85 all-bench : basic$(EXEEXT) ctxswitch$(EXEEXT) mutex$(EXEEXT) schedint$(EXEEXT) schedext$(EXEEXT) creation$(EXEEXT) 83 86 84 87 basic_loop_DURATION = 15000000000 … … 108 111 creation_cfa_coroutine_DURATION = 100000000 109 112 creation_cfa_coroutine_eager_DURATION = 10000000 113 creation_cfa_generator_DURATION = 1000000000 110 114 creation_upp_coroutine_DURATION = ${creation_cfa_coroutine_eager_DURATION} 111 creation_cfa_thread_DURATION = 10000000112 creation_upp_thread_DURATION = ${creation_cfa_thread_DURATION}113 115 creation_DURATION = 10000000 114 116 … … 144 146 145 147 cleancsv: 146 rm -f compile.csv basic.csv ctxswitch.csv mutex.csv sched uling.csv148 rm -f compile.csv basic.csv ctxswitch.csv mutex.csv schedint.csv 147 149 148 150 jenkins$(EXEEXT): cleancsv … … 155 157 +make mutex.csv 156 158 -+make mutex.diff.csv 157 +make sched uling.csv158 -+make sched uling.diff.csv159 +make schedint.csv 160 -+make schedint.diff.csv 159 161 @DOifskipcompile@ 160 162 cat compile.csv … … 165 167 cat mutex.csv 166 168 -cat mutex.diff.csv 167 cat sched uling.csv168 -cat sched uling.diff.csv169 cat schedint.csv 170 -cat schedint.diff.csv 169 171 170 172 compile.csv: … … 196 198 $(srcdir)/fixcsv.sh $@ 197 199 198 sched uling.csv:200 schedint.csv: 199 201 echo "building $@" 200 202 echo "schedint-1,schedint-2,schedext-1,schedext-2" > $@ … … 287 289 ctxswitch-python_coroutine$(EXEEXT): 288 290 $(BENCH_V_PY)echo "#!/bin/sh" > a.out 289 echo "python3 .7 $(srcdir)/ctxswitch/python_cor.py" >> a.out291 echo "python3 $(srcdir)/ctxswitch/python_cor.py \"$$""@\"" >> a.out 290 292 chmod a+x a.out 291 293 292 294 ctxswitch-nodejs_coroutine$(EXEEXT): 293 295 $(BENCH_V_NODEJS)echo "#!/bin/sh" > a.out 294 echo "nodejs $(srcdir)/ctxswitch/node_cor.js " >> a.out296 echo "nodejs $(srcdir)/ctxswitch/node_cor.js \"$$""@\"" >> a.out 295 297 chmod a+x a.out 296 298 297 299 ctxswitch-nodejs_await$(EXEEXT): 298 300 $(BENCH_V_NODEJS)echo "#!/bin/sh" > a.out 299 echo "nodejs $(srcdir)/ctxswitch/node_await.js " >> a.out301 echo "nodejs $(srcdir)/ctxswitch/node_await.js \"$$""@\"" >> a.out 300 302 chmod a+x a.out 301 303 … … 309 311 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/ctxswitch/JavaThread.java 310 312 echo "#!/bin/sh" > a.out 311 echo "java JavaThread " >> a.out313 echo "java JavaThread \"$$""@\"" >> a.out 312 314 chmod a+x a.out 313 315 … … 351 353 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/mutex/JavaThread.java 352 354 echo "#!/bin/sh" > a.out 353 echo "java JavaThread " >> a.out355 echo "java JavaThread \"$$""@\"" >> a.out 354 356 chmod a+x a.out 355 357 … … 383 385 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java 384 386 echo "#!/bin/sh" > a.out 385 echo "java JavaThread " >> a.out387 echo "java JavaThread \"$$""@\"" >> a.out 386 388 chmod a+x a.out 387 389 … … 450 452 creation-python_coroutine$(EXEEXT): 451 453 $(BENCH_V_PY)echo "#!/bin/sh" > a.out 452 echo "python3 .7 $(srcdir)/creation/python_cor.py" >> a.out454 echo "python3 $(srcdir)/creation/python_cor.py \"$$""@\"" >> a.out 453 455 chmod a+x a.out 454 456 455 457 creation-nodejs_coroutine$(EXEEXT): 456 458 $(BENCH_V_NODEJS)echo "#!/bin/sh" > a.out 457 echo "nodejs $(srcdir)/creation/node_cor.js " >> a.out459 echo "nodejs $(srcdir)/creation/node_cor.js \"$$""@\"" >> a.out 458 460 chmod a+x a.out 459 461 … … 467 469 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/creation/JavaThread.java 468 470 echo "#!/bin/sh" > a.out 469 echo "java JavaThread " >> a.out471 echo "java JavaThread \"$$""@\"" >> a.out 470 472 chmod a+x a.out 471 473 … … 475 477 ## ========================================================================================================= 476 478 477 compile$(EXEEXT) : \479 bcompile$(EXEEXT) : \ 478 480 compile-array.make \ 479 481 compile-attributes.make \ … … 488 490 489 491 compile-array$(EXEEXT): 490 $(CFACOMPILE) - fsyntax-only -w $(testdir)/array.cfa492 $(CFACOMPILE) -DNO_COMPILED_PRAGMA -fsyntax-only -w $(testdir)/array.cfa 491 493 492 494 compile-attributes$(EXEEXT): 493 $(CFACOMPILE) - fsyntax-only -w $(testdir)/attributes.cfa495 $(CFACOMPILE) -DNO_COMPILED_PRAGMA -fsyntax-only -w $(testdir)/attributes.cfa 494 496 495 497 compile-empty$(EXEEXT): 496 $(CFACOMPILE) - fsyntax-only -w $(srcdir)/compile/empty.cfa498 $(CFACOMPILE) -DNO_COMPILED_PRAGMA -fsyntax-only -w $(srcdir)/compile/empty.cfa 497 499 498 500 compile-expression$(EXEEXT): 499 $(CFACOMPILE) - fsyntax-only -w $(testdir)/expression.cfa501 $(CFACOMPILE) -DNO_COMPILED_PRAGMA -fsyntax-only -w $(testdir)/expression.cfa 500 502 501 503 compile-io$(EXEEXT): 502 $(CFACOMPILE) - fsyntax-only -w $(testdir)/io1.cfa504 $(CFACOMPILE) -DNO_COMPILED_PRAGMA -fsyntax-only -w $(testdir)/io1.cfa 503 505 504 506 compile-monitor$(EXEEXT): 505 $(CFACOMPILE) - fsyntax-only -w $(testdir)/concurrent/monitor.cfa507 $(CFACOMPILE) -DNO_COMPILED_PRAGMA -fsyntax-only -w $(testdir)/concurrent/monitor.cfa 506 508 507 509 compile-operators$(EXEEXT): 508 $(CFACOMPILE) - fsyntax-only -w $(testdir)/operators.cfa510 $(CFACOMPILE) -DNO_COMPILED_PRAGMA -fsyntax-only -w $(testdir)/operators.cfa 509 511 510 512 compile-thread$(EXEEXT): 511 $(CFACOMPILE) - fsyntax-only -w $(testdir)/concurrent/thread.cfa513 $(CFACOMPILE) -DNO_COMPILED_PRAGMA -fsyntax-only -w $(testdir)/concurrent/thread.cfa 512 514 513 515 compile-typeof$(EXEEXT): 514 $(CFACOMPILE) - fsyntax-only -w $(testdir)/typeof.cfa516 $(CFACOMPILE) -DNO_COMPILED_PRAGMA -fsyntax-only -w $(testdir)/typeof.cfa 515 517 516 518 ## ========================================================================================================= … … 520 522 size-cfa$(EXEEXT): 521 523 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/size/size.cfa 524 525 ## ========================================================================================================= 526 527 %-tokio$(EXEEXT): $(srcdir)/readyQ/%.rs $(srcdir)/bench.rs 528 cd $(builddir) && cargo build --release 529 cp $(builddir)/target/release/$(basename $@) $@ -
benchmark/creation/JavaThread.java
r3c64c668 r58fe85a 1 1 public class JavaThread { 2 2 // Simplistic low-quality Marsaglia Shift-XOR pseudo-random number generator. 3 // Bijective 3 // Bijective 4 4 // Cycle length for non-zero values is 4G-1. 5 5 // 0 is absorbing and should be avoided -- fixed point. 6 6 // The returned value is typically masked to produce a positive value. 7 static volatile int Ticket = 0 ; 7 static volatile int Ticket = 0 ; 8 8 9 9 private static int nextRandom (int x) { 10 if (x == 0) { 10 if (x == 0) { 11 11 // reseed the PRNG 12 // Ticket is accessed infrequently and does not constitute a coherence hot-spot. 13 // Note that we use a non-atomic racy increment -- the race is rare and benign. 14 // If the race is a concern switch to an AtomicInteger. 15 // In addition accesses to the RW volatile global "Ticket" variable are not 16 // (readily) predictable at compile-time so the JIT will not be able to elide 17 // nextRandom() invocations. 18 x = ++Ticket ; 19 if (x == 0) x = 1 ; 12 // Ticket is accessed infrequently and does not constitute a coherence hot-spot. 13 // Note that we use a non-atomic racy increment -- the race is rare and benign. 14 // If the race is a concern switch to an AtomicInteger. 15 // In addition accesses to the RW volatile global "Ticket" variable are not 16 // (readily) predictable at compile-time so the JIT will not be able to elide 17 // nextRandom() invocations. 18 x = ++Ticket ; 19 if (x == 0) x = 1 ; 20 20 } 21 21 x ^= x << 6; 22 22 x ^= x >>> 21; 23 23 x ^= x << 7; 24 return x ; 24 return x ; 25 25 } 26 26 static int x = 2; 27 27 28 static private int times = Integer.parseInt("10000") ;28 static private long times = Long.parseLong("10000") ; 29 29 30 30 public static class MyThread extends Thread { … … 33 33 } 34 34 public static void helper() throws InterruptedException { 35 for( inti = 1; i <= times; i += 1) {35 for(long i = 1; i <= times; i += 1) { 36 36 MyThread m = new MyThread(); 37 37 x = nextRandom( x ); … … 47 47 } 48 48 public static void main(String[] args) throws InterruptedException { 49 if ( args.length > 2) System.exit( 1 );50 if ( args.length == 2 ) { times = Integer.parseInt(args[1]); }49 if ( args.length > 1 ) System.exit( 1 ); 50 if ( args.length == 1 ) { times = Long.parseLong(args[0]); } 51 51 52 for (int i = Integer.parseInt("5"); --i >= 0 ; ) { 52 for (int i = Integer.parseInt("5"); --i >= 0 ; ) { 53 53 InnerMain(); 54 54 Thread.sleep(2000); // 2 seconds -
benchmark/creation/cfa_gen.cfa
r3c64c668 r58fe85a 1 #include " bench.h"1 #include "../bench.h" 2 2 3 struct C{3 generator G { 4 4 volatile int restart; // ensure compiler does not optimize away all the code 5 5 }; 6 void ?{}( C & c ) { c.restart = 0; }7 void main( C& ) {}6 void ?{}( G & g ) { g.restart = 0; } 7 void main( G & ) {} 8 8 9 9 int main( int argc, char * argv[] ) { … … 11 11 BENCH( 12 12 for ( times ) { 13 C c;13 G g; 14 14 }, 15 15 result -
benchmark/ctxswitch/JavaThread.java
r3c64c668 r58fe85a 1 1 public class JavaThread { 2 2 // Simplistic low-quality Marsaglia Shift-XOR pseudo-random number generator. 3 // Bijective 3 // Bijective 4 4 // Cycle length for non-zero values is 4G-1. 5 5 // 0 is absorbing and should be avoided -- fixed point. 6 6 // The returned value is typically masked to produce a positive value. 7 static volatile int Ticket = 0 ; 7 static volatile int Ticket = 0 ; 8 8 9 9 private static int nextRandom (int x) { 10 if (x == 0) { 10 if (x == 0) { 11 11 // reseed the PRNG 12 // Ticket is accessed infrequently and does not constitute a coherence hot-spot. 13 // Note that we use a non-atomic racy increment -- the race is rare and benign. 14 // If the race is a concern switch to an AtomicInteger. 15 // In addition accesses to the RW volatile global "Ticket" variable are not 16 // (readily) predictable at compile-time so the JIT will not be able to elide 17 // nextRandom() invocations. 18 x = ++Ticket ; 19 if (x == 0) x = 1 ; 12 // Ticket is accessed infrequently and does not constitute a coherence hot-spot. 13 // Note that we use a non-atomic racy increment -- the race is rare and benign. 14 // If the race is a concern switch to an AtomicInteger. 15 // In addition accesses to the RW volatile global "Ticket" variable are not 16 // (readily) predictable at compile-time so the JIT will not be able to elide 17 // nextRandom() invocations. 18 x = ++Ticket ; 19 if (x == 0) x = 1 ; 20 20 } 21 21 x ^= x << 6; 22 22 x ^= x >>> 21; 23 23 x ^= x << 7; 24 return x ; 24 return x ; 25 25 } 26 26 static int x = 2; 27 27 28 static private int times = Integer.parseInt("100000");28 static private long times = Long.parseLong("100000"); 29 29 30 30 public static void helper() { 31 for( inti = 1; i <= times; i += 1) {31 for(long i = 1; i <= times; i += 1) { 32 32 Thread.yield(); 33 33 } … … 40 40 } 41 41 public static void main(String[] args) throws InterruptedException { 42 if ( args.length > 2) System.exit( 1 );43 if ( args.length == 2 ) { times = Integer.parseInt(args[1]); }42 if ( args.length > 1 ) System.exit( 1 ); 43 if ( args.length == 1 ) { times = Long.parseLong(args[0]); } 44 44 45 45 for (int i = Integer.parseInt("5"); --i >= 0 ; ) { -
benchmark/ctxswitch/cfa_cor.cfa
r3c64c668 r58fe85a 2 2 #include <thread.hfa> 3 3 4 #include " bench.h"4 #include "../bench.h" 5 5 6 coroutine C {} c;6 coroutine C {}; 7 7 void main( __attribute__((unused)) C & ) { 8 while() {9 suspend ();8 for () { 9 suspend; 10 10 } 11 11 } 12 12 int main( int argc, char * argv[] ) { 13 C c; 13 14 BENCH_START() 14 15 BENCH( -
benchmark/ctxswitch/cfa_gen.cfa
r3c64c668 r58fe85a 1 1 #include "../bench.h" 2 2 3 typedef struct { 4 void * next; 5 } C; 6 7 void comain( C * c ) { 8 if ( __builtin_expect(c->next != 0, 1) ) goto *(c->next); 9 c->next = &&s1; 3 generator G {}; 4 void main( G & ) { 10 5 for () { 11 return; 12 s1: ; 6 suspend; 13 7 } 14 8 } 15 9 16 10 int main( int argc, char * argv[] ) { 11 G g; 17 12 BENCH_START() 18 C c = { 0 };19 13 BENCH( 20 14 for ( times ) { 21 comain( &c);15 resume( g ); 22 16 }, 23 17 result -
benchmark/exclude
r3c64c668 r58fe85a 10 10 interrupt_linux.c 11 11 exclude 12 io 12 13 Monitor.c -
benchmark/mutex/JavaThread.java
r3c64c668 r58fe85a 1 1 public class JavaThread { 2 2 // Simplistic low-quality Marsaglia Shift-XOR pseudo-random number generator. 3 // Bijective 3 // Bijective 4 4 // Cycle length for non-zero values is 4G-1. 5 5 // 0 is absorbing and should be avoided -- fixed point. 6 6 // The returned value is typically masked to produce a positive value. 7 static volatile int Ticket = 0 ; 7 static volatile int Ticket = 0 ; 8 8 9 9 private static int nextRandom (int x) { 10 if (x == 0) { 10 if (x == 0) { 11 11 // reseed the PRNG 12 // Ticket is accessed infrequently and does not constitute a coherence hot-spot. 13 // Note that we use a non-atomic racy increment -- the race is rare and benign. 14 // If the race is a concern switch to an AtomicInteger. 15 // In addition accesses to the RW volatile global "Ticket" variable are not 16 // (readily) predictable at compile-time so the JIT will not be able to elide 17 // nextRandom() invocations. 18 x = ++Ticket ; 19 if (x == 0) x = 1 ; 12 // Ticket is accessed infrequently and does not constitute a coherence hot-spot. 13 // Note that we use a non-atomic racy increment -- the race is rare and benign. 14 // If the race is a concern switch to an AtomicInteger. 15 // In addition accesses to the RW volatile global "Ticket" variable are not 16 // (readily) predictable at compile-time so the JIT will not be able to elide 17 // nextRandom() invocations. 18 x = ++Ticket ; 19 if (x == 0) x = 1 ; 20 20 } 21 21 x ^= x << 6; 22 22 x ^= x >>> 21; 23 23 x ^= x << 7; 24 return x ; 24 return x ; 25 25 } 26 26 static int x = 2; 27 27 28 static private int times = Integer.parseInt("100000000");28 static private long times = Long.parseLong("100000000"); 29 29 30 30 public synchronized void noop() { … … 34 34 JavaThread j = new JavaThread(); 35 35 // Inhibit biased locking ... 36 x = (j.hashCode() ^ System.identityHashCode(j)) | 1 ; 37 for( inti = 1; i <= times; i += 1) {36 x = (j.hashCode() ^ System.identityHashCode(j)) | 1 ; 37 for(long i = 1; i <= times; i += 1) { 38 38 x = nextRandom(x); 39 39 j.noop(); … … 47 47 } 48 48 public static void main(String[] args) throws InterruptedException { 49 if ( args.length > 2) System.exit( 1 );50 if ( args.length == 2 ) { times = Integer.parseInt(args[1]); }49 if ( args.length > 1 ) System.exit( 1 ); 50 if ( args.length == 1 ) { times = Long.parseLong(args[0]); } 51 51 52 for (int n = Integer.parseInt("5"); --n >= 0 ; ) { 52 for (int n = Integer.parseInt("5"); --n >= 0 ; ) { 53 53 InnerMain(); 54 54 Thread.sleep(2000); // 2 seconds -
benchmark/mutexC/JavaThread.java
r3c64c668 r58fe85a 1 1 class Noop { 2 2 // Simplistic low-quality Marsaglia Shift-XOR pseudo-random number generator. 3 // Bijective 3 // Bijective 4 4 // Cycle length for non-zero values is 4G-1. 5 5 // 0 is absorbing and should be avoided -- fixed point. 6 6 // The returned value is typically masked to produce a positive value. 7 static volatile int Ticket = 0 ; 7 static volatile int Ticket = 0 ; 8 8 9 9 public static int nextRandom( int x ) { 10 if (x == 0) { 10 if (x == 0) { 11 11 // reseed the PRNG 12 // Ticket is accessed infrequently and does not constitute a coherence hot-spot. 13 // Note that we use a non-atomic racy increment -- the race is rare and benign. 14 // If the race is a concern switch to an AtomicInteger. 15 // In addition accesses to the RW volatile global "Ticket" variable are not 16 // (readily) predictable at compile-time so the JIT will not be able to elide 17 // nextRandom() invocations. 18 x = ++Ticket ; 19 if (x == 0) x = 1 ; 12 // Ticket is accessed infrequently and does not constitute a coherence hot-spot. 13 // Note that we use a non-atomic racy increment -- the race is rare and benign. 14 // If the race is a concern switch to an AtomicInteger. 15 // In addition accesses to the RW volatile global "Ticket" variable are not 16 // (readily) predictable at compile-time so the JIT will not be able to elide 17 // nextRandom() invocations. 18 x = ++Ticket ; 19 if (x == 0) x = 1 ; 20 20 } 21 21 x ^= x << 6; 22 22 x ^= x >>> 21; 23 23 x ^= x << 7; 24 return x ; 24 return x ; 25 25 } 26 26 } … … 47 47 static int x = 2; 48 48 49 static private int times = Integer.parseInt("10000000");49 static private long times = Long.parseLong("10000000"); 50 50 51 51 public static void call( Monitor m ) throws InterruptedException { … … 53 53 m.go = true; 54 54 //while ( ! m.go2 ); 55 for ( inti = 0; i < times; i += 1 ) {55 for ( long i = 0; i < times; i += 1 ) { 56 56 m.call(); 57 57 x = Noop.nextRandom( x ); … … 71 71 public static void main( String[] args ) throws InterruptedException { 72 72 if ( args.length > 2 ) System.exit( 1 ); 73 if ( args.length == 2 ) { times = Integer.parseInt(args[1]); }73 if ( args.length == 2 ) { times = Long.parseLong(args[1]); } 74 74 75 if ( args.length > 2 ) System.exit( 1 ); 76 if ( args.length == 2 ) { times = Integer.parseInt(args[1]); } 77 78 for ( int i = Integer.parseInt("5"); --i >= 0 ; ) { 75 for ( int i = Integer.parseInt("5"); --i >= 0 ; ) { 79 76 InnerMain(); 80 77 // Thread.sleep(2000); // 2 seconds -
benchmark/schedint/JavaThread.java
r3c64c668 r58fe85a 24 24 public class JavaThread { 25 25 // Simplistic low-quality Marsaglia Shift-XOR pseudo-random number generator. 26 // Bijective 26 // Bijective 27 27 // Cycle length for non-zero values is 4G-1. 28 28 // 0 is absorbing and should be avoided -- fixed point. 29 29 // The returned value is typically masked to produce a positive value. 30 static volatile int Ticket = 0 ; 30 static volatile int Ticket = 0 ; 31 31 32 32 private static int nextRandom (int x) { 33 if (x == 0) { 33 if (x == 0) { 34 34 // reseed the PRNG 35 // Ticket is accessed infrequently and does not constitute a coherence hot-spot. 36 // Note that we use a non-atomic racy increment -- the race is rare and benign. 37 // If the race is a concern switch to an AtomicInteger. 38 // In addition accesses to the RW volatile global "Ticket" variable are not 39 // (readily) predictable at compile-time so the JIT will not be able to elide 40 // nextRandom() invocations. 41 x = ++Ticket ; 42 if (x == 0) x = 1 ; 35 // Ticket is accessed infrequently and does not constitute a coherence hot-spot. 36 // Note that we use a non-atomic racy increment -- the race is rare and benign. 37 // If the race is a concern switch to an AtomicInteger. 38 // In addition accesses to the RW volatile global "Ticket" variable are not 39 // (readily) predictable at compile-time so the JIT will not be able to elide 40 // nextRandom() invocations. 41 x = ++Ticket ; 42 if (x == 0) x = 1 ; 43 43 } 44 44 x ^= x << 6; 45 45 x ^= x >>> 21; 46 46 x ^= x << 7; 47 return x ; 47 return x ; 48 48 } 49 49 static int x = 2; 50 50 51 static private int times = Integer.parseInt("1000000");51 static private long times = Long.parseLong("1000000"); 52 52 53 53 public static void helper( Monitor m ) throws InterruptedException { 54 for( inti = 1; i <= times; i += 1) {54 for(long i = 1; i <= times; i += 1) { 55 55 m.wait(); // relase monitor lock 56 56 m.next = true; … … 75 75 } 76 76 public static void main(String[] args) throws InterruptedException { 77 if ( args.length > 2) System.exit( 1 );78 if ( args.length == 2 ) { times = Integer.parseInt(args[1]); }77 if ( args.length > 1 ) System.exit( 1 ); 78 if ( args.length == 1 ) { times = Long.parseLong(args[0]); } 79 79 80 for (int n = Integer.parseInt("5"); --n >= 0 ; ) { 80 for (int n = Integer.parseInt("5"); --n >= 0 ; ) { 81 81 InnerMain(); 82 82 Thread.sleep(2000); // 2 seconds
Note:
See TracChangeset
for help on using the changeset viewer.