net.java.dev.moskito.core.predefined
Class RequestOrientedStats

java.lang.Object
  extended by net.java.dev.moskito.core.producers.AbstractStats
      extended by net.java.dev.moskito.core.predefined.RequestOrientedStats
All Implemented Interfaces:
IStats
Direct Known Subclasses:
ActionStats, ServiceStats, ServletStats

public abstract class RequestOrientedStats
extends AbstractStats

This is an abstract class for all request oriented stats.

Author:
dvayanu

Field Summary
private  StatValue currentRequests
          Requests in this method / class right now.
private  StatValue errors
          Errors occured in this method / class and caught by the surrounding stub/skeleton.
private  StatValue lastRequest
          the last processed request
private  StatValue maxCurrentRequests
          Max current requests in this method / class.
private  StatValue maxTime
          Max request time
private  String methodName
          Name of the method.
private  StatValue minTime
          Min request time
private  Interval[] selectedIntervals
          All currently selected intervals.
private  StatValue totalRequests
          The number of total requests to this method / class.
private  StatValue totalTime
          The total time spent in this method / class.
 
Constructor Summary
RequestOrientedStats()
          Creates a new anonymous stats.
RequestOrientedStats(String aMethodName)
          Creates a new object with the given method name.
RequestOrientedStats(String aMethodName, Interval[] aSelectedIntervals)
           
 
Method Summary
 void addExecutionTime(long time)
          Adds messed execution time to the total execution time.
 void addRequest()
          Notifies about a new request.
 double getAverageRequestDuration()
          Returns the average time of the request execution duration.
 double getAverageRequestDuration(String intervalName)
           
 long getCurrentRequests()
           
 long getCurrentRequests(String intervalName)
           
 long getErrors()
           
 long getErrors(String intervalName)
           
 long getLastRequest()
           
 long getLastRequest(String intervalName)
           
 long getMaxCurrentRequests()
           
 long getMaxCurrentRequests(String intervalName)
           
 long getMaxTime(String intervalName)
           
 String getMethodName()
           
 long getMinTime(String intervalName)
           
 String getName()
          This method returns the name of this set of statistical values.
 Interval[] getSelectedIntervals()
           
 long getTotalRequests()
           
 long getTotalRequests(String intervalName)
           
 long getTotalTime()
           
 long getTotalTime(String intervalName)
           
 void notifyError()
          Notifies about an uncaught error.
 void notifyRequestFinished()
          Notifies that current request leaves the method body.
 void setMethodName(String string)
           
 void setSelectedIntervals(Interval[] selectedIntervals)
           
 String toStatsString(String intervalName)
          This method creates a human-readable textual representation of all statistical values in the given interval.
 String toString()
          A string representation of this object.
 String toString(String intervalName)
           
 
Methods inherited from class net.java.dev.moskito.core.producers.AbstractStats
createSnapshot, toStatsString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

selectedIntervals

private Interval[] selectedIntervals
All currently selected intervals.


methodName

private String methodName
Name of the method.


totalRequests

private StatValue totalRequests
The number of total requests to this method / class.


totalTime

private StatValue totalTime
The total time spent in this method / class.


currentRequests

private StatValue currentRequests
Requests in this method / class right now.


errors

private StatValue errors
Errors occured in this method / class and caught by the surrounding stub/skeleton.


maxCurrentRequests

private StatValue maxCurrentRequests
Max current requests in this method / class.


lastRequest

private StatValue lastRequest
the last processed request


minTime

private StatValue minTime
Min request time


maxTime

private StatValue maxTime
Max request time

Constructor Detail

RequestOrientedStats

public RequestOrientedStats(String aMethodName)
Creates a new object with the given method name.

Parameters:
aMethodName -

RequestOrientedStats

public RequestOrientedStats()
Creates a new anonymous stats.


RequestOrientedStats

public RequestOrientedStats(String aMethodName,
                            Interval[] aSelectedIntervals)
Method Detail

addRequest

public void addRequest()
Notifies about a new request.


notifyRequestFinished

public void notifyRequestFinished()
Notifies that current request leaves the method body.


notifyError

public void notifyError()
Notifies about an uncaught error.


addExecutionTime

public void addExecutionTime(long time)
Adds messed execution time to the total execution time.

Parameters:
time -

getAverageRequestDuration

public double getAverageRequestDuration()
Returns the average time of the request execution duration.

Returns:

getAverageRequestDuration

public double getAverageRequestDuration(String intervalName)

toString

public String toString()
A string representation of this object. It contains of a set of labels with according values. The labels are: TR, TT, CR, MCR, ERR and Avg Request Time.
TR - number of total requests.
TT - total execution time.
CR - current requests.
MCR - max concurrent requests.
ERR - number errors.
SL - number of sleeping requests.
MSL - max number of sleeping requests.
Avg Request Time - average request duration for this method.

Overrides:
toString in class Object

toStatsString

public String toStatsString(String intervalName)
Description copied from interface: IStats
This method creates a human-readable textual representation of all statistical values in the given interval.

Parameters:
intervalName - the name of the interval or null for all intervals
Returns:
the formatted text output

toString

public String toString(String intervalName)

getMethodName

public String getMethodName()
Returns:

setMethodName

public void setMethodName(String string)
Parameters:
string -

getTotalRequests

public long getTotalRequests(String intervalName)
Returns:

getTotalRequests

public long getTotalRequests()

getTotalTime

public long getTotalTime()
Returns:

getTotalTime

public long getTotalTime(String intervalName)

getCurrentRequests

public long getCurrentRequests(String intervalName)
Returns:

getCurrentRequests

public long getCurrentRequests()

getMaxCurrentRequests

public long getMaxCurrentRequests(String intervalName)
Returns:

getMaxCurrentRequests

public long getMaxCurrentRequests()

getErrors

public long getErrors()
Returns:

getErrors

public long getErrors(String intervalName)

getLastRequest

public long getLastRequest()

getLastRequest

public long getLastRequest(String intervalName)

getSelectedIntervals

public Interval[] getSelectedIntervals()

setSelectedIntervals

public void setSelectedIntervals(Interval[] selectedIntervals)

getMinTime

public long getMinTime(String intervalName)

getMaxTime

public long getMaxTime(String intervalName)

getName

public String getName()
Description copied from interface: IStats
This method returns the name of this set of statistical values.

Returns:
the name


Copyright © 2006 MoSKito Project Team. All Rights Reserved.
MoSKito, the open source java monitoring framework