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

Comparing jsr166/src/test/loops/SpinningTieredPhaserLoops.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 SpinningTieredPhaserLoops {
21      static final long NPS = (1000L * 1000 * 1000);
22  
23      static int tasksPerPhaser = Math.max(NCPUS / 4, 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 SpinningTieredPhaserLoops {
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 69 | Line 69 | public class SpinningTieredPhaserLoops {
69              nthreads = Integer.parseInt(args[0]);
70          if (args.length > 1)
71              tasksPerPhaser = Integer.parseInt(args[1]);
72 <            
72 >
73          System.out.printf("Max %d Threads, %d tasks per phaser\n", nthreads, tasksPerPhaser);
74  
75          for (int k = 2; k <= nthreads; k *= 2) {
76              for (int size = FIRST_SIZE; size <= LAST_SIZE; size *= 10) {
77                  long startTime = System.nanoTime();
78 <                
78 >
79                  Runnable[] actions = new Runnable [k];
80                  build(actions, size, 0, k, new Phaser());
81                  Future[] futures = new Future[k];
# Line 93 | Line 93 | public class SpinningTieredPhaserLoops {
93          }
94          pool.shutdown();
95      }
96    
97 }
98
96  
97 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines