Class Stopwatch


  • public final class Stopwatch
    extends java.lang.Object
    Measures elapsed time in milliseconds
    Since:
    15755
    See Also:
    Stopwatch in Guava
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private long start  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Stopwatch​(long start)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Stopwatch createStarted()
      Creates and starts a stopwatch
      long elapsed()
      Returns the elapsed milliseconds
      java.lang.String toString()
      Formats the duration since start as string
      java.lang.String toString​(java.lang.String taskName)
      Formats the given task name and duration since start as i18n string
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • start

        private final long start
    • Constructor Detail

      • Stopwatch

        private Stopwatch​(long start)
    • Method Detail

      • createStarted

        public static Stopwatch createStarted()
        Creates and starts a stopwatch
        Returns:
        the started stopwatch
      • elapsed

        public long elapsed()
        Returns the elapsed milliseconds
        Returns:
        the elapsed milliseconds
      • toString

        public java.lang.String toString()
        Formats the duration since start as string
        Overrides:
        toString in class java.lang.Object
        Returns:
        the duration since start as string
        See Also:
        Utils.getDurationString(long)
      • toString

        public java.lang.String toString​(java.lang.String taskName)
        Formats the given task name and duration since start as i18n string
        Parameters:
        taskName - the task name
        Returns:
        the task name and duration since start as i18n string