anil_jacob@... wrote:
> Philip mentioned a way to rampup Threads.
>
> Is there a way anyone knows how to rampup threads in step sizes, i.e. say 10 threads run for 10mins, add 10 more threads after 10mins, 10 more after another 10mins so on to X threads in X duration.
>
> Currently to achieve this I am having to use an external wrapper like ANT script which increments threads that grinder uses, however it means I have to stop Grinder after each step size.
>
> Thanks,
> Anil
You can use the same approach, just have groups of 10 threads start at once:
from net.grinder.script.Grinder import grinder
from net.grinder.common import Logger
def log(message):
"""Log to the console, the message will include the thread ID"""
grinder.logger.output(message, Logger.TERMINAL)
class TestRunner:
def __init__(self):
log("initialising")
def initialSleep( self):
sleepTime = (grinder.threadNumber % 10) * 5000 # Each group of threads starts 5 seconds apart
grinder.sleep(sleepTime, 0)
log("initial sleep complete, slept for around %d ms" % sleepTime)
def __call__( self ):
if grinder.runNumber == 0: self.initialSleep()
grinder.sleep(500)
log("in __call__()")
- Phil
|