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

Comparing jsr166/src/test/loops/ConcurrentQueueLoops.java (file contents):
Revision 1.6 by dl, Fri Oct 23 19:57:06 2009 UTC vs.
Revision 1.7 by jsr166, Thu Oct 29 23:09:07 2009 UTC

# Line 30 | Line 30 | public class ConcurrentQueueLoops {
30              }
31          }
32  
33 <        if (args.length > 1)
33 >        if (args.length > 1)
34              maxStages = Integer.parseInt(args[1]);
35  
36 <        if (args.length > 2)
36 >        if (args.length > 2)
37              work = Integer.parseInt(args[2]);
38  
39          workMask = work - 1;
# Line 56 | Line 56 | public class ConcurrentQueueLoops {
56              if (i == k) {
57                  k = i << 1;
58                  i = i + (i >>> 1);
59 <            }
60 <            else
59 >            }
60 >            else
61                  i = k;
62          }
63          pool.shutdown();
# Line 68 | Line 68 | public class ConcurrentQueueLoops {
68          final CyclicBarrier barrier;
69          final int nthreads;
70          Stage (Queue<Integer> q, CyclicBarrier b, int nthreads) {
71 <            queue = q;
71 >            queue = q;
72              barrier = b;
73              this.nthreads = nthreads;
74          }
75  
76          static int compute(int l) {
77 <            if (l == 0)
77 >            if (l == 0)
78                  return (int)System.nanoTime();
79              int nn =  (l >>> 7) & workMask;
80 <            while (nn-- > 0)
80 >            while (nn-- > 0)
81                  l = LoopHelpers.compute6(l);
82              return l;
83          }
# Line 110 | Line 110 | public class ConcurrentQueueLoops {
110                      }
111                  }
112              }
113 <            catch (Exception ie) {
113 >            catch (Exception ie) {
114                  ie.printStackTrace();
115                  throw new Error("Call loop failed");
116              }
# Line 122 | Line 122 | public class ConcurrentQueueLoops {
122          LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer();
123          CyclicBarrier barrier = new CyclicBarrier(n + 1, timer);
124          ArrayList<Future<Integer>> results = new ArrayList<Future<Integer>>(n);
125 <        for (int i = 0; i < n; ++i)
125 >        for (int i = 0; i < n; ++i)
126              results.add(pool.submit(new Stage(q, barrier, n)));
127  
128          if (print)
# Line 137 | Line 137 | public class ConcurrentQueueLoops {
137          long endTime = System.nanoTime();
138          long time = endTime - timer.startTime;
139          long ips = 1000000000L * total / time;
140 <        
141 <        if (print)
140 >
141 >        if (print)
142              System.out.print(LoopHelpers.rightJustify(ips) + " items per sec");
143          if (print)
144              System.out.println();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines