SamplerMetric (Apache JMeter dist API)
Description: declaration: package: org.apache.jmeter.visualizers.backend, class: SamplerMetric

Package org.apache.jmeter.visualizers.backend

# Class SamplerMetric

java.lang.Object
org.apache.jmeter.visualizers.backend.SamplerMetric

public class SamplerMetric extends Object
Sampler metric

Since:
  2.13

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SamplerMetric()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `add(SampleResult result)`
  Add a `SampleResult` to be used in the statistics
  `void`
  `addCumulated(SampleResult result)`
  Add a `SampleResult` and its sub-results to be used in the statistics
  `double`
  `getAllMaxTime()`
  Get the maximal elapsed time for requests within sliding window
  `double`
  `getAllMean()`
  Get the arithmetic mean of the stored values
  `double`
  `getAllMinTime()`
  Get the minimal elapsed time for requests within sliding window
  `double`
  `getAllPercentile(double percentile)`
  Returns an estimate for the requested percentile of the stored values.
  `Map<ErrorMetric,Integer>`
  `getErrors()`
  Returns by type ( response code and message ) the count of errors occurs
  `int`
  `getFailures()`
  Get the number of failed requests for the current time slot
  `int`
  `getHits()`
  Returns hits to server
  `double`
  `getKoMaxTime()`
  Get the maximal elapsed time for requests within sliding window
  `double`
  `getKoMean()`
  Get the arithmetic mean of the stored values
  `double`
  `getKoMinTime()`
  Get the minimal elapsed time for requests within sliding window
  `double`
  `getKoPercentile(double percentile)`
  Returns an estimate for the requested percentile of the stored values.
  `double`
  `getOkMaxTime()`
  Get the maximal elapsed time for requests within sliding window
  `double`
  `getOkMean()`
  Get the arithmetic mean of the stored values
  `double`
  `getOkMinTime()`
  Get the minimal elapsed time for requests within sliding window
  `double`
  `getOkPercentile(double percentile)`
  Returns an estimate for the requested percentile of the stored values.
  `long`
  `getReceivedBytes()`
  `long`
  `getSentBytes()`
  `int`
  `getSuccesses()`
  Get the number of successful requests for the current time slot
  `int`
  `getTotal()`
  Get the number of total requests for the current time slot
  `void`
  `resetForTimeInterval()`
  Reset metric except for percentile related data
  `static void`
  `setDefaultWindowMode(WindowMode windowMode)`
  Deprecated.
  only used for internal testing

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

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

- ## Constructor Details

  - ### SamplerMetric

    public SamplerMetric()

- ## Method Details

  - ### setDefaultWindowMode

    @Deprecated @VisibleForTesting(visibility=PRIVATE) public static void setDefaultWindowMode(WindowMode windowMode)
    Deprecated.
    only used for internal testing
    Set `WindowMode` to use for newly created metrics.
    Parameters:
      `windowMode` - new visibility mode

  - ### add

    public void add(SampleResult result)
    Add a `SampleResult` to be used in the statistics
    Parameters:
      `result` - `SampleResult` to be used

  - ### addCumulated

    public void addCumulated(SampleResult result)
    Add a `SampleResult` and its sub-results to be used in the statistics
    Parameters:
      `result` - `SampleResult` to be used

  - ### resetForTimeInterval

    public void resetForTimeInterval()
    Reset metric except for percentile related data

  - ### getTotal

    public int getTotal()
    Get the number of total requests for the current time slot
    Returns:
      number of total requests

  - ### getSuccesses

    public int getSuccesses()
    Get the number of successful requests for the current time slot
    Returns:
      number of successful requests

  - ### getFailures

    public int getFailures()
    Get the number of failed requests for the current time slot
    Returns:
      number of failed requests

  - ### getOkMaxTime

    public double getOkMaxTime()
    Get the maximal elapsed time for requests within sliding window
    Returns:
      the maximal elapsed time, or `0` if no requests have been added yet

  - ### getOkMinTime

    public double getOkMinTime()
    Get the minimal elapsed time for requests within sliding window
    Returns:
      the minTime, or `Long.MAX_VALUE` if no requests have been added yet

  - ### getOkMean

    public double getOkMean()
    Get the arithmetic mean of the stored values
    Returns:
      The arithmetic mean of the stored values

  - ### getOkPercentile

    public double getOkPercentile(double percentile)
    Returns an estimate for the requested percentile of the stored values.
    Parameters:
      `percentile` - the requested percentile (scaled from 0 - 100)
    Returns:
      Returns an estimate for the requested percentile of the stored values.

  - ### getKoMaxTime

    public double getKoMaxTime()
    Get the maximal elapsed time for requests within sliding window
    Returns:
      the maximal elapsed time, or `0` if no requests have been added yet

  - ### getKoMinTime

    public double getKoMinTime()
    Get the minimal elapsed time for requests within sliding window
    Returns:
      the minTime, or `Long.MAX_VALUE` if no requests have been added yet

  - ### getKoMean

    public double getKoMean()
    Get the arithmetic mean of the stored values
    Returns:
      The arithmetic mean of the stored values

  - ### getKoPercentile

    public double getKoPercentile(double percentile)
    Returns an estimate for the requested percentile of the stored values.
    Parameters:
      `percentile` - the requested percentile (scaled from 0 - 100)
    Returns:
      Returns an estimate for the requested percentile of the stored values.

  - ### getAllMaxTime

    public double getAllMaxTime()
    Get the maximal elapsed time for requests within sliding window
    Returns:
      the maximal elapsed time, or `0` if no requests have been added yet

  - ### getAllMinTime

    public double getAllMinTime()
    Get the minimal elapsed time for requests within sliding window
    Returns:
      the minTime, or `Long.MAX_VALUE` if no requests have been added yet

  - ### getAllMean

    public double getAllMean()
    Get the arithmetic mean of the stored values
    Returns:
      The arithmetic mean of the stored values

  - ### getAllPercentile

    public double getAllPercentile(double percentile)
    Returns an estimate for the requested percentile of the stored values.
    Parameters:
      `percentile` - the requested percentile (scaled from 0 - 100)
    Returns:
      Returns an estimate for the requested percentile of the stored values.

  - ### getHits

    public int getHits()
    Returns hits to server
    Returns:
      the hits

  - ### getErrors

    public Map<ErrorMetric,Integer> getErrors()
    Returns by type ( response code and message ) the count of errors occurs
    Returns:
      errors

  - ### getSentBytes

    public long getSentBytes()
    Returns:
      the sentBytes

  - ### getReceivedBytes

    public long getReceivedBytes()
    Returns:
      the receivedBytes