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
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 Details

    • TimeMeasurement

      public TimeMeasurement(String id)
      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

      public TimeMeasurement start(String... identifiers)
      Start a (potentially new) sub-TimeMeasurement.
      Parameters:
      identifiers - identifies the target TimeMeasurement as a path of IDs
      Returns:
      the started instance
    • getOrCreateRound

      public TimeMeasurement getOrCreateRound(String id)
      Retrieves an existing TimeMeasurement from rounds with the given id or creates and stores a new one.
      Parameters:
      id - the ID of the TimeMeasurement
      Returns:
      the TimeMeasurement
    • stop

      public void stop()
      Stop a measurement that has been started via start() or derivatives.
    • stop

      public void stop(String... identfiers)
      Stop a measurement that has been started via start(String...) or related.
      Parameters:
      identfiers - identify the target TimeMeasurement as a path of IDs
    • getMillis

      public long getMillis()
    • setMillis

      public void setMillis(long millis)
    • getRounds

      public Collection<TimeMeasurement> getRounds()
    • addRounds

      public void addRounds(TimeMeasurement round)
    • formatDuration

      public static String formatDuration(long millis)
      Formats the given milliseconds as h:MM:ss.mmm.
      Parameters:
      millis - the milliseconds to format
      Returns:
      the formatted milliseconds
    • toString

      public String toString()
      Overrides:
      toString in class Object