From 6294d919f163a12536b21b9e42c074a48c17176d Mon Sep 17 00:00:00 2001 From: cava23 Date: Wed, 9 Jul 2014 15:07:54 -0400 Subject: [PATCH 1/2] Don't reset stats when hatching is complete --- locust/runners.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/locust/runners.py b/locust/runners.py index 9dd80dcc87..299425e04d 100644 --- a/locust/runners.py +++ b/locust/runners.py @@ -38,12 +38,16 @@ def __init__(self, locust_classes, options): self.exceptions = {} self.stats = global_stats - # register listener that resets stats when hatching is complete def on_hatch_complete(user_count): self.state = STATE_RUNNING - logger.info("Resetting stats\n") - self.stats.reset_all() + + #def on_hatch_start(user_count): + # reset stats when hatching starts since early hatched users could be making + # requests before hatching is complete + # logger.info("Resetting stats\n") + # self.stats.reset_all() events.hatch_complete += on_hatch_complete + #events.hatch_start += on_hatch_start @property def request_stats(self): @@ -96,6 +100,7 @@ def spawn_locusts(self, spawn_count=None, stop_timeout=None, wait=False): self.num_clients += spawn_count logger.info("Hatching and swarming %i clients at the rate %g clients/s..." % (spawn_count, self.hatch_rate)) + #events.hatch_start.fire(user_count=self.num_clients) occurence_count = dict([(l.__name__, 0) for l in self.locust_classes]) def hatch(): From 72ff2094f21cc930aa7b3dcf78b4c186b56d16a8 Mon Sep 17 00:00:00 2001 From: cava23 Date: Wed, 9 Jul 2014 16:10:57 -0400 Subject: [PATCH 2/2] clean up after testing --- locust/runners.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/locust/runners.py b/locust/runners.py index 299425e04d..e97a0a0992 100644 --- a/locust/runners.py +++ b/locust/runners.py @@ -40,14 +40,8 @@ def __init__(self, locust_classes, options): def on_hatch_complete(user_count): self.state = STATE_RUNNING - - #def on_hatch_start(user_count): - # reset stats when hatching starts since early hatched users could be making - # requests before hatching is complete - # logger.info("Resetting stats\n") - # self.stats.reset_all() + events.hatch_complete += on_hatch_complete - #events.hatch_start += on_hatch_start @property def request_stats(self): @@ -100,7 +94,6 @@ def spawn_locusts(self, spawn_count=None, stop_timeout=None, wait=False): self.num_clients += spawn_count logger.info("Hatching and swarming %i clients at the rate %g clients/s..." % (spawn_count, self.hatch_rate)) - #events.hatch_start.fire(user_count=self.num_clients) occurence_count = dict([(l.__name__, 0) for l in self.locust_classes]) def hatch():