17 |
|
static int replications = 20; |
18 |
|
|
19 |
|
public static void main(String[] args) throws Exception { |
20 |
< |
if (args.length > 0) |
20 |
> |
if (args.length > 0) |
21 |
|
replications = Integer.parseInt(args[0]); |
22 |
|
|
23 |
< |
if (args.length > 1) |
23 |
> |
if (args.length > 1) |
24 |
|
nlocks = Integer.parseInt(args[1]); |
25 |
|
|
26 |
|
print = true; |
48 |
|
} |
49 |
|
|
50 |
|
final void test() throws Exception { |
51 |
< |
for (int i = 0; i < nthreads; ++i) |
51 |
> |
for (int i = 0; i < nthreads; ++i) |
52 |
|
pool.execute(this); |
53 |
|
barrier.await(); |
54 |
|
barrier.await(); |
65 |
|
|
66 |
|
public final void run() { |
67 |
|
try { |
68 |
< |
barrier.await(); |
68 |
> |
barrier.await(); |
69 |
|
int sum = v; |
70 |
|
int x = 0; |
71 |
|
for (int i = 0; i < locks.length; ++i) { |
86 |
|
barrier.await(); |
87 |
|
result += sum; |
88 |
|
} |
89 |
< |
catch (Exception ie) { |
90 |
< |
return; |
89 |
> |
catch (Exception ie) { |
90 |
> |
return; |
91 |
|
} |
92 |
|
} |
93 |
|
} |