Package org.openstreetmap.josm.tools
Class Stopwatch
- java.lang.Object
-
- org.openstreetmap.josm.tools.Stopwatch
-
public final class Stopwatch extends java.lang.Object
Measures elapsed time in milliseconds- Since:
- 15755
- See Also:
- Stopwatch in Guava
-
-
Field Summary
Fields Modifier and Type Field Description private long
start
-
Constructor Summary
Constructors Modifier Constructor Description private
Stopwatch(long start)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Stopwatch
createStarted()
Creates and starts a stopwatchlong
elapsed()
Returns the elapsed millisecondsjava.lang.String
toString()
Formats the duration since start as stringjava.lang.String
toString(java.lang.String taskName)
Formats the given task name and duration since start as i18n string
-
-
-
Field Detail
-
start
private final long start
-
-
Constructor Detail
-
Stopwatch
private Stopwatch(long start)
-
-
Method Detail
-
createStarted
public static Stopwatch createStarted()
Creates and starts a stopwatch- Returns:
- the started stopwatch
-
elapsed
public long elapsed()
Returns the elapsed milliseconds- Returns:
- the elapsed milliseconds
-
toString
public java.lang.String toString()
Formats the duration since start as string- Overrides:
toString
in classjava.lang.Object
- Returns:
- the duration since start as string
- See Also:
Utils.getDurationString(long)
-
toString
public java.lang.String toString(java.lang.String taskName)
Formats the given task name and duration since start as i18n string- Parameters:
taskName
- the task name- Returns:
- the task name and duration since start as i18n string
-
-