Class TimeMeasurement
java.lang.Object
org.apache.wayang.commons.util.profiledb.model.Measurement
org.apache.wayang.commons.util.profiledb.model.measurement.TimeMeasurement
A
Measurement
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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRounds
(TimeMeasurement round) static String
formatDuration
(long millis) Formats the given milliseconds ash:MM:ss.mmm
.long
Retrieves an existingTimeMeasurement
fromrounds
with the givenid
or creates and stores a new one.void
setMillis
(long millis) void
start()
Start measuring time for this instance.Start a (potentially new) sub-TimeMeasurement
.void
stop()
Stop a measurement that has been started viastart()
or derivatives.void
Stop a measurement that has been started viastart(String...)
or related.toString()
Methods inherited from class org.apache.wayang.commons.util.profiledb.model.Measurement
equals, getId, getType, getTypeName, hashCode, setId
-
Constructor Details
-
TimeMeasurement
Creates a new instance.- Parameters:
id
- the ID of the new instance
-
-
Method Details
-
start
public void start()Start measuring time for this instance. -
start
Start a (potentially new) sub-TimeMeasurement
.- Parameters:
identifiers
- identifies the targetTimeMeasurement
as a path of IDs- Returns:
- the started instance
-
getOrCreateRound
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
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
-
addRounds
-
formatDuration
Formats the given milliseconds ash:MM:ss.mmm
.- Parameters:
millis
- the milliseconds to format- Returns:
- the formatted milliseconds
-
toString
-