com.ibm.wsspi.timedoperations

Interface TimedOperation



  • public interface TimedOperation

    Timed operations help WebSphere Application Server administrators see, by way of a logged warning, when certain operations in their application server are running more slowly than expected.

    The system looks for abnormal patterns in the durations of instrumented calls, by keeping track of several recent durations and computing the mean and standard deviation for each of these timed operations. Specific messages are logged so that administrators know what is slow when an abnormal pattern is detected.

    The timed operation feature uses a moving average, where a certain number of durations are excluded from calculations in order to avoid a high variance during the warm-up period.

    This allows it to tolerate minor variances, such as could occur due to periodic garbage collection for example.

    This interface has been designed to make it easy for implementations to be thread safe without the need for ThreadLocals. Implementations of this interface are thread safe.

    • Method Summary

      Methods 
      Modifier and Type Method and Description
      java.lang.String getId()
      Constructs an identifier for the timed operation.
      java.lang.String getPattern()
      Returns the pattern of the timed operation, which represents a particular instance name to indicate the specific operation being performed.
      java.lang.String getType()
      Returns the type of the timed operation.
      long start()
      Returns a token representing the current value of the system timer in nanoseconds to be used with stopAndCheck(long).
      int stopAndCheck(long startToken)
      Calculates the time elapsed since calling start(), and uses it to compute a moving average.
    • Method Detail

      • start

        long start()
        Returns a token representing the current value of the system timer in nanoseconds to be used with stopAndCheck(long). stopAndCheck(long) needs to be called on the same thread as start() is called on.
        Returns:
        the current value of the system timer in nanoseconds.
        See Also:
        stopAndCheck(long)
      • stopAndCheck

        int stopAndCheck(long startToken)
        Calculates the time elapsed since calling start(), and uses it to compute a moving average. When computing the moving average, a certain number of durations are excluded in order to avoid a high variance during the warm-up period. Once enough durations have been gathered, it looks for abnormal distribution patterns to decide if a warning should be logged.
        Parameters:
        startToken - value returned from call to start()
        Returns:
        1 if an abnormal distribution of the samples has been detected, -1 if it is still gathering samples, 0 if no abnormal pattern has been detected, and -2 if startToken is 0.
        See Also:
        start()
      • getId

        java.lang.String getId()
        Constructs an identifier for the timed operation. The identifier is equal to type:pattern if a pattern is defined for the timed operation, or to type otherwise.
        Returns:
        the identifier of the timed operation.
      • getType

        java.lang.String getType()
        Returns the type of the timed operation.
        Returns:
        the type of the timed operation.
      • getPattern

        java.lang.String getPattern()
        Returns the pattern of the timed operation, which represents a particular instance name to indicate the specific operation being performed.
        Returns:
        the pattern of the timed operation or null if a pattern is not configured.