Class TimeMeasurement
- java.lang.Object
-
- org.apache.wayang.commons.util.profiledb.model.Measurement
-
- org.apache.wayang.commons.util.profiledb.model.measurement.TimeMeasurement
-
public class TimeMeasurement extends Measurement
AMeasurement
that captures a certain amount of time in milliseconds. Instances can be nested within each other.Besides storing those data, it also provides utility functionality to obtain measurements.
-
-
Constructor Summary
Constructors Constructor Description TimeMeasurement(java.lang.String id)
Creates a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRounds(TimeMeasurement round)
static java.lang.String
formatDuration(long millis)
Formats the given milliseconds ash:MM:ss.mmm
.long
getMillis()
TimeMeasurement
getOrCreateRound(java.lang.String id)
Retrieves an existingTimeMeasurement
fromrounds
with the givenid
or creates and stores a new one.java.util.Collection<TimeMeasurement>
getRounds()
void
setMillis(long millis)
void
start()
Start measuring time for this instance.TimeMeasurement
start(java.lang.String... identifiers)
Start a (potentially new) sub-TimeMeasurement
.void
stop()
Stop a measurement that has been started viastart()
or derivatives.void
stop(java.lang.String... identfiers)
Stop a measurement that has been started viastart(String...)
or related.java.lang.String
toString()
-
Methods inherited from class org.apache.wayang.commons.util.profiledb.model.Measurement
equals, getId, getType, getTypeName, hashCode, setId
-
-
-
-
Method Detail
-
start
public void start()
Start measuring time for this instance.
-
start
public TimeMeasurement start(java.lang.String... identifiers)
Start a (potentially new) sub-TimeMeasurement
.- Parameters:
identifiers
- identifies the targetTimeMeasurement
as a path of IDs- Returns:
- the started instance
-
getOrCreateRound
public TimeMeasurement getOrCreateRound(java.lang.String id)
Retrieves an existingTimeMeasurement
fromrounds
with the givenid
or creates and stores a new one.- Parameters:
id
- the ID of theTimeMeasurement
- Returns:
- the
TimeMeasurement
-
stop
public void stop()
Stop a measurement that has been started viastart()
or derivatives.
-
stop
public void stop(java.lang.String... identfiers)
Stop a measurement that has been started viastart(String...)
or related.- Parameters:
identfiers
- identify the targetTimeMeasurement
as a path of IDs
-
getMillis
public long getMillis()
-
setMillis
public void setMillis(long millis)
-
getRounds
public java.util.Collection<TimeMeasurement> getRounds()
-
addRounds
public void addRounds(TimeMeasurement round)
-
formatDuration
public static java.lang.String formatDuration(long millis)
Formats the given milliseconds ash:MM:ss.mmm
.- Parameters:
millis
- the milliseconds to format- Returns:
- the formatted milliseconds
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-