public class Timer extends Object implements AutoCloseable
Usage:
try (Timer t = new Timer("doing something")) { ... }
Modifier and Type | Class and Description |
---|---|
static class |
Timer.TimerResult |
Modifier and Type | Method and Description |
---|---|
void |
close() |
static void |
end(String name)
Deprecated.
use
try (Timer t = new Timer("...")) { .. } instead |
static String |
formatDurationNanos(long durationNanoSeconds) |
static Timer.TimerResult |
measureWallclockTime(Runnable task,
long minimumDurationMillis) |
static void |
start(String name)
Deprecated.
use
try (Timer t = new Timer("...")) { .. } instead |
public Timer(String x)
public static void start(String name)
try (Timer t = new Timer("...")) { .. }
insteadpublic static String formatDurationNanos(long durationNanoSeconds)
public static void end(String name)
try (Timer t = new Timer("...")) { .. }
insteadpublic static Timer.TimerResult measureWallclockTime(Runnable task, long minimumDurationMillis)
task
- runs this multiple timesminimumDurationMillis
- thousandths of a secondStopwatch
public void close()
close
in interface AutoCloseable