org.apache.jmeter.visualizers

## Class SamplingStatCalculator

- java.lang.Object
- - org.apache.jmeter.visualizers.SamplingStatCalculator

- Direct Known Subclasses:
    CachingStatCalculator

      public class SamplingStatCalculator
      extends java.lang.Object

  Aggregate 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.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SamplingStatCalculator()`
    `SamplingStatCalculator(java.lang.String label)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Sample` | `addSample(SampleResult res)` Records a sample.
    `void` | `clear()` Clear the counters (useful for differential stats)
    `double` | `getAvgPageBytes()` calculates the average page size, which means divide the bytes by number of samples.
    `double` | `getBytesPerSecond()` Throughput in bytes / second
    `long` | `getCount()`
    `Sample` | `getCurrentSample()`
    `java.util.Map<java.lang.Number,java.lang.Number[]>` | `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.
    `double` | `getKBPerSecond()` Throughput in kilobytes / second
    `java.lang.String` | `getLabel()`
    `java.lang.Number` | `getMax()`
    `double` | `getMaxThroughput()`
    `double` | `getMean()`
    `java.lang.Number` | `getMeanAsNumber()`
    `java.lang.Number` | `getMedian()`
    `java.lang.Number` | `getMin()`
    `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.
    `double` | `getSentBytesPerSecond()` Sent Throughput in bytes / second
    `double` | `getSentKBPerSecond()` Sent Throughput in kilobytes / second
    `double` | `getStandardDeviation()`
    `java.lang.String` | `toString()` For debugging purposes, only.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### SamplingStatCalculator

          public SamplingStatCalculator()

    - #### SamplingStatCalculator

          public SamplingStatCalculator(java.lang.String label)

  - ### Method Detail

    - #### 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.
      Returns:
        throughput associated with this sampler per second

    - #### getBytesPerSecond

          public double getBytesPerSecond()

      Throughput in bytes / second
      Returns:
        throughput in bytes/second

    - #### getKBPerSecond

          public double getKBPerSecond()

      Throughput in kilobytes / second
      Returns:
        Throughput in kilobytes / second

    - #### getSentBytesPerSecond

          public double getSentBytesPerSecond()

      Sent Throughput in bytes / second
      Returns:
        sent throughput in bytes/second

    - #### getSentKBPerSecond

          public double getSentKBPerSecond()

      Sent Throughput in kilobytes / second
      Returns:
        Sent Throughput in kilobytes / second

    - #### getAvgPageBytes

          public double getAvgPageBytes()

      calculates the average page size, which means divide the bytes by number of samples.
      Returns:
        average page size in bytes (0 if sample count is zero)

    - #### getLabel

          public java.lang.String getLabel()

      Returns:
        the label of this component

    - #### addSample

          public Sample addSample(SampleResult res)

      Records a sample.
      Parameters:
        `res` - the sample to record
      Returns:
        newly created sample with current statistics

    - #### 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)
      Returns:
        the raw double value of the percentage of samples with errors that were recorded.

    - #### toString

          public java.lang.String toString()

      For debugging purposes, only.
      Overrides:
        `toString` in class `java.lang.Object`

    - #### getErrorCount

          public long getErrorCount()

      Returns:
        errorCount

    - #### getMaxThroughput

          public double getMaxThroughput()

      Returns:
        Returns the maxThroughput.

    - #### getDistribution

          public java.util.Map<java.lang.Number,java.lang.Number[]> getDistribution()

    - #### getPercentPoint

          public java.lang.Number getPercentPoint(double percent)

    - #### getCount

          public long 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()

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