Java HTTP Proxy Library Project Page
SourceForge.net Logo

com.wpg.proxy
Class ProxyStatistics

java.lang.Object
  extended by com.wpg.proxy.ProxyStatistics

public class ProxyStatistics
extends java.lang.Object

ProxyStatistics object is used to track statistics collected during the proxy execution to report to the user via an HTTP request directed to the proxy itself, rather than meant for a remote host or port


Field Summary
static int FAILURE
           
static int STOPPED
           
static int SUCCESS
           
 
Method Summary
 void addDuration(double duration)
          add a duration measurement to the collection of statistics
 double getDurationAvg()
           
 double getDurationCnt()
           
 double getDurationMax()
           
 double getDurationMin()
           
 double getDurationStdDev()
          Calculate Standard Deviation as the SQRT of variance based on the formula from:
WIKI Variance Calculation Page: Algorithm II
 long getFailureTransactions()
          get failed transaction count
 java.lang.String getHTMLPage()
          Get the html page for this request
 Proxy getProxy()
          Get Proxy for this statistic collector
static ProxyStatistics getSingleton()
           
 long getStoppedTransactions()
          get stopped transaction count, this is a stop due to one of the HttpMessageProcessor rules denying the continuation of the exchange
 long getSuccessTransactions()
          get successful transaction count
 java.lang.String getTitle()
          get title of web pages returned
 long getTransactionCount()
          get transaction count
 void incrementTransactionCount(int status)
          increment transaction count
 void reset()
          reset all counters to init values
 void setProxy(Proxy p)
          Set Proxy object to query
 void setTitle(java.lang.String t)
          set title of web pages returned
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUCCESS

public static final int SUCCESS
See Also:
Constant Field Values

FAILURE

public static final int FAILURE
See Also:
Constant Field Values

STOPPED

public static final int STOPPED
See Also:
Constant Field Values
Method Detail

getSingleton

public static ProxyStatistics getSingleton()

reset

public void reset()
reset all counters to init values


setTitle

public void setTitle(java.lang.String t)
set title of web pages returned


getTitle

public java.lang.String getTitle()
get title of web pages returned


getSuccessTransactions

public long getSuccessTransactions()
get successful transaction count


getFailureTransactions

public long getFailureTransactions()
get failed transaction count


getStoppedTransactions

public long getStoppedTransactions()
get stopped transaction count, this is a stop due to one of the HttpMessageProcessor rules denying the continuation of the exchange


incrementTransactionCount

public void incrementTransactionCount(int status)
                               throws java.lang.IllegalArgumentException
increment transaction count

Throws:
java.lang.IllegalArgumentException

getTransactionCount

public long getTransactionCount()
get transaction count


addDuration

public void addDuration(double duration)
add a duration measurement to the collection of statistics


getDurationCnt

public double getDurationCnt()

getDurationMin

public double getDurationMin()

getDurationMax

public double getDurationMax()

getDurationAvg

public double getDurationAvg()

getDurationStdDev

public double getDurationStdDev()
Calculate Standard Deviation as the SQRT of variance based on the formula from:
WIKI Variance Calculation Page: Algorithm II

 double mean = getDurationAvg();
 double sum = 0.0;
 for( int i=0; i< durations.size(); i++ ) {
 double duration = durations.elementAt(i);
 sum += Math.pow(duration - mean, 2);
 }
 stdDevDuration = Math.sqrt( sum / (durations.size() -1) );
 

note: Future calculations of this may change based on the whims of man


setProxy

public void setProxy(Proxy p)
Set Proxy object to query


getProxy

public Proxy getProxy()
Get Proxy for this statistic collector


getHTMLPage

public java.lang.String getHTMLPage()
Get the html page for this request


Java HTTP Proxy Library Project Page
SourceForge.net Logo