Apache JMeter
2.1.1

org.apache.jmeter.visualizers
Class SamplingStatCalculator

java.lang.Object
  extended byorg.apache.jmeter.visualizers.SamplingStatCalculator
All Implemented Interfaces:
Serializable

public class SamplingStatCalculator
extends Object
implements Serializable

Aggegate sample data container. Just instantiate a new instance of this class, and then call addSample(SampleResult) a few times, and pull the stats out with whatever methods you prefer.

Version:
$Revision: 1.7.2.1 $
Author:
James Boutcher
See Also:
Serialized Form

Constructor Summary
SamplingStatCalculator(SamplingStatCalculator stat)
          Essentially a copy function
SamplingStatCalculator(String label)
          Use this constructor.
 
Method Summary
 Sample addSample(SampleResult res)
          Records a sample.
 void addSamples(SamplingStatCalculator ssc)
           
 void clear()
          Clear the counters (useful for differential stats)
 int getCount()
           
 Sample getCurrentSample()
           
 HashMap getDistribution()
           
 long getElapsed()
          Get the elapsed time for the samples
 long getErrorCount()
           
 double getErrorPercentage()
          Returns the raw double value of the percentage of samples with errors that were recorded.
 String getErrorPercentageString()
          Returns a String which represents the percentage of sample errors that have occurred. ("0.00%" through "100.00%")
 String getLabel()
           
 Number getMax()
           
 double getMaxThroughput()
           
 double getMean()
           
 Number getMeanAsNumber()
           
 Number getMedian()
           
 Number getMin()
           
 double getPageSize()
          calculates the average page size, which means divide the bytes by number of samples.
 String getPageSizeString()
          formats the rate
 Number getPercentPoint(double percent)
           
 Number getPercentPoint(float percent)
           
 double getRate()
          Returns the throughput associated to this sampler in requests per second.
 String getRateString()
          Returns a String that represents the throughput associated for this sampler, in units appropriate to its dimension: The number is represented in requests/second or requests/minute or requests/hour.
 Sample getSample(int index)
           
 List getSamples()
           
 double getStandardDeviation()
           
 String toString()
          For debugging purposes, mainly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SamplingStatCalculator

public SamplingStatCalculator(String label)
Use this constructor.


SamplingStatCalculator

public SamplingStatCalculator(SamplingStatCalculator stat)
Essentially a copy function

Parameters:
stat -
Method Detail

addSamples

public void addSamples(SamplingStatCalculator ssc)

clear

public void clear()
Clear the counters (useful for differential stats)


getCurrentSample

public Sample getCurrentSample()

getElapsed

public long getElapsed()
Get the elapsed time for the samples

Returns:
how long the samples took

getRate

public double getRate()
Returns the throughput associated to this sampler in requests per second. May be slightly skewed because it takes the timestamps of the first and last samples as the total time passed, and the test may actually have started before that start time and ended after that end time.


getRateString

public String getRateString()
Returns a String that represents the throughput associated for this sampler, in units appropriate to its dimension:

The number is represented in requests/second or requests/minute or requests/hour.

Examples: "34.2/sec" "0.1/sec" "43.0/hour" "15.9/min"

Returns:
a String representation of the rate the samples are being taken at.

getPageSize

public double getPageSize()
calculates the average page size, which means divide the bytes by number of samples.

Returns:

getPageSizeString

public String getPageSizeString()
formats the rate

Returns:

getLabel

public String getLabel()

addSample

public Sample addSample(SampleResult res)
Records a sample.


getSamples

public List getSamples()

getSample

public Sample getSample(int index)

getErrorPercentage

public double getErrorPercentage()
Returns the raw double value of the percentage of samples with errors that were recorded. (Between 0.0 and 1.0) If you want a nicer return format, see getErrorPercentageString().

Returns:
the raw double value of the percentage of samples with errors that were recorded.

getErrorPercentageString

public String getErrorPercentageString()
Returns a String which represents the percentage of sample errors that have occurred. ("0.00%" through "100.00%")

Returns:
a String which represents the percentage of sample errors that have occurred.

toString

public String toString()
For debugging purposes, mainly.


getErrorCount

public long getErrorCount()
Returns:
errorCount

getMaxThroughput

public double getMaxThroughput()
Returns:
Returns the maxThroughput.

getDistribution

public HashMap getDistribution()
Returns:

getPercentPoint

public Number getPercentPoint(double percent)
Parameters:
percent -
Returns:

getCount

public int getCount()
Returns:

getMax

public Number getMax()
Returns:

getMean

public double getMean()
Returns:

getMeanAsNumber

public Number getMeanAsNumber()

getMedian

public Number getMedian()
Returns:

getMin

public Number getMin()
Returns:

getPercentPoint

public Number getPercentPoint(float percent)
Parameters:
percent -
Returns:

getStandardDeviation

public double getStandardDeviation()
Returns:

Apache JMeter
2.1.1

Copyright © 1998-2005 Apache Software Foundation. All Rights Reserved.