23 |
|
|
24 |
|
/** for time conversion */ |
25 |
|
static final long NPS = (1000L * 1000 * 1000); |
26 |
< |
|
26 |
> |
|
27 |
|
public static void main(String[] args) throws Exception { |
28 |
|
int procs = 0; |
29 |
|
try { |
35 |
|
return; |
36 |
|
} |
37 |
|
for (int reps = 0; reps < 2; ++reps) { |
38 |
< |
ForkJoinPool g = procs == 0? new ForkJoinPool() : |
38 |
> |
ForkJoinPool g = procs == 0? new ForkJoinPool() : |
39 |
|
new ForkJoinPool(procs); |
40 |
|
System.out.println("Number of procs=" + g.getParallelism()); |
41 |
|
lastStealCount = g.getStealCount(); |
42 |
|
for (int i = FIRST_SIZE; i <= LAST_SIZE; i++) |
43 |
|
test(g, i); |
44 |
< |
g.shutdown(); |
44 |
> |
g.shutdown(); |
45 |
|
} |
46 |
|
} |
47 |
|
|
63 |
|
lastStealCount = sc; |
64 |
|
System.out.printf(" Steals/t: %5d", ns/ps); |
65 |
|
System.out.println(); |
66 |
< |
} |
66 |
> |
} |
67 |
|
|
68 |
< |
// Boards are represented as arrays where each cell |
68 |
> |
// Boards are represented as arrays where each cell |
69 |
|
// holds the column number of the queen in that row |
70 |
|
|
71 |
|
final int[] sofar; |
72 |
|
volatile int solutions; |
73 |
< |
AsyncNQueensCS(AsyncNQueensCS parent, int[] a) { |
73 |
> |
AsyncNQueensCS(AsyncNQueensCS parent, int[] a) { |
74 |
|
super(parent); |
75 |
< |
this.sofar = a; |
75 |
> |
this.sofar = a; |
76 |
|
} |
77 |
|
|
78 |
|
public final boolean exec() { |