> OctoPerf load testing - Counter documentation page. Configure a counter variable.

Source: https://api.octoperf.com/doc/design/edit-virtual-user/configuration/variables/counter/

# Counter Variable Configuration

![Counter Variable](https://api.octoperf.com/doc/design/edit-virtual-user/configuration/variables/img/counter-variable.png "Counter Variable"){ align=left }

The Counter Variable is used to generate numeric counters. It is set to `Start` value at initialization, incremented by `Increment` on each new iteration until it reaches `End`. 

!!! note
    A click on the blue variable name in the **Usage** section will copy it to the clipboard.

The value is shared between all virtual users running on the same load generator by default but you can [change this behavior](#behavior).

<div style="clear:both"></div>

!!! warning
    If your test is distributed across several load generators, each one will keep a counter of its own. In case you need a unique value, consider using a [large random variable](https://api.octoperf.com/doc/design/edit-virtual-user/configuration/variables/random/) or a [CSV variable](https://api.octoperf.com/doc/design/edit-virtual-user/configuration/variables/csv/) instead.

For each Counter Variable, you can edit:

| Property name    | Description |
|------------------| --- |
| Name             | The variable name. To inject it, use the `${...}` syntax. |
| Description      | The variable description text. |
| Start Value      | The Counter Variable starting value. |
| End Value        | The Counter Variable ending value. |
| Increment Value  | The Counter Variable increment, applied on each iteration. |
| Output Format    | The output format of the generated value. Leave blank for a simple number output. It uses the [java.text.DecimalFormat](https://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html). For example `000` generates numbers with at least 3 digits, and `USER_000` generates output of the form _USER_nnn_. |

## Behavior

![counter-variable-behavior](https://api.octoperf.com/doc/design/edit-virtual-user/configuration/variables/img/counter-variable-behavior.png)

| Name          | Description                                                  |
| ------------- | ------------------------------------------------------------ |
| Track counter | The Counter Variable can be local to each user if this is activated, making it an iteration counter for each VU. You can also use the [${__iterationNum} function](https://api.octoperf.com/doc/design/edit-virtual-user/functions/#__iterationnum) instead of this setting. |
| Reset counter | The Counter Variable will be reset to `Start` on every iteration. The counter will thus always contain `Start`. This can be useful as an initialization if you then use it in scripts during each iteration. |
