Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.jmeter.visualizers
Class SamplingStatCalculator  view SamplingStatCalculator download SamplingStatCalculator.java

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

public class SamplingStatCalculator
extends java.lang.Object
implements java.io.Serializable

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

Version:
$Revision: 1.7.2.1 $

Field Summary
private  org.apache.jorphan.math.StatCalculator calculator
           
private static java.text.DecimalFormat errorFormatter
           
private  long firstTime
           
private static java.text.DecimalFormat kbFormatter
           
private  java.lang.String label
           
(package private) static Logger log
           
private  double maxThroughput
           
private static java.text.DecimalFormat rateFormatter
           
private  java.util.List storedValues
           
 
Constructor Summary
private SamplingStatCalculator()
           
  SamplingStatCalculator(SamplingStatCalculator stat)
          Essentially a copy function
  SamplingStatCalculator(java.lang.String label)
          Use this constructor.
 
Method Summary
 Sample addSample(org.apache.jmeter.samplers.SampleResult res)
          Records a sample.
 void addSamples(SamplingStatCalculator ssc)
           
 void clear()
          Clear the counters (useful for differential stats)
 int getCount()
           
 Sample getCurrentSample()
           
 java.util.HashMap getDistribution()
           
 long getElapsed()
          Get the elapsed time for the samples
private  long getEndTime(org.apache.jmeter.samplers.SampleResult res)
           
 long getErrorCount()
           
 double getErrorPercentage()
          Returns the raw double value of the percentage of samples with errors that were recorded.
 java.lang.String getErrorPercentageString()
          Returns a String which represents the percentage of sample errors that have occurred.
 java.lang.String getLabel()
           
 java.lang.Number getMax()
           
 double getMaxThroughput()
           
 double getMean()
           
 java.lang.Number getMeanAsNumber()
           
 java.lang.Number getMedian()
           
 java.lang.Number getMin()
           
 double getPageSize()
          calculates the average page size, which means divide the bytes by number of samples.
 java.lang.String getPageSizeString()
          formats the rate
 java.lang.Number getPercentPoint(double percent)
           
 java.lang.Number getPercentPoint(float percent)
           
 double getRate()
          Returns the throughput associated to this sampler in requests per second.
 java.lang.String getRateString()
          Returns a String that represents the throughput associated for this sampler, in units appropriate to its dimension:
 Sample getSample(int index)
           
 java.util.List getSamples()
           
 double getStandardDeviation()
           
private  void init()
           
private  void setStartTime(org.apache.jmeter.samplers.SampleResult res)
           
 java.lang.String toString()
          For debugging purposes, mainly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

static Logger log

rateFormatter

private static java.text.DecimalFormat rateFormatter

errorFormatter

private static java.text.DecimalFormat errorFormatter

kbFormatter

private static java.text.DecimalFormat kbFormatter

calculator

private final org.apache.jorphan.math.StatCalculator calculator

storedValues

private final java.util.List storedValues

maxThroughput

private double maxThroughput

firstTime

private long firstTime

label

private java.lang.String label
Constructor Detail

SamplingStatCalculator

private SamplingStatCalculator()

SamplingStatCalculator

public SamplingStatCalculator(java.lang.String label)
Use this constructor.


SamplingStatCalculator

public SamplingStatCalculator(SamplingStatCalculator stat)
Essentially a copy function

Method Detail

init

private void init()

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


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 java.lang.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"


getPageSize

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


getPageSizeString

public java.lang.String getPageSizeString()
formats the rate


getLabel

public java.lang.String getLabel()

addSample

public Sample addSample(org.apache.jmeter.samplers.SampleResult res)
Records a sample.


getSamples

public java.util.List getSamples()

getSample

public Sample getSample(int index)

getEndTime

private long getEndTime(org.apache.jmeter.samplers.SampleResult res)

setStartTime

private void setStartTime(org.apache.jmeter.samplers.SampleResult res)

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() 55 .


getErrorPercentageString

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


toString

public java.lang.String toString()
For debugging purposes, mainly.


getErrorCount

public long getErrorCount()

getMaxThroughput

public double getMaxThroughput()

getDistribution

public java.util.HashMap getDistribution()

getPercentPoint

public java.lang.Number getPercentPoint(double percent)

getCount

public int getCount()

getMax

public java.lang.Number getMax()

getMean

public double getMean()

getMeanAsNumber

public java.lang.Number getMeanAsNumber()

getMedian

public java.lang.Number getMedian()

getMin

public java.lang.Number getMin()

getPercentPoint

public java.lang.Number getPercentPoint(float percent)

getStandardDeviation

public double getStandardDeviation()