Tweaks to microbenchmarks, one stall semaphore per thread changes have been backed...
[IRC.git] / Robust / src / Benchmarks / oooJava / micro / test.java
1 public class test {
2
3   public static void main( String argv[] ) {
4     
5     long count = 500000;
6     
7     if( argv.length > 0 ) {
8       count = count * Integer.parseInt( argv[0] );
9     }
10             
11     long s = System.currentTimeMillis();
12     long e1;
13     long e2;
14
15     rblock parent {
16       long x = 3;
17       long y = 0;
18       
19       for( long i = 0; i < count; i++ ) {
20
21         // the parent does a simple variable copy
22         // into this child's record at issue because
23         // the value is definitely available, the
24         // child needs the value read-only
25         rblock child {
26           if( x + 4 == -9 ) {
27           }
28         }
29       }
30       e1 = System.currentTimeMillis();
31       long z = 1;
32     }    
33     // just read vars so compile doesn't throw them out
34     // and force parent of parent to depend on z, for
35     // timing
36     System.out.println( "ignore: "+x+y+z );
37     e2 = System.currentTimeMillis();
38
39
40     double dt1 = ((double)e1-s)/(Math.pow( 10.0, 3.0 ) );
41     double dt2 = ((double)e2-s)/(Math.pow( 10.0, 3.0 ) );
42     System.out.println( "dt to parent done   ="+dt1+"s" );
43     System.out.println( "dt to parent retired="+dt2+"s" );
44   }
45 }