Class MethodProfiling

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public final class MethodProfiling
    extends java.lang.Object
    implements java.lang.AutoCloseable
    Holds information of a currently profiled method/code-unit.
    • Constructor Summary

      Constructors 
      Constructor Description
      MethodProfiling()
      C'tor that automatically detects calling method and class.
      Depending on platform this may an expensive operation.
      MethodProfiling​(MethodProfilingInformation method)
      C'tor with method information instance (the fasted way).
      MethodProfiling​(java.lang.String clazz, java.lang.String method)
      C'tor with class and method.
    • Method Summary

      Modifier and Type Method Description
      void close()  
      void exception​(java.lang.Throwable t)
      Profiles a exception.
      Remind that "close" needs still to be called - following the AutoClosable pattern.
      MeasurementValue getUsedTime()
      Get the used time in nanoseconds.
      • Methods inherited from class java.lang.Object

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

      • usedTime

        protected MeasurementValue usedTime
        Used times in nanoseconds. Null if the call is not yet finished.
      • notRecursive

        protected final boolean notRecursive
        True if the call was not recursive.
    • Constructor Detail

      • MethodProfiling

        public MethodProfiling​(java.lang.String clazz,
                               java.lang.String method)
        C'tor with class and method.
        Parameters:
        clazz - The name of the module/class.
        method - The name of the method/code-unit.
      • MethodProfiling

        public MethodProfiling​(MethodProfilingInformation method)
        C'tor with method information instance (the fasted way).
        Parameters:
        method - The method to profile.
    • Method Detail

      • getUsedTime

        public final MeasurementValue getUsedTime()
        Get the used time in nanoseconds.
        Returns:
        The used time in nanoseconds or null if the call is not yet finished.
      • exception

        public void exception​(java.lang.Throwable t)
        Profiles a exception.
        Remind that "close" needs still to be called - following the AutoClosable pattern.
        Parameters:
        t - The Throwable.
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable