org.LatencyUtils
Class SimplePauseDetector

java.lang.Object
  extended by org.LatencyUtils.PauseDetector
      extended by org.LatencyUtils.SimplePauseDetector

public class SimplePauseDetector
extends PauseDetector

A Simple PauseDetector that detects pauses using a consensus observation across a configurable number of detection thread. Detection threads can be set to periodically wakeup or continually spin.

All times and time units are in nanoseconds


Constructor Summary
SimplePauseDetector()
          Creates a SimplePauseDetector with a default sleep interval (1 msec), a default pause notification threshold (1 msec), and using the default number of consensus detection threads (3).
SimplePauseDetector(long sleepInterval, long pauseNotificationThreshold, int numberOfDetectorThreads)
          Creates a SimplePauseDetector
SimplePauseDetector(long sleepInterval, long pauseNotificationThreshold, int numberOfDetectorThreads, boolean verbose)
          Creates a SimplePauseDetector
 
Method Summary
 void setVerbose(boolean verbose)
           
 void shutdown()
          Shut down the pause detector operation and terminate it's threads.
 void skipConsensusTimeTo(long newConsensusTime)
          A test method that allows the caller to artificially move the consensus observed time forward without causing a pause to be detected as a result of the time skip.
 void stallDetectorThreads(long threadNumberMask, long stallLength)
          A test method that allows the caller to artificially stall a requested set of the detector threads for a given amount of time.
 
Methods inherited from class org.LatencyUtils.PauseDetector
addListener, addListener, notifyListeners, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimplePauseDetector

public SimplePauseDetector(long sleepInterval,
                           long pauseNotificationThreshold,
                           int numberOfDetectorThreads)
Creates a SimplePauseDetector

Parameters:
sleepInterval - sleep interval used by detector threads
pauseNotificationThreshold - minimum threshold for reporting detected pauses
numberOfDetectorThreads - number of consensus detector threads to use

SimplePauseDetector

public SimplePauseDetector(long sleepInterval,
                           long pauseNotificationThreshold,
                           int numberOfDetectorThreads,
                           boolean verbose)
Creates a SimplePauseDetector

Parameters:
sleepInterval - sleep interval used by detector threads
pauseNotificationThreshold - minimum threshold for reporting detected pauses
numberOfDetectorThreads - number of consensus detector threads to use
verbose - provide verbose output when pauses are detected

SimplePauseDetector

public SimplePauseDetector()
Creates a SimplePauseDetector with a default sleep interval (1 msec), a default pause notification threshold (1 msec), and using the default number of consensus detection threads (3).

Method Detail

setVerbose

public void setVerbose(boolean verbose)

shutdown

public void shutdown()
Shut down the pause detector operation and terminate it's threads.

Overrides:
shutdown in class PauseDetector

stallDetectorThreads

public void stallDetectorThreads(long threadNumberMask,
                                 long stallLength)
                          throws java.lang.InterruptedException
A test method that allows the caller to artificially stall a requested set of the detector threads for a given amount of time. Used to verify pause detection when consensus occurs, as well as lack of detection when it does not.

Parameters:
threadNumberMask - a mask designating which threads should be stalled.
stallLength - stall length, in nanosecond units
Throws:
java.lang.InterruptedException - if internal sleep implementation throws it

skipConsensusTimeTo

public void skipConsensusTimeTo(long newConsensusTime)
A test method that allows the caller to artificially move the consensus observed time forward without causing a pause to be detected as a result of the time skip. Useful for test programs that wish to use artificial time services.

Parameters:
newConsensusTime - time to skip to