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

Comparing jsr166/src/test/loops/TieredPhaserLoops.java (file contents):
Revision 1.1 by dl, Sun Nov 1 21:28:57 2009 UTC vs.
Revision 1.2 by jsr166, Mon Nov 2 20:23:53 2009 UTC

# Line 21 | Line 21 | public class TieredPhaserLoops {
21      static final long NPS = (1000L * 1000 * 1000);
22  
23      static int tasksPerPhaser = Math.max(NCPUS / 8, 4);
24 <    
24 >
25      static void build(Runnable[] actions, int sz, int lo, int hi, Phaser b) {
26          int step = (hi - lo) / tasksPerPhaser;
27          if (step > 1) {
# Line 33 | Line 33 | public class TieredPhaserLoops {
33              }
34          }
35          else {
36 <            for (int i = lo; i < hi; ++i)
36 >            for (int i = lo; i < hi; ++i)
37                  actions[i] = new PhaserAction(i, b, sz);
38          }
39      }
# Line 64 | Line 64 | public class TieredPhaserLoops {
64              nthreads = Integer.parseInt(args[0]);
65          if (args.length > 1)
66              tasksPerPhaser = Integer.parseInt(args[1]);
67 <            
67 >
68          System.out.printf("Max %d Threads, %d tasks per phaser\n", nthreads, tasksPerPhaser);
69  
70          for (int k = 2; k <= nthreads; k *= 2) {
71              for (int size = FIRST_SIZE; size <= LAST_SIZE; size *= 10) {
72                  long startTime = System.nanoTime();
73 <                
73 >
74                  Runnable[] actions = new Runnable [k];
75                  build(actions, size, 0, k, new Phaser());
76                  Future[] futures = new Future[k];
# Line 88 | Line 88 | public class TieredPhaserLoops {
88          }
89          pool.shutdown();
90      }
91    
92 }
93
91  
92 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines