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

Comparing jsr166/src/test/loops/OfferPollLoops.java (file contents):
Revision 1.2 by jsr166, Thu Oct 29 23:09:07 2009 UTC vs.
Revision 1.8 by jsr166, Thu Jan 15 18:34:19 2015 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
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6  
7   import java.util.*;
# Line 54 | Line 54 | public class OfferPollLoops {
54  
55          warmup();
56          print = true;
57 <        int k = 1;
58 <        for (int i = 1; i <= maxN;) {
57 >        for (int k = 1, i = 1; i <= maxN;) {
58              System.out.println("Pairs:" + i);
59              oneTest(i, ITERS);
60              if (i == k) {
# Line 103 | Line 102 | public class OfferPollLoops {
102  
103          Thread.sleep(100); // System.gc();
104          if (print)
105 +            System.out.print("ConcurrentLinkedDeque   ");
106 +        oneRun(new ConcurrentLinkedDeque<Integer>(), n, iters);
107 +
108 +        Thread.sleep(100); // System.gc();
109 +        if (print)
110              System.out.print("LinkedBlockingQueue     ");
111          oneRun(new LinkedBlockingQueue<Integer>(), n, iters);
112  
# Line 121 | Line 125 | public class OfferPollLoops {
125              System.out.print("ArrayBlockingQueue      ");
126          oneRun(new ArrayBlockingQueue<Integer>(POOL_SIZE), n, iters);
127  
124
128          Thread.sleep(100); // System.gc();
129          if (print)
130              System.out.print("PriorityBlockingQueue   ");
# Line 134 | Line 137 | public class OfferPollLoops {
137  
138      }
139  
140 <    static abstract class Stage implements Runnable {
140 >    abstract static class Stage implements Runnable {
141          final int iters;
142          final Queue<Integer> queue;
143          final CyclicBarrier barrier;
144          final Phaser lagPhaser;
145 <        Stage (Queue<Integer> q, CyclicBarrier b, Phaser s,
143 <               int iters) {
145 >        Stage(Queue<Integer> q, CyclicBarrier b, Phaser s, int iters) {
146              queue = q;
147              barrier = b;
148              lagPhaser = s;
# Line 233 | Line 235 | public class OfferPollLoops {
235              System.out.println("\t: " + LoopHelpers.rightJustify(time / (iters * n)) + " ns per transfer");
236      }
237  
236
238   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines