27 |
|
trialMillis = Integer.parseInt(args[argc]); |
28 |
|
else if (option.equals("-r")) |
29 |
|
nReps = Integer.parseInt(args[argc]); |
30 |
< |
else |
30 |
> |
else |
31 |
|
maxThreads = Integer.parseInt(option); |
32 |
|
argc++; |
33 |
|
} |
34 |
|
|
35 |
< |
// Display runtime parameters |
36 |
< |
System.out.print("ExchangeTest"); |
37 |
< |
System.out.print(" -t " + trialMillis); |
35 |
> |
// Display runtime parameters |
36 |
> |
System.out.print("ExchangeTest"); |
37 |
> |
System.out.print(" -t " + trialMillis); |
38 |
|
System.out.print(" -r " + nReps); |
39 |
< |
System.out.print(" max threads " + maxThreads); |
40 |
< |
System.out.println(); |
39 |
> |
System.out.print(" max threads " + maxThreads); |
40 |
> |
System.out.println(); |
41 |
|
long warmupTime = 2000; |
42 |
|
long sleepTime = 100; |
43 |
< |
int nw = maxThreads >= 3? 3 : 2; |
43 |
> |
int nw = (maxThreads >= 3) ? 3 : 2; |
44 |
|
|
45 |
|
System.out.println("Warmups.."); |
46 |
|
oneRun(3, warmupTime); |
96 |
|
threads[i].start(); |
97 |
|
} |
98 |
|
Thread.sleep(trialMillis); |
99 |
< |
for (int i = 0; i < nThreads; ++i) |
99 |
> |
for (int i = 0; i < nThreads; ++i) |
100 |
|
threads[i].interrupt(); |
101 |
|
long elapsed = System.nanoTime() - startTime; |
102 |
< |
for (int i = 0; i < nThreads; ++i) |
102 |
> |
for (int i = 0; i < nThreads; ++i) |
103 |
|
threads[i].join(); |
104 |
|
int iters = 1; |
105 |
|
// System.out.println(); |
116 |
|
System.out.println(); |
117 |
|
// x.printStats(); |
118 |
|
} |
119 |
< |
|
119 |
> |
|
120 |
|
static final class Runner implements Runnable { |
121 |
|
final Exchanger exchanger; |
122 |
|
final Object mine = new Integer(2688); |
141 |
|
} |
142 |
|
} |
143 |
|
} |
144 |
– |
|