168 |
|
} |
169 |
|
|
170 |
|
public static class BarrierTimer implements Runnable { |
171 |
< |
public volatile long startTime; |
172 |
< |
public volatile long endTime; |
171 |
> |
volatile boolean started; |
172 |
> |
volatile long startTime; |
173 |
> |
volatile long endTime; |
174 |
|
public void run() { |
175 |
|
long t = System.nanoTime(); |
176 |
< |
if (startTime == 0) |
176 |
> |
if (!started) { |
177 |
> |
started = true; |
178 |
|
startTime = t; |
179 |
< |
else |
179 |
> |
} else |
180 |
|
endTime = t; |
181 |
|
} |
182 |
|
public void clear() { |
183 |
< |
startTime = 0; |
182 |
< |
endTime = 0; |
183 |
> |
started = false; |
184 |
|
} |
185 |
|
public long getTime() { |
186 |
|
return endTime - startTime; |