com.sleepycat.utilint
Class StatsTracker<T>

java.lang.Object
  extended by com.sleepycat.utilint.StatsTracker<T>

public class StatsTracker<T>
extends Object

Maintain interval and cumulative stats for a given set of operations, as well as a activityCounter that generates thread dumps if operations take too long. The markStart and markFinish methods can be used to bracket each tracked operation.


Constructor Summary
StatsTracker(T[] opTypes, Logger stackTraceLogger, int activeThreadThreshold, long threadDumpIntervalMillis, int threadDumpMax, int maxTrackedLatencyMillis)
          The logger is used for activity stack traces.
 
Method Summary
 void clearLatency()
          Should be called after each interval latency stat collection, to reset for the next period's collection.
 Map<T,LatencyStat> getCumulativeLatency()
           
 Map<T,LatencyStat> getIntervalLatency()
           
 int getNumCompletedDumps()
          For unit test support.
 void markFinish(T opType, long startTime)
          Track the end of an operation.
 void markFinish(T opType, long startTime, int numOperations)
          Track the end of an operation.
 long markStart()
          Track the start of a operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatsTracker

public StatsTracker(T[] opTypes,
                    Logger stackTraceLogger,
                    int activeThreadThreshold,
                    long threadDumpIntervalMillis,
                    int threadDumpMax,
                    int maxTrackedLatencyMillis)
The logger is used for activity stack traces.

Method Detail

markStart

public long markStart()
Track the start of a operation.

Returns:
the value of System.nanoTime, for passing to markFinish.

markFinish

public void markFinish(T opType,
                       long startTime)
Track the end of an operation.

Parameters:
startTime - should be the value returned by the corresponding call to markStart

markFinish

public void markFinish(T opType,
                       long startTime,
                       int numOperations)
Track the end of an operation.

Parameters:
startTime - should be the value returned by the corresponding call to markStart

clearLatency

public void clearLatency()
Should be called after each interval latency stat collection, to reset for the next period's collection.


getIntervalLatency

public Map<T,LatencyStat> getIntervalLatency()

getCumulativeLatency

public Map<T,LatencyStat> getCumulativeLatency()

getNumCompletedDumps

public int getNumCompletedDumps()
For unit test support.



Copyright (c) 2004-2012 Oracle. All rights reserved.