/** * {@link net.grinder.engine.process.GrinderProcess} calls {@link #setExecutionStartTime} just before launching * threads, after which it is never called again. */ public void setExecutionStartTime() { m_executionStartTime = m_timeAuthority.getTimeInMilliseconds(); }
/** * Elapsed time since execution was started. * * @return The time in milliseconds. * @see #getExecutionStartTime() */ public long getElapsedTime() { return m_timeAuthority.getTimeInMilliseconds() - getExecutionStartTime(); }
/** * {@link GrinderProcess} calls {@link #setExecutionStartTime} just * before launching threads, after which it is never called again. */ public void setExecutionStartTime() { m_executionStartTime = m_timeAuthority.getTimeInMilliseconds(); }
/** * {@inheritDoc} */ @Override public long getTimeInMilliseconds() { return m_timeAuthority.getTimeInMilliseconds(); }
@Override public long getTimeInMilliseconds() { return m_timeAuthority.getTimeInMilliseconds(); } }
/** * Elapsed time since execution was started. * * @return The time in milliseconds. * @see #getExecutionStartTime() */ public long getElapsedTime() { return m_timeAuthority.getTimeInMilliseconds() - getExecutionStartTime(); }
public long getElapsedTime() { if (m_startTime == -1) { return -1; } final long unadjustedTime; if (m_dispatchTime == -1) { unadjustedTime = m_timeAuthority.getTimeInMilliseconds() - m_startTime; } else { unadjustedTime = m_dispatchTime; } return Math.max(unadjustedTime - m_pauseTimer.getTime(), 0); }
private void doSleep(long time) throws ShutdownException { final long factoredTime = (long)(time * m_factor); if (m_logger != null) { m_logger.info("sleeping for {} ms", factoredTime); } if (time > 0) { long currentTime = m_timeAuthority.getTimeInMilliseconds(); final long wakeUpTime = currentTime + factoredTime; while (currentTime < wakeUpTime) { synchronized (m_condition) { checkShutdown(); m_condition.waitNoInterrruptException(wakeUpTime - currentTime); } currentTime = m_timeAuthority.getTimeInMilliseconds(); } } }
public void start() { if (isRunning()) { throw new StopWatchRunningException("Already running"); } m_startTime = m_timeAuthority.getTimeInMilliseconds(); }
public void stop() { if (!isRunning()) { throw new StopWatchNotRunningException("Not running"); } m_time = m_time + m_timeAuthority.getTimeInMilliseconds() - m_startTime; m_startTime = -1; }
public void start() throws DispatchStateException { if (m_startTime != -1 || m_dispatchTime != -1) { throw new DispatchStateException("Last statistics were not reported"); } m_pauseTimer.reset(); m_statisticsForTest = new StatisticsForTestImplementation( this, m_testStatisticsHelper, m_statisticsSetFactory.create()); // Make it more likely that the timed section has a "clear run". Thread.yield(); m_startTime = m_timeAuthority.getTimeInMilliseconds(); }
public void end(boolean success) { m_dispatchTime = Math.max(m_timeAuthority.getTimeInMilliseconds() - m_startTime, 0); if (m_pauseTimer.isRunning()) { m_pauseTimer.stop(); } if (!success && m_statisticsForTest != null) { // Always mark as an error if the test threw an exception. m_testStatisticsHelper.setSuccess( m_statisticsForTest.getStatistics(), false); // We don't log the exception. If the script doesn't handle the // exception it will be logged when the run is aborted, // otherwise we assume the script writer knows what they're // doing. } }
final long now = m_timeAuthority.getTimeInMilliseconds();