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