Skip to content

Add a thread variable __jmv_THREAD_START_TIME_ITERATION to compute a Pacing time for a iteration #6319

Description

@vdaburon

Use case

Add a thread variable __jmv_THREAD_START_TIME_ITERATION that contains the System.currentTimeMillis() when the iteration start for the current thread (or the variable name : __jmv_START_TIME_ITERATION)

This thread variable will useful for a new Pacing Timer or Pacing Pause

The pacing is the minimum time before the next iteration.

The Pacing Timer will dynamically compute the waiting time to add the duration of current iteration to the pacing time.
E.g:
Pacing 30 sec and the current time duration for the thread is 25 sec, we will add dynamically 5 sec.

Pacing 30 sec and the current time duration for the thread is 20 sec, we will add dynamically 10 sec.

Pacing 30 sec and the current time duration for the thread is 32 sec, we will add dynamically 0 sec because the current time duration is greater than the Pacing time.

Current time iteration duration for the thread is (System.currentTime() - Long.parseLong(__jmv_THREAD_START_TIME_ITERATION )).

Possible solution

Add a new variable in JMeterVariables classe likes :

private long startTimeIteration = resetStartTimeIteration();

and setter getter :
public void resetStartTimeIteration() {
      startTimeIteration = System.currentTimeMillis();
}

public long getStartTimeIteration() {
    return startTimeIteration;
}
======================================

This variable is Unmodifiable JMeter Variables. Add in UnmodifiableJMeterVariables classe

@Override public int getStartTimeIteration() { return variables.getStartTimeIteration(); }
@Override
public int resetStartTimeIteration() {
    throw new UnsupportedOperationException();
}
======================================

Maybe in JMeterThread classe

void notifyTestListeners() {
threadVars.incIteration();
threadVars.resetStartTimeIteration();
for (TestIterationListener listener : testIterationStartListeners) {

Possible workarounds

No response

JMeter Version

6.0

Java Version

open JDK 17

OS Version

All OS

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions