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

Comparing jsr166/src/test/loops/SubmissionPublisherLoops3.java (file contents):
Revision 1.2 by jsr166, Thu Jul 23 14:58:13 2015 UTC vs.
Revision 1.3 by dl, Sat Sep 12 20:30:46 2015 UTC

# Line 29 | Line 29 | public class SubmissionPublisherLoops3 {
29                             " PRODUCERS: " + PRODUCERS +
30                             " CONSUMERS: " + CONSUMERS +
31                             " CAP: " + CAP);
32        long nitems = (long)ITEMS * PRODUCERS * CONSUMERS;
32          for (int rep = 0; rep < reps; ++rep) {
33 <            long startTime = System.nanoTime();
34 <            for (int i = 0; i < PRODUCERS; ++i)
36 <                new Pub().fork();
37 <            phaser.arriveAndAwaitAdvance();
38 <            long elapsed = System.nanoTime() - startTime;
39 <            double secs = ((double)elapsed) / (1000L * 1000 * 1000);
40 <            double ips = nitems / secs;
41 <            System.out.printf("Time: %7.2f", secs);
42 <            System.out.printf(" items per sec: %14.2f\n", ips);
43 <            System.out.println(ForkJoinPool.commonPool());
33 >            oneRun();
34 >            Thread.sleep(1000);
35          }
36      }
37  
38 +    static void oneRun() throws Exception {
39 +        long nitems = (long)ITEMS * PRODUCERS * CONSUMERS;
40 +        long startTime = System.nanoTime();
41 +        for (int i = 0; i < PRODUCERS; ++i)
42 +            new Pub().fork();
43 +        phaser.arriveAndAwaitAdvance();
44 +        long elapsed = System.nanoTime() - startTime;
45 +        double secs = ((double)elapsed) / (1000L * 1000 * 1000);
46 +        double ips = nitems / secs;
47 +        System.out.printf("Time: %7.2f", secs);
48 +        System.out.printf(" items per sec: %14.2f\n", ips);
49 +        System.out.println(ForkJoinPool.commonPool());
50 +    }
51 +
52      static final class Sub implements Flow.Subscriber<Boolean> {
53          int count;
54          Flow.Subscription subscription;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines