Class Sampler.Context

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable
    Enclosing class:
    Sampler

    public static class Sampler.Context
    extends java.lang.Object
    implements java.io.Closeable
    A timing context.
    See Also:
    Sampler.time()
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Equivalent to calling stop().
      long stop()
      Updates the sampler with the difference between current and start time.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • stop

        public long stop()
        Updates the sampler with the difference between current and start time. Call to this method will not reset the start time. Multiple calls result in multiple updates.
        Returns:
        the elapsed time in nanoseconds
      • close

        public void close()
        Equivalent to calling stop().
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable