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

Comparing jsr166/src/test/loops/SubmissionPublisherLoops2.java (file contents):
Revision 1.3 by jsr166, Mon Sep 7 21:44:29 2015 UTC vs.
Revision 1.4 by dl, Sat Sep 12 20:30:46 2015 UTC

# Line 18 | Line 18 | public class SubmissionPublisherLoops2 {
18  
19      static final Phaser phaser = new Phaser(CONSUMERS + 1);
20  
21 <    static class Sub implements Flow.Subscriber<Boolean> {
21 >    static final class Sub implements Flow.Subscriber<Boolean> {
22          Flow.Subscription sn;
23          int count;
24          public void onSubscribe(Flow.Subscription s) {
# Line 59 | Line 59 | public class SubmissionPublisherLoops2 {
59          System.out.println("ITEMS: " + ITEMS +
60                             " CONSUMERS: " + CONSUMERS +
61                             " CAP: " + CAP);
62
62          for (int rep = 0; rep < reps; ++rep) {
63 <            long startTime = System.nanoTime();
64 <            new Pub().fork();
66 <            phaser.arriveAndAwaitAdvance();
67 <            long elapsed = System.nanoTime() - startTime;
68 <            double secs = ((double)elapsed) / NPS;
69 <            System.out.printf("\tTime: %7.3f\n", secs);
63 >            oneRun();
64 >            Thread.sleep(1000);
65          }
66      }
67 +
68 +    static void oneRun() throws Exception {
69 +        long startTime = System.nanoTime();
70 +        new Pub().fork();
71 +        phaser.arriveAndAwaitAdvance();
72 +        long elapsed = System.nanoTime() - startTime;
73 +        double secs = ((double)elapsed) / NPS;
74 +        System.out.printf("\tTime: %7.3f\n", secs);
75 +    }
76 +
77   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines