org.apache.jmeter.control

## Class ThroughputController

- java.lang.Object
- - org.apache.jmeter.testelement.AbstractTestElement
  - - org.apache.jmeter.control.GenericController
    - - org.apache.jmeter.control.ThroughputController

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Controller, LoopIterationListener, Searchable, TestElement, TestStateListener, TestCompilerHelper

      public class ThroughputController
      extends GenericController
      implements java.io.Serializable, LoopIterationListener, TestStateListener

  This class represents a controller that can control the number of times that it is executed, either by the total number of times the user wants the controller executed (BYNUMBER) or by the percentage of time it is called (BYPERCENT) The current implementation executes the first N samples (BYNUMBER) or the last N% of samples (BYPERCENT).
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `BYNUMBER`
    `static int` | `BYPERCENT`

    - ### Fields inherited from class org.apache.jmeter.control.GenericController

      `current, subControllersAndSamplers`

    - ### Fields inherited from interface org.apache.jmeter.testelement.TestElement

      `COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ThroughputController()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `clone()`
    `java.lang.String` | `getMaxThroughput()`
    `protected int` | `getMaxThroughputAsInt()`
    `java.lang.String` | `getPercentThroughput()`
    `protected float` | `getPercentThroughputAsFloat()`
    `int` | `getStyle()`
    `boolean` | `isDone()` Indicates whether the Controller is done delivering Samplers for the rest of the test.
    `boolean` | `isPerThread()`
    `void` | `iterationStart(LoopIterationEvent iterEvent)` Called when a loop iteration is about to start.
    `Sampler` | `next()` Determines the next sampler to be processed.
    `protected java.lang.Object` | `readResolve()`
    `void` | `setMaxThroughput(int maxThroughput)`
    `void` | `setMaxThroughput(java.lang.String maxThroughput)`
    `void` | `setPercentThroughput(float percentThroughput)`
    `void` | `setPercentThroughput(java.lang.String percentThroughput)`
    `void` | `setPerThread(boolean perThread)`
    `void` | `setStyle(int style)`
    `void` | `testEnded()` Called once for all threads after the end of a test.
    `void` | `testEnded(java.lang.String host)` Called once for all threads after the end of a test.
    `void` | `testStarted()` Called just before the start of the test from the main engine thread.
    `void` | `testStarted(java.lang.String host)` Called just before the start of the test from the main engine thread.

    - ### Methods inherited from class org.apache.jmeter.control.GenericController

      `addIterationListener, addTestElement, addTestElementOnce, currentReturnedNull, fireIterationStart, fireIterEvents, getCurrentElement, getIterCount, getSubControllers, incrementCurrent, incrementIterCount, initialize, initializeSubControllers, isFirst, nextIsAController, nextIsASampler, nextIsNull, reInitialize, removeCurrentElement, removeIterationListener, resetCurrent, resetIterCount, setCurrentElement, setDone, setFirst, triggerEndOfLoop`

    - ### Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement

      `addPropertiesValues, addProperty, addProperty, canRemove, clear, clearTemporary, clearTestElementChildren, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty`

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

      `finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.jmeter.testelement.TestElement

      `canRemove, clear, clearTestElementChildren, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removed, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse`

- - ### Field Detail

    - #### BYNUMBER

          public static final int BYNUMBER

      See Also:
        Constant Field Values

    - #### BYPERCENT

          public static final int BYPERCENT

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ThroughputController

          public ThroughputController()

  - ### Method Detail

    - #### setStyle

          public void setStyle(int style)

    - #### getStyle

          public int getStyle()

    - #### setPerThread

          public void setPerThread(boolean perThread)

    - #### isPerThread

          public boolean isPerThread()

    - #### setMaxThroughput

          public void setMaxThroughput(int maxThroughput)

    - #### setMaxThroughput

          public void setMaxThroughput(java.lang.String maxThroughput)

    - #### getMaxThroughput

          public java.lang.String getMaxThroughput()

    - #### getMaxThroughputAsInt

          protected int getMaxThroughputAsInt()

    - #### setPercentThroughput

          public void setPercentThroughput(float percentThroughput)

    - #### setPercentThroughput

          public void setPercentThroughput(java.lang.String percentThroughput)

    - #### getPercentThroughput

          public java.lang.String getPercentThroughput()

    - #### getPercentThroughputAsFloat

          protected float getPercentThroughputAsFloat()

    - #### next

          public Sampler next()

      Description copied from class: `GenericController`

      Determines the next sampler to be processed.

      If `GenericController.isDone()` is `true`, returns null.

      Gets the list element using current pointer. If this is `null`, calls `GenericController.nextIsNull()`.

      If the list element is a `Sampler`, calls `GenericController.nextIsASampler(Sampler)`, otherwise calls `GenericController.nextIsAController(Controller)`

      If any of the called methods throws `NextIsNullException`, returns `null`, otherwise the value obtained above is returned.

      Specified by:
        `next` in interface `Controller`
      Overrides:
        `next` in class `GenericController`
      Returns:
        the next sampler or `null`

    - #### isDone

          public boolean isDone()

      Description copied from interface: `Controller`
      Indicates whether the Controller is done delivering Samplers for the rest of the test. When the top-level controller returns true to JMeterThread, the thread is complete.
      Specified by:
        `isDone` in interface `Controller`
      Overrides:
        `isDone` in class `GenericController`
      Returns:
        boolean
      See Also:
        `Controller.isDone()`

    - #### clone

          public java.lang.Object clone()

      Specified by:
        `clone` in interface `TestElement`
      Overrides:
        `clone` in class `AbstractTestElement`

    - #### iterationStart

          public void iterationStart(LoopIterationEvent iterEvent)

      Description copied from interface: `LoopIterationListener`
      Called when a loop iteration is about to start.
      Specified by:
        `iterationStart` in interface `LoopIterationListener`
      Parameters:
        `iterEvent` - the event

    - #### testStarted

          public void testStarted()

      Description copied from interface: `TestStateListener`

      Called just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point.

      N.B. testStarted() and testEnded() are called from different threads.

      Specified by:
        `testStarted` in interface `TestStateListener`
      See Also:
        `StandardJMeterEngine.run()`

    - #### testStarted

          public void testStarted(java.lang.String host)

      Description copied from interface: `TestStateListener`

      Called just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point.

      N.B. testStarted() and testEnded() are called from different threads.

      Specified by:
        `testStarted` in interface `TestStateListener`
      Parameters:
        `host` - name of host
      See Also:
        `StandardJMeterEngine.run()`

    - #### testEnded

          public void testEnded()

      Description copied from interface: `TestStateListener`

      Called once for all threads after the end of a test. This will use the same element instances as at the start of the test.

      N.B. testStarted() and testEnded() are called from different threads.

      Specified by:
        `testEnded` in interface `TestStateListener`
      See Also:
        `StandardJMeterEngine.stopTest()`

    - #### testEnded

          public void testEnded(java.lang.String host)

      Description copied from interface: `TestStateListener`

      Called once for all threads after the end of a test. This will use the same element instances as at the start of the test.

      N.B. testStarted() and testEnded() are called from different threads.

      Specified by:
        `testEnded` in interface `TestStateListener`
      Parameters:
        `host` - name of host
      See Also:
        `StandardJMeterEngine.stopTest()`

    - #### readResolve

          protected java.lang.Object readResolve()

      Overrides:
        `readResolve` in class `GenericController`

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