Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
vdaburon opened this issue Jul 26, 2024 · 1 comment

Comments

@vdaburon
Copy link
Contributor

vdaburon commented Jul 26, 2024

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

@vdaburon vdaburon changed the title Add a thread variable __jmv_THEAD_START_TIME_ITERATION to compute a Pacing time for a iteration Add a thread variable __jmv_THREAD_START_TIME_ITERATION to compute a Pacing time for a iteration Sep 27, 2024
@vdaburon
Copy link
Contributor Author

This new feature is the pull request : #6356

@milamberspace milamberspace added this to the 6.0 milestone Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants