Apache JMeter
2.2

org.apache.jmeter.util
Class Calculator

java.lang.Object
  extended byorg.apache.jmeter.util.Calculator

public class Calculator
extends Object

Class to calculate various items that don't require all previous results to be saved: - mean = average - standard deviation - minimum - maximum


Constructor Summary
Calculator()
           
Calculator(String label)
           
 
Method Summary
 void addBytes(long newValue)
           
 void addSample(SampleResult res)
           
 void addValue(long newValue)
           
 void clear()
           
 double getBytesPerSecond()
          Throughput in bytes / second
 int getCount()
           
 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 getKBPerSecondString()
          formats the Page Size
 String getLabel()
           
 long getMax()
           
 double getMean()
           
 Number getMeanAsNumber()
           
 long getMin()
           
 double getPageSize()
          calculates the average page size, which means divide the bytes by number of samples.
 String getPageSizeString()
          formats the rate
 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.
 double getStandardDeviation()
           
 long getTotalBytes()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Calculator

public Calculator()

Calculator

public Calculator(String label)
Method Detail

clear

public void clear()

addValue

public void addValue(long newValue)

addBytes

public void addBytes(long newValue)

addSample

public void addSample(SampleResult res)

getTotalBytes

public long getTotalBytes()

getMean

public double getMean()

getMeanAsNumber

public Number getMeanAsNumber()

getStandardDeviation

public double getStandardDeviation()

getMin

public long getMin()

getMax

public long getMax()

getCount

public int getCount()

getLabel

public String getLabel()

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.

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:

getBytesPerSecond

public double getBytesPerSecond()
Throughput in bytes / second

Returns:

getKBPerSecondString

public String getKBPerSecondString()
formats the Page Size

Returns:

Apache JMeter
2.2

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