@Override protected void scheduleThread(JMeterThread thread, long tgStartTime) { log.debug("Scheduling thread: " + thread.getThreadName()); if (threadsToSchedule < 1) { if (!scheduleIT.hasNext()) { throw new RuntimeException("Not enough schedule records for thread #" + thread.getThreadName()); } currentRecord = (CollectionProperty) scheduleIT.next(); threadsToSchedule = currentRecord.get(0).getIntValue(); } int numThreads = currentRecord.get(START_THREADS_CNT_FIELD_NO).getIntValue(); int initialDelay = currentRecord.get(INIT_DELAY_FIELD_NO).getIntValue(); int startRampUp = currentRecord.get(STARTUP_TIME_FIELD_NO).getIntValue(); int flightTime = currentRecord.get(HOLD_LOAD_FOR_FIELD_NO).getIntValue(); int endRampUp = currentRecord.get(SHUTDOWN_TIME_FIELD_NO).getIntValue(); long ascentPoint = tgStartTime + 1000 * initialDelay; final int rampUpDelayForThread = (int) Math.floor(1000 * startRampUp * (double) threadsToSchedule / numThreads); long startTime = ascentPoint + rampUpDelayForThread; long descentPoint = startTime + 1000 * flightTime + 1000 * startRampUp - rampUpDelayForThread; thread.setStartTime(startTime); thread.setEndTime(descentPoint + (int) Math.floor(1000 * endRampUp * (double) threadsToSchedule / numThreads)); thread.setScheduled(true); threadsToSchedule--; }
@Override protected void scheduleThread(JMeterThread thread, long tgStartTime) { log.debug("Scheduling thread: " + thread.getThreadName()); if (threadsToSchedule < 1) { if (!scheduleIT.hasNext()) { throw new RuntimeException("Not enough schedule records for thread #" + thread.getThreadName()); } currentRecord = (CollectionProperty) scheduleIT.next(); threadsToSchedule = currentRecord.get(0).getIntValue(); } int numThreads = currentRecord.get(START_THREADS_CNT_FIELD_NO).getIntValue(); int initialDelay = currentRecord.get(INIT_DELAY_FIELD_NO).getIntValue(); int startRampUp = currentRecord.get(STARTUP_TIME_FIELD_NO).getIntValue(); int flightTime = currentRecord.get(HOLD_LOAD_FOR_FIELD_NO).getIntValue(); int endRampUp = currentRecord.get(SHUTDOWN_TIME_FIELD_NO).getIntValue(); long ascentPoint = tgStartTime + 1000 * initialDelay; final int rampUpDelayForThread = (int) Math.floor(1000 * startRampUp * (double) threadsToSchedule / numThreads); long startTime = ascentPoint + rampUpDelayForThread; long descentPoint = startTime + 1000 * flightTime + 1000 * startRampUp - rampUpDelayForThread; thread.setStartTime(startTime); thread.setEndTime(descentPoint + (int) Math.floor(1000 * endRampUp * (double) threadsToSchedule / numThreads)); thread.setScheduled(true); threadsToSchedule--; }
@Override protected void scheduleThread(JMeterThread thread, long tgStartTime) { log.debug("Scheduling thread: " + thread.getThreadName()); if (threadsToSchedule < 1) { if (!scheduleIT.hasNext()) { throw new RuntimeException("Not enough schedule records for thread #" + thread.getThreadName()); } currentRecord = (CollectionProperty) scheduleIT.next(); threadsToSchedule = currentRecord.get(0).getIntValue(); } int numThreads = currentRecord.get(START_THREADS_CNT_FIELD_NO).getIntValue(); int initialDelay = currentRecord.get(INIT_DELAY_FIELD_NO).getIntValue(); int startRampUp = currentRecord.get(STARTUP_TIME_FIELD_NO).getIntValue(); int flightTime = currentRecord.get(HOLD_LOAD_FOR_FIELD_NO).getIntValue(); int endRampUp = currentRecord.get(SHUTDOWN_TIME_FIELD_NO).getIntValue(); long ascentPoint = tgStartTime + 1000 * initialDelay; final int rampUpDelayForThread = (int) Math.floor(1000 * startRampUp * (double) threadsToSchedule / numThreads); long startTime = ascentPoint + rampUpDelayForThread; long descentPoint = startTime + 1000 * flightTime + 1000 * startRampUp - rampUpDelayForThread; thread.setStartTime(startTime); thread.setEndTime(descentPoint + (int) Math.floor(1000 * endRampUp * (double) threadsToSchedule / numThreads)); thread.setScheduled(true); threadsToSchedule--; }
thread.getThreadNum(), rampUpBucket, rampUpBucketThreadCount, rampUpBucketStartTime, rampUpBucketThreadPosition, rampUpDuration, iterationDuration, iterationCountTotal, ascentPoint, descentPoint, startTime, endTime)); thread.setStartTime(startTime); thread.setEndTime(endTime); thread.setScheduled(true);
thread.getThreadNum(), rampUpBucket, rampUpBucketThreadCount, rampUpBucketStartTime, rampUpBucketThreadPosition, rampUpDuration, iterationDuration, iterationCountTotal, ascentPoint, descentPoint, startTime, endTime)); thread.setStartTime(startTime); thread.setEndTime(endTime); thread.setScheduled(true);
thread.getThreadNum(), rampUpBucket, rampUpBucketThreadCount, rampUpBucketStartTime, rampUpBucketThreadPosition, rampUpDuration, iterationDuration, iterationCountTotal, ascentPoint, descentPoint, startTime, endTime)); thread.setStartTime(startTime); thread.setEndTime(endTime); thread.setScheduled(true);
/** * This will schedule the time for the JMeterThread. * * @param thread JMeterThread * @param now in milliseconds */ private void scheduleThread(JMeterThread thread, long now) { if (!getScheduler()) { // if the Scheduler is not enabled return; } if (getDelay() >= 0) { // Duration is in seconds thread.setStartTime(getDelay() * 1000 + now); } else { throw new JMeterStopTestException("Invalid delay " + getDelay() + " set in Thread Group:" + getName()); } // set the endtime for the Thread if (getDuration() > 0) {// Duration is in seconds thread.setEndTime(getDuration() * 1000 + (thread.getStartTime())); } else { throw new JMeterStopTestException("Invalid duration " + getDuration() + " set in Thread Group:" + getName()); } // Enables the scheduler thread.setScheduled(true); }