Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addfix #36

Merged
merged 2 commits into from
Sep 21, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions locust/stats.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import time
import gevent
from copy import copy
import math

import events
from exception import InterruptLocust
Expand Down Expand Up @@ -124,9 +123,9 @@ def avg_response_time(self):
def median_response_time(self):
if not self.response_times:
return 0

return median_from_dict(self.num_reqs, self.response_times)

@property
def current_rps(self):
if self.global_last_request_timestamp is None:
Expand All @@ -149,14 +148,15 @@ def avg_content_length(self):
return self.total_content_length / self.num_reqs
except ZeroDivisionError:
return 0

def __iadd__(self, other):
self.iadd_stats(other)

return self

def iadd_stats(self, other, full_request_history=False):
self.last_request_timestamp = max(self.last_request_timestamp, other.last_request_timestamp)
self.start_time = min(self.start_time, other.start_time)

self.num_reqs = self.num_reqs + other.num_reqs
self.num_failures = self.num_failures + other.num_failures
self.total_response_time = self.total_response_time + other.total_response_time
Expand Down