org.apache.commons.performance
Class Statistics

java.lang.Object
  extended by org.apache.commons.performance.Statistics
All Implemented Interfaces:
Serializable

public class Statistics
extends Object
implements Serializable

Container for SummaryStatistics accumulated during ClientThread executions.

Maintains a HashMap of SummaryStatistics instances with a composite key of the form (process,type). "Process" typically identifies the client thread and "type" identifies the metric - e.g., "latency", "numActive."

ClientThread.run() adds one SummaryStatistics instance, with key = (current thread id,"latency").

See Also:
Serialized Form

Constructor Summary
Statistics()
           
 
Method Summary
 void addStatistics(SummaryStatistics stats, String process, String type)
          Adds the results of the given SummaryStatistics instance under the key
 String displayOverallSummary()
          Computes and formats display of summary statistics by type, across processes.
 String displayProcessStatistics(String process)
          Displays statistics for the given process
 SummaryStatistics getMaxSummary(String type)
          Returns SummaryStatistics for the maximum of the given metric across processes.
 SummaryStatistics getMeanSummary(String type)
          Returns a SummaryStatistics instance describing the mean of the given metric across processes - i.e., the "mean of the means", the "min of the means" etc.
 SummaryStatistics getMinSummary(String type)
          Returns SummaryStatistics for the minimum of the given metric across processes.
 List<String> getProcesses()
          Returns the List of processes corresponding to statistics.
 SummaryStatistics getStatistics(String process, String type)
          Retrieves the SummaryStatistics corresponding to the given process and type, if this exists; null otherwise.
 List<SummaryStatistics> getStatisticsByProcess(String process)
          Returns the full list of SummaryStatistics corresponding to the given process - i.e, the list of statistics of of different types maintained for the given process.
 List<SummaryStatistics> getStatisticsByType(String type)
          Returns the full list of SummaryStatistics corresponding to the given type - i.e, the list of statistics of the given type across processes.
 SummaryStatistics getStdSummary(String type)
          Returns SummaryStatistics for the standard deviation of the given metric across processes.
 List<String> getTypes()
          Returns the List of types corresponding to statistics.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Statistics

public Statistics()
Method Detail

addStatistics

public void addStatistics(SummaryStatistics stats,
                          String process,
                          String type)
Adds the results of the given SummaryStatistics instance under the key

Parameters:
stats - the SummaryStatistics whose results we are adding
process - name of the associated process
type - description of the associated metric

getStatistics

public SummaryStatistics getStatistics(String process,
                                       String type)
Retrieves the SummaryStatistics corresponding to the given process and type, if this exists; null otherwise.

Parameters:
process - name of the associated process
type - description of the associated metric
Returns:
SummaryStatistics for the given ; null if there is no such element in the container

getStatisticsByType

public List<SummaryStatistics> getStatisticsByType(String type)
Returns the full list of SummaryStatistics corresponding to the given type - i.e, the list of statistics of the given type across processes. For example, getStatisticsByType("latency") will return a list of latency summaries, one for each process, assuming "latency" is the name of an accumulated metric.

Parameters:
type - the type value to get statistics for
Returns:
the List of SummaryStatistics stored under the given type

getStatisticsByProcess

public List<SummaryStatistics> getStatisticsByProcess(String process)
Returns the full list of SummaryStatistics corresponding to the given process - i.e, the list of statistics of of different types maintained for the given process.

Parameters:
process - the process to get statistics for
Returns:
the List of SummaryStatistics for the given process

getMeanSummary

public SummaryStatistics getMeanSummary(String type)

Returns a SummaryStatistics instance describing the mean of the given metric across processes - i.e., the "mean of the means", the "min of the means" etc. More precisely, the returned SummaryStatistics describes the distribution of the individual process means for the given metric.

The same results could be obtained by iterating over the result of {getStatisticsByType(String) for the given type, extracting the mean and adding its value to a SummaryStatistics instance.

Parameters:
type - the metric to get summary mean statistics for
Returns:
a SummaryStatistics instance describing the process means for the given metric

getStdSummary

public SummaryStatistics getStdSummary(String type)
Returns SummaryStatistics for the standard deviation of the given metric across processes.

Parameters:
type - the metric to get summary standard deviation statistics for
Returns:
a SummaryStatistics instance describing the process standard deviations for the given metric
See Also:
getMeanSummary(String)

getMinSummary

public SummaryStatistics getMinSummary(String type)
Returns SummaryStatistics for the minimum of the given metric across processes.

Parameters:
type - the metric to get summary minimum statistics for
Returns:
a SummaryStatistics instance describing the process minima for the given metric
See Also:
getMeanSummary(String)

getMaxSummary

public SummaryStatistics getMaxSummary(String type)
Returns SummaryStatistics for the maximum of the given metric across processes.

Parameters:
type - the metric to get summary maximum statistics for
Returns:
a SummaryStatistics describing the process maxima for the given metric
See Also:
getMeanSummary(String)

getProcesses

public List<String> getProcesses()
Returns the List of processes corresponding to statistics.

Returns:
List of processes represented in the container

getTypes

public List<String> getTypes()
Returns the List of types corresponding to statistics.

Returns:
List of types represented in the container

displayOverallSummary

public String displayOverallSummary()
Computes and formats display of summary statistics by type, across processes.

Returns:
String representing summaries for each metric

displayProcessStatistics

public String displayProcessStatistics(String process)
Displays statistics for the given process

Parameters:
process - the process to retrieve metrics for
Returns:
String representing all currently defined statistics for the given process


Copyright © 2007-2010 The Apache Software Foundation. All Rights Reserved.