/**
* @see org.apache.jmeter.testelement.ThreadListener#iterationStarted(int)
*/
public synchronized void iterationStarted(int iterationCount)
{
JMeterVariables variables = vars.getVariables();
if(!perUser)
{
globalCounter++;
int value = start + (increment * globalCounter);
if(value > end)
{
globalCounter = 0;
value = start;
}
variables.put(getVarName(),Integer.toString(value));
}
else
{
String value = variables.get(getVarName());
if(value == null)
{
variables.put(getVarName(),Integer.toString(start));
}
else
{
try
{
int current = Integer.parseInt(value);
current += increment;
if(current > end)
{
current = start;
}
variables.put(getVarName(),Integer.toString(current));
}
catch(NumberFormatException e)
{
log.info("Bad number in Counter config",e);
}