Class 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 Detail

      • TimeMeasurement

        public TimeMeasurement​(java.lang.String id)
        Creates a new instance.
        Parameters:
        id - the ID of the new instance
    • 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 target TimeMeasurement as a path of IDs
        Returns:
        the started instance
      • stop

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

        public void stop​(java.lang.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)
      • formatDuration

        public static java.lang.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object