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
AMeasurementthat 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 voidaddRounds(TimeMeasurement round)static java.lang.StringformatDuration(long millis)Formats the given milliseconds ash:MM:ss.mmm.longgetMillis()TimeMeasurementgetOrCreateRound(java.lang.String id)Retrieves an existingTimeMeasurementfromroundswith the givenidor creates and stores a new one.java.util.Collection<TimeMeasurement>getRounds()voidsetMillis(long millis)voidstart()Start measuring time for this instance.TimeMeasurementstart(java.lang.String... identifiers)Start a (potentially new) sub-TimeMeasurement.voidstop()Stop a measurement that has been started viastart()or derivatives.voidstop(java.lang.String... identfiers)Stop a measurement that has been started viastart(String...)or related.java.lang.StringtoString()-
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 targetTimeMeasurementas a path of IDs- Returns:
- the started instance
-
getOrCreateRound
public TimeMeasurement getOrCreateRound(java.lang.String id)
Retrieves an existingTimeMeasurementfromroundswith the givenidor 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 targetTimeMeasurementas 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:
toStringin classjava.lang.Object
-
-