private int doRampUp(int rampUpInterval, int rampUpStep, int rampUpInitialThread, int rampUpInitialSleep) { int threadNumber = 0; int waitingTime; if (Grinder.grinder != null) { threadNumber = Math.max(Grinder.grinder.getThreadNumber(), 0); } try { waitingTime = getWaitingTime(rampUpInterval, rampUpStep, rampUpInitialThread, rampUpInitialSleep, threadNumber); if (waitingTime != 0) { if (Grinder.grinder != null) { Grinder.grinder.getLogger().info("thread-{} is sleeping {} ms for ramp-up", threadNumber, waitingTime); } sleeper.sleepNormal(waitingTime, 0); } return waitingTime; } catch (Sleeper.ShutdownException e) { throw new RuntimeException(e); } }
public int maximumBytes(int position) { final long now = m_sleeper.getTimeInMilliseconds(); m_sleeper.sleepNormal(m_sleepTime, 0);
/** * Shutdown all Sleepers that are currently constructed. */ public static synchronized void shutdownAllCurrentSleepers() { for (WeakReference<SleeperImplementation> reference : s_allSleepers) { final Sleeper sleeper = reference.get(); if (sleeper != null) { sleeper.shutdown(); } } s_allSleepers.clear(); }
m_sleeper.sleepFlat(m_properties.getLong("grinder.initialSleepTime", 0));
/** * Shut down the agent. */ public void shutdown() { m_sleeper.shutdown(); m_delegateAgent.shutdown(); }
public void sleep(long meanTime) throws GrinderException { m_sleeper.sleepNormal(meanTime); }
public void sleep(long meanTime, long sigma) throws GrinderException { m_sleeper.sleepNormal(meanTime, sigma); }
/** * Start the agent. * * @throws GrinderException If an error occurs. */ public void run() throws GrinderException { Runtime.getRuntime().addShutdownHook(m_shutdownHook); try { while (true) { m_delegateAgent.run(); m_logger.info("agent finished"); m_sleeper.sleepNormal(m_sleepTime); } } catch (ShutdownException e) { // Exiting. } }