160 |
|
} |
161 |
|
|
162 |
|
protected void runTestProfiled() throws Throwable { |
163 |
+ |
// Warmup run, notably to trigger all needed classloading. |
164 |
+ |
super.runTest(); |
165 |
|
long t0 = System.nanoTime(); |
166 |
|
try { |
167 |
|
super.runTest(); |
168 |
|
} finally { |
169 |
< |
long elapsedMillis = |
168 |
< |
(System.nanoTime() - t0) / (1000L * 1000L); |
169 |
> |
long elapsedMillis = millisElapsedSince(t0); |
170 |
|
if (elapsedMillis >= profileThreshold) |
171 |
|
System.out.printf("%n%s: %d%n", toString(), elapsedMillis); |
172 |
|
} |
902 |
|
* startNanoTime, which must have been previously returned from a |
903 |
|
* call to {@link System.nanoTime()}. |
904 |
|
*/ |
905 |
< |
long millisElapsedSince(long startNanoTime) { |
905 |
> |
static long millisElapsedSince(long startNanoTime) { |
906 |
|
return NANOSECONDS.toMillis(System.nanoTime() - startNanoTime); |
907 |
|
} |
908 |
|
|