twitter4j.management
Class InvocationStatisticsCalculator

java.lang.Object
  extended by twitter4j.management.InvocationStatisticsCalculator
All Implemented Interfaces:
InvocationStatistics

public class InvocationStatisticsCalculator
extends java.lang.Object
implements InvocationStatistics

Object that collects/aggregates statistics for the invocation of a given method.

Author:
Nick Dellamaggiore (nick.dellamaggiore gmail.com)

Field Summary
private  long callCount
           
private  long errorCount
           
private  int index
           
private  java.lang.String name
           
private  long[] times
           
private  long totalTime
           
 
Constructor Summary
InvocationStatisticsCalculator(java.lang.String name, int historySize)
           
 
Method Summary
 long getAverageTime()
           
 long getCallCount()
           
 long getErrorCount()
           
 java.lang.String getName()
           
 long getTotalTime()
           
 void increment(long time, boolean success)
           
 void reset()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private java.lang.String name

times

private long[] times

index

private int index

callCount

private long callCount

errorCount

private long errorCount

totalTime

private long totalTime
Constructor Detail

InvocationStatisticsCalculator

public InvocationStatisticsCalculator(java.lang.String name,
                                      int historySize)
Parameters:
name - the name of this API method
historySize - the number of calls to track (for invocation time averaging)
Method Detail

increment

public void increment(long time,
                      boolean success)

getName

public java.lang.String getName()
Specified by:
getName in interface InvocationStatistics

getCallCount

public long getCallCount()
Specified by:
getCallCount in interface InvocationStatistics

getErrorCount

public long getErrorCount()
Specified by:
getErrorCount in interface InvocationStatistics

getTotalTime

public long getTotalTime()
Specified by:
getTotalTime in interface InvocationStatistics

getAverageTime

public long getAverageTime()
Specified by:
getAverageTime in interface InvocationStatistics

reset

public void reset()
Specified by:
reset in interface InvocationStatistics

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object