类 Stopwatch


  • public class Stopwatch
    extends java.lang.Object
    A tool for measuring elapsed time. This class is not thread-safe.
    • 方法概要

      所有方法 静态方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      static Stopwatch create()
      Create a stopwatch, not started.
      java.time.Duration elapsed()
      Return elapsed duration.
      long elapsed​(java.util.concurrent.TimeUnit timeUnit)
      Return elapsed duration as specific time unit value.
      long elapsedMillis()
      Return clasped duration as milli seconds.
      long elapsedNanos()
      Return clasped duration as nano seconds.
      Stopwatch start()
      Start the watch
      Stopwatch stop()
      Stop the stopwatch, the following calls to elapsed will return elapsed time as this time.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 方法详细资料

      • create

        public static Stopwatch create()
        Create a stopwatch, not started. You may want to call start() method to start this stopwatch.
      • start

        public Stopwatch start()
        Start the watch
      • stop

        public Stopwatch stop()
        Stop the stopwatch, the following calls to elapsed will return elapsed time as this time.
      • elapsed

        public java.time.Duration elapsed()
        Return elapsed duration.
      • elapsed

        public long elapsed​(java.util.concurrent.TimeUnit timeUnit)
        Return elapsed duration as specific time unit value.
      • elapsedNanos

        public long elapsedNanos()
        Return clasped duration as nano seconds.
      • elapsedMillis

        public long elapsedMillis()
        Return clasped duration as milli seconds.