1 |
– |
|
1 |
|
import java.util.*; |
2 |
|
import java.util.concurrent.*; |
3 |
|
|
6 |
|
// Performance-tuning constant: |
7 |
|
static int sequentialThreshold; |
8 |
|
static long lastStealCount; |
9 |
< |
|
9 |
> |
|
10 |
|
public static void main(String[] args) throws Exception { |
11 |
|
int procs = 0; |
12 |
|
int num = 45; |
16 |
|
procs = Integer.parseInt(args[0]); |
17 |
|
if (args.length > 1) |
18 |
|
num = Integer.parseInt(args[1]); |
19 |
< |
if (args.length > 2) |
19 |
> |
if (args.length > 2) |
20 |
|
sequentialThreshold = Integer.parseInt(args[2]); |
21 |
|
} |
22 |
|
catch (Exception e) { |
24 |
|
return; |
25 |
|
} |
26 |
|
|
27 |
< |
|
27 |
> |
|
28 |
|
for (int reps = 0; reps < 2; ++reps) { |
29 |
< |
ForkJoinPool g = procs == 0? new ForkJoinPool() : |
29 |
> |
ForkJoinPool g = (procs == 0) ? new ForkJoinPool() : |
30 |
|
new ForkJoinPool(procs); |
31 |
|
// g.setMaintainsParallelism(false); |
32 |
|
lastStealCount = g.getStealCount(); |
120 |
|
} |
121 |
|
|
122 |
|
} |
124 |
– |
|