net.sf.infrared.agent
Class AggregateApiTime

java.lang.Object
  extended bynet.sf.infrared.agent.AggregateApiTime
All Implemented Interfaces:
Cloneable, Serializable
Direct Known Subclasses:
ContextApiTime

public class AggregateApiTime
extends Object
implements Serializable, Cloneable

This class measures and stores the aggregate timing information and invocation count of an API execution.

This can be used to keep track of how many times an API was invoked and how much time it took on an aggregate.

See Also:
Serialized Form

Constructor Summary
AggregateApiTime()
          For castor mapping
AggregateApiTime(Api api)
           
AggregateApiTime(ApiTime someApi)
          Constructs a new AggregateApiTime object which can track aggregate execution times and invocation counts of the API represented by a given ApiTime object.
AggregateApiTime(String apiName, String apiType)
          Constructs a new AggregateApiTime object representing the specified apiName.
 
Method Summary
 boolean aggregate(ApiTime someApi)
          Aggregates the time taken by another invocation of this API.
 void aggregate(long execTime)
           
 void aggregate(long execTime, long execTimeExclusive)
           
 Object clone()
           
 double getAdjAverageTime()
           
 double getAdjAverageTimeExclusive()
           
 Api getApi()
           
 String getApiName()
          Gets the name of the api whose aggregate execution time is tracked by this object.
 String getApiType()
          Gets the type of the API represented by this ApiTime.
 double getAverageTime()
          Gets the aggregate execution time of the API represented by this object.
 double getAverageTimeExclusive()
           
 long getCount()
          Gets the number of times the API represnted by this object was invoked.
 long getFirstExecutionTime()
           
 long getFirstExecutionTimeExclusive()
           
 long getLastExecutionTime()
           
 long getLastExecutionTimeExclusive()
           
 long getMaxTime()
           
 long getMaxTimeExclusive()
           
 long getMinTime()
           
 long getMinTimeExclusive()
           
 SqlStatistics[] getSqlStatistics()
           
 SqlStatisticsMap getSqlStatisticsMap()
           
 long getTotalTime()
          Gets the total time taken for the execution of the API represented by this object.
 long getTotalTimeExclusive()
           
 String getTruncatedName()
           
 boolean hasSqlStatistics()
           
 void merge(AggregateApiTime other)
           
 void merge(AggregateApiTime other, IdMapper idMapper)
           
 void setApi(Api api)
           
 void setSqlStatistics(SqlStatistics[] sqlStatistics)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AggregateApiTime

public AggregateApiTime()
For castor mapping


AggregateApiTime

public AggregateApiTime(String apiName,
                        String apiType)
Constructs a new AggregateApiTime object representing the specified apiName. The newly constructed AggregateApiTime object will hvae totalTime and count attributes set to 0.

Parameters:
apiName - the name of the API which this object is going to represent

AggregateApiTime

public AggregateApiTime(Api api)

AggregateApiTime

public AggregateApiTime(ApiTime someApi)
Constructs a new AggregateApiTime object which can track aggregate execution times and invocation counts of the API represented by a given ApiTime object. The totalTime attribute of the newly constructed object will be set to the executionTime of the given ApiTime and the count attribute will be set to 1.

Parameters:
someApi -
Throws:
IllegalArgumentException - if someApi passed in is null or has executionTime not set yet
Method Detail

getApiName

public String getApiName()
Gets the name of the api whose aggregate execution time is tracked by this object.

Returns:
name of api, always non-null

getCount

public long getCount()
Gets the number of times the API represnted by this object was invoked.

Returns:
invocation count, never negative

getTotalTime

public long getTotalTime()
Gets the total time taken for the execution of the API represented by this object. This is the time taken by all invocations of this API

Returns:
total time

getTotalTimeExclusive

public long getTotalTimeExclusive()

getApiType

public String getApiType()
Gets the type of the API represented by this ApiTime.

Returns:
type of API, always non-null

aggregate

public boolean aggregate(ApiTime someApi)
Aggregates the time taken by another invocation of this API. Ignores the request if the ApiTime passed in is not representing the same API as this object. Also ignores the request if the executionTime of the ApiTime passed in is not set yet.

Parameters:
someApi -
Returns:
true if the time taken by the given api was aggregated, else false.

aggregate

public void aggregate(long execTime,
                      long execTimeExclusive)

aggregate

public void aggregate(long execTime)

merge

public void merge(AggregateApiTime other,
                  IdMapper idMapper)

merge

public void merge(AggregateApiTime other)

getAverageTime

public double getAverageTime()
Gets the aggregate execution time of the API represented by this object.

Returns:
aggregate execution time, 0 if this API has not yet been invoked.

getAverageTimeExclusive

public double getAverageTimeExclusive()

getMaxTime

public long getMaxTime()

getMaxTimeExclusive

public long getMaxTimeExclusive()

getMinTime

public long getMinTime()

getMinTimeExclusive

public long getMinTimeExclusive()

getLastExecutionTime

public long getLastExecutionTime()

getLastExecutionTimeExclusive

public long getLastExecutionTimeExclusive()

toString

public String toString()

getApi

public Api getApi()

setApi

public void setApi(Api api)

getFirstExecutionTime

public long getFirstExecutionTime()

getFirstExecutionTimeExclusive

public long getFirstExecutionTimeExclusive()

getSqlStatisticsMap

public SqlStatisticsMap getSqlStatisticsMap()

getSqlStatistics

public SqlStatistics[] getSqlStatistics()

setSqlStatistics

public void setSqlStatistics(SqlStatistics[] sqlStatistics)

hasSqlStatistics

public boolean hasSqlStatistics()

clone

public Object clone()

getAdjAverageTime

public double getAdjAverageTime()

getAdjAverageTimeExclusive

public double getAdjAverageTimeExclusive()

getTruncatedName

public String getTruncatedName()