@Test public void testDelay() { System.out.println("delay"); VariableThroughputTimer instance = new VariableThroughputTimer(); instance.setName("TEST"); long expResult = 0L; long result = instance.delay(); assertEquals(expResult, result); assertEquals("0", JMeterUtils.getProperty("TEST_totalDuration")); assertEquals("0", JMeterUtils.getProperty("TEST_cntDelayed")); assertEquals("0", JMeterUtils.getProperty("TEST_cntSent")); assertEquals("1.0", JMeterUtils.getProperty("TEST_rps")); }
public synchronized long delay() { while (true) { long curTimeMs = System.currentTimeMillis(); long millisSinceLastSecond = curTimeMs % 1000; long nowInMsRoundedAtSec = curTimeMs - millisSinceLastSecond; checkNextSecond(nowInMsRoundedAtSec); int delayMs = getDelay(millisSinceLastSecond); if (stopping) { delayMs = delayMs > 0 ? 10 : 0; notify(); } if (delayMs < 1) { notify(); break; } cntDelayed++; try { wait(delayMs); } catch (InterruptedException ex) { log.debug("Waiting thread was interrupted", ex); Thread.currentThread().interrupt(); } cntDelayed--; } cntSent++; return 0; }
VariableThroughputTimer extends AbstractTestElement implements Timer, NoThreadClone, TestStateListener { public synchronized long delay() { while (true) { long curTimeMs = System.currentTimeMillis(); long millisSinceLastSecond = curTimeMs % 1000; long nowInMsRoundedAtSec = curTimeMs - millisSinceLastSecond; checkNextSecond(nowInMsRoundedAtSec); int delayMs = getDelay(millisSinceLastSecond); if (stopping) { delayMs = delayMs > 0 ? 10 : 0; notify(); } if (delayMs < 1) { notify(); break; } cntDelayed++; try { wait(delayMs); } catch (InterruptedException ex) { log.debug("Waiting thread was interrupted", ex); Thread.currentThread().interrupt(); } cntDelayed--; } cntSent++; return 0; } }
VariableThroughputTimer extends AbstractTestElement implements Timer, NoThreadClone, TestStateListener { public synchronized long delay() { while (true) { long curTimeMs = System.currentTimeMillis(); long millisSinceLastSecond = curTimeMs % 1000; long nowInMsRoundedAtSec = curTimeMs - millisSinceLastSecond; checkNextSecond(nowInMsRoundedAtSec); int delayMs = getDelay(millisSinceLastSecond); if (stopping) { delayMs = delayMs > 0 ? 10 : 0; notify(); } if (delayMs < 1) { notify(); break; } cntDelayed++; try { wait(delayMs); } catch (InterruptedException ex) { log.debug("Waiting thread was interrupted", ex); Thread.currentThread().interrupt(); } cntDelayed--; } cntSent++; return 0; } VariableThroughputTimer(); }
VariableThroughputTimer extends AbstractTestElement implements Timer, NoThreadClone, TestStateListener { public synchronized long delay() { while (true) { long curTimeMs = System.currentTimeMillis(); long millisSinceLastSecond = curTimeMs % 1000; long nowInMsRoundedAtSec = curTimeMs - millisSinceLastSecond; checkNextSecond(nowInMsRoundedAtSec); int delayMs = getDelay(millisSinceLastSecond); if (stopping) { delayMs = delayMs > 0 ? 10 : 0; notify(); } if (delayMs < 1) { notify(); break; } cntDelayed++; try { wait(delayMs); } catch (InterruptedException ex) { log.debug("Waiting thread was interrupted", ex); Thread.currentThread().interrupt(); } cntDelayed--; } cntSent++; return 0; } VariableThroughputTimer(); synchronized long delay(); void setData(CollectionProperty rows); JMeterProperty getData(); Pair<Double, Long> getRPSForSecond(final double elapsedSinceStartOfTestSec); @Override void testStarted(); @Override void testStarted(String string); @Override void testEnded(); @Override void testEnded(String string); }
VariableThroughputTimer extends AbstractTestElement implements Timer, NoThreadClone, TestStateListener { public synchronized long delay() { while (true) { long curTimeMs = System.currentTimeMillis(); long millisSinceLastSecond = curTimeMs % 1000; long nowInMsRoundedAtSec = curTimeMs - millisSinceLastSecond; checkNextSecond(nowInMsRoundedAtSec); int delayMs = getDelay(millisSinceLastSecond); if (stopping) { delayMs = delayMs > 0 ? 10 : 0; notify(); } if (delayMs < 1) { notify(); break; } cntDelayed++; try { wait(delayMs); } catch (InterruptedException ex) { log.debug("Waiting thread was interrupted", ex); Thread.currentThread().interrupt(); } cntDelayed--; } cntSent++; return 0; } VariableThroughputTimer(); synchronized long delay(); void setData(CollectionProperty rows); JMeterProperty getData(); Pair<Double, Long> getRPSForSecond(final double elapsedSinceStartOfTestSec); @Override void testStarted(); @Override void testStarted(String string); @Override void testEnded(); @Override void testEnded(String string); static final String DATA_PROPERTY; static final int DURATION_FIELD_NO; static final int FROM_FIELD_NO; static final int TO_FIELD_NO; }