public class Stopwatch extends Object implements AutoCloseable
| Constructor and Description |
|---|
Stopwatch(String stopwatchName)
Starts a stopwatch (must always be used in try-with-resource):
try (Stopwatch stopwatch = new Stopwatch("nameyouwant")) {
// your code
}
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Stops the stopwatch.
|
long |
getDuration() |
String |
getName() |
boolean |
isClosed() |
public Stopwatch(String stopwatchName)
try (Stopwatch stopwatch = new Stopwatch("nameyouwant")) {
// your code
}
stopwatchName - Whatever name you want to display in the statisticspublic String getName()
public long getDuration()
public boolean isClosed()
public void close()
close in interface AutoCloseableCopyright © 2008–2021 Emeric Vernat. All rights reserved.