Class StopWatch
java.lang.Object
org.apache.wayang.commons.util.profiledb.instrumentation.StopWatch
Utility to create
TimeMeasurement
s for an Experiment
.-
Constructor Summary
ConstructorsConstructorDescriptionStopWatch
(Experiment experiment) Creates a new instance for the givenExperiment
. -
Method Summary
Modifier and TypeMethodDescriptionGet theExperiment
managed by this instance.getOrCreateRound
(String id, String... furtherIds) Retrieves aTimeMeasurement
by its ID fromrounds
.Starts aTimeMeasurement
.void
Stops aTimeMeasurement
(if it exists).void
stopAll()
Stops allTimeMeasurement
s known to this instance.Formats theTimeMeasurement
s to something easily readable.toPrettyString
(String indent, String bullet) Formats theTimeMeasurement
s to something easily readable.
-
Constructor Details
-
StopWatch
Creates a new instance for the givenExperiment
.- Parameters:
experiment
- that should be instrumented
-
-
Method Details
-
getOrCreateRound
Retrieves aTimeMeasurement
by its ID fromrounds
. If it does not exist, it will be created and also registered with theexperiment
.- Parameters:
id
- the ID of theTimeMeasurement
furtherIds
- IDs of further nestedTimeMeasurement
s- Returns:
- the
TimeMeasurement
-
start
Starts aTimeMeasurement
. Any required parentTimeMeasurement
will be started if necessary.- Parameters:
id
- ID of the rootTimeMeasurement
furtherIds
- IDs of further nestedTimeMeasurement
s- Returns:
- the (potentially new)
TimeMeasurement
-
stop
Stops aTimeMeasurement
(if it exists).- Parameters:
id
- ID of the rootTimeMeasurement
furtherIds
- IDs of further nestedTimeMeasurement
s
-
toPrettyString
Formats theTimeMeasurement
s to something easily readable.- Returns:
- the "pretty"
String
-
toPrettyString
Formats theTimeMeasurement
s to something easily readable.- Parameters:
indent
- indent to be used when formatting sub-TimeMeasurement
sbullet
- bullet point character- Returns:
- the "pretty"
String
-
stopAll
public void stopAll()Stops allTimeMeasurement
s known to this instance. -
getExperiment
Get theExperiment
managed by this instance.- Returns:
- the
Experiment
-