Changes in benchmark/mutex/JavaThread.java [b4107c8:be53b87]
- File:
-
- 1 edited
-
benchmark/mutex/JavaThread.java (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
benchmark/mutex/JavaThread.java
rb4107c8 rbe53b87 26 26 static int x = 2; 27 27 28 static private int times = Integer.parseInt("100000000");28 static private final int NoOfTimes = Integer.parseInt("100000000") ; 29 29 30 30 public synchronized void noop() { … … 35 35 // Inhibit biased locking ... 36 36 x = (j.hashCode() ^ System.identityHashCode(j)) | 1 ; 37 for(int i = 1; i <= times; i += 1) {37 for(int i = 1; i <= NoOfTimes; i += 1) { 38 38 x = nextRandom(x); 39 39 j.noop(); … … 44 44 helper(); 45 45 long end = System.nanoTime(); 46 System.out.println( (end - start) / times );46 System.out.println( (end - start) / NoOfTimes ); 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]); }51 52 49 for (int n = Integer.parseInt("5"); --n >= 0 ; ) { 53 50 InnerMain(); … … 58 55 } 59 56 } 60 61 // Local Variables: //62 // tab-width: 4 //63 // End: //
Note:
See TracChangeset
for help on using the changeset viewer.