25 |
|
int iters = 1000000; |
26 |
|
int replications = 1; |
27 |
|
|
28 |
< |
if (args.length > 0) |
28 |
> |
if (args.length > 0) |
29 |
|
maxThreads = Integer.parseInt(args[0]); |
30 |
|
|
31 |
< |
if (args.length > 1) |
31 |
> |
if (args.length > 1) |
32 |
|
iters = Integer.parseInt(args[1]); |
33 |
|
|
34 |
< |
if (args.length > 2) |
34 |
> |
if (args.length > 2) |
35 |
|
replications = Integer.parseInt(args[2]); |
36 |
|
|
37 |
|
rng.setSeed(3122688L); |
142 |
|
v = initialValue; |
143 |
|
this.iters = iters; |
144 |
|
barrier = new CyclicBarrier(nthreads+1, timer); |
145 |
< |
for (int i = 0; i < nthreads; ++i) |
145 |
> |
for (int i = 0; i < nthreads; ++i) |
146 |
|
pool.execute(this); |
147 |
|
barrier.await(); |
148 |
|
barrier.await(); |
161 |
|
abstract int loop(int n); |
162 |
|
public final void run() { |
163 |
|
try { |
164 |
< |
barrier.await(); |
164 |
> |
barrier.await(); |
165 |
|
result += loop(iters); |
166 |
|
barrier.await(); |
167 |
|
} |
168 |
< |
catch (Exception ie) { |
169 |
< |
return; |
168 |
> |
catch (Exception ie) { |
169 |
> |
return; |
170 |
|
} |
171 |
|
} |
172 |
|
|