keep a copy of my current dissertation example to investiaget further and another...
[IRC.git] / Robust / src / Benchmarks / oooJava / micro2 / 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 y = 0;
17       
18       for( long i = 0; i < count; i++ ) {
19
20         // the subsequent sibling has a dependence
21         // on the first
22         rblock child1 {
23           long x = 3;
24         }
25
26         rblock child2 {
27           if( x + 4 == -9 ) {
28             //++y;
29           }
30         }
31
32       }
33       e1 = System.currentTimeMillis();
34       long z = 1;
35     }
36     // just read vars so compile doesn't throw them out
37     // and force parent of parent to depend on z, for
38     // timing
39     System.out.println( "ignore: "+z );
40     e2 = System.currentTimeMillis();
41
42
43     double dt1 = ((double)e1-s)/(Math.pow( 10.0, 3.0 ) );
44     double dt2 = ((double)e2-s)/(Math.pow( 10.0, 3.0 ) );
45     System.out.println( "dt to parent done   ="+dt1+"s" );
46     System.out.println( "dt to parent retired="+dt2+"s" );
47   }
48 }