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.13 by jsr166, Thu Apr 14 23:16:10 2011 UTC vs.
Revision 1.17 by jsr166, Wed Dec 31 17:00:58 2014 UTC

# Line 6 | Line 6
6  
7   import java.util.*;
8   import java.util.concurrent.*;
9 import java.util.concurrent.locks.*;
9   import java.util.concurrent.atomic.*;
10 + import java.util.concurrent.locks.*;
11  
12   public class ConcurrentQueueLoops {
13      static final ExecutorService pool = Executors.newCachedThreadPool();
# Line 21 | Line 21 | public class ConcurrentQueueLoops {
21      public static void main(String[] args) throws Exception {
22          int maxStages = 100;
23          int work = 1024;
24 <        Class klass = null;
24 >        Class<?> klass = null;
25          if (args.length > 0) {
26              try {
27                  klass = Class.forName(args[0]);
# Line 50 | Line 50 | public class ConcurrentQueueLoops {
50          Thread.sleep(100);
51          print = true;
52  
53 <        int k = 1;
54 <        for (int i = 1; i <= maxStages;) {
53 >        for (int k = 1, i = 1; i <= maxStages;) {
54              oneRun(klass, i);
55              if (i == k) {
56                  k = i << 1;
# Line 76 | Line 75 | public class ConcurrentQueueLoops {
75          static int compute(int l) {
76              if (l == 0)
77                  return (int) System.nanoTime();
78 <            int nn =  (l >>> 7) & workMask;
78 >            int nn = (l >>> 7) & workMask;
79              while (nn-- > 0)
80                  l = LoopHelpers.compute6(l);
81              return l;
# Line 117 | Line 116 | public class ConcurrentQueueLoops {
116          }
117      }
118  
119 <    static void oneRun(Class klass, int n) throws Exception {
119 >    static void oneRun(Class<?> klass, int n) throws Exception {
120          Queue<Integer> q = (Queue<Integer>) klass.newInstance();
121          LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer();
122          CyclicBarrier barrier = new CyclicBarrier(n + 1, timer);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines