ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/loops/LockLoops.java
(Generate patch)

Comparing jsr166/src/test/loops/LockLoops.java (file contents):
Revision 1.1 by dl, Mon May 2 19:19:38 2005 UTC vs.
Revision 1.4 by jsr166, Tue Nov 3 01:04:02 2009 UTC

# Line 1 | Line 1
1   /*
2 + * Written by Doug Lea with assistance from members of JCP JSR-166
3 + * Expert Group and released to the public domain, as explained at
4 + * http://creativecommons.org/licenses/publicdomain
5 + */
6 + /*
7   * A simple test program. Feel free to play.
8   */
9  
# Line 20 | Line 25 | public final class LockLoops {
25          int iters = 1000000;
26          int replications = 1;
27  
28 <        if (args.length > 0)
28 >        if (args.length > 0)
29              maxThreads = Integer.parseInt(args[0]);
30  
31 <        if (args.length > 1)
31 >        if (args.length > 1)
32              iters = Integer.parseInt(args[1]);
33  
34 <        if (args.length > 2)
34 >        if (args.length > 2)
35              replications = Integer.parseInt(args[2]);
36  
37          rng.setSeed(3122688L);
# Line 137 | Line 142 | public final class LockLoops {
142              v = initialValue;
143              this.iters = iters;
144              barrier = new CyclicBarrier(nthreads+1, timer);
145 <            for (int i = 0; i < nthreads; ++i)
145 >            for (int i = 0; i < nthreads; ++i)
146                  pool.execute(this);
147              barrier.await();
148              barrier.await();
# Line 145 | Line 150 | public final class LockLoops {
150              if (print) {
151                  long tpi = time / (iters * nthreads);
152                  System.out.print("\t" + LoopHelpers.rightJustify(tpi) + " ns per update");
153 <                //                double secs = (double)(time) / 1000000000.0;
153 >                //                double secs = (double) time / 1000000000.0;
154                  //                System.out.print("\t " + secs + "s run time");
155                  System.out.println();
156              }
# Line 156 | Line 161 | public final class LockLoops {
161          abstract int loop(int n);
162          public final void run() {
163              try {
164 <                barrier.await();
164 >                barrier.await();
165                  result += loop(iters);
166                  barrier.await();
167              }
168 <            catch (Exception ie) {
169 <                return;
168 >            catch (Exception ie) {
169 >                return;
170              }
171          }
172  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines