More accurate timing by setting stop stamp earlier

This commit is contained in:
Matt Martz 2016-05-16 11:35:31 -05:00
parent 050da542b3
commit c5f75f783e
1 changed files with 6 additions and 2 deletions

View File

@ -1012,8 +1012,10 @@ class Speedtest(object):
while cons_thread.isAlive(): while cons_thread.isAlive():
cons_thread.join(timeout=0.1) cons_thread.join(timeout=0.1)
stop = timeit.default_timer()
self.results.download = ( self.results.download = (
sum(finished) / (timeit.default_timer() - start) sum(finished) / (stop - start)
) )
if self.results.download > 100000: if self.results.download > 100000:
self.config['threads']['upload'] = 8 self.config['threads']['upload'] = 8
@ -1065,8 +1067,10 @@ class Speedtest(object):
while cons_thread.isAlive(): while cons_thread.isAlive():
cons_thread.join(timeout=0.1) cons_thread.join(timeout=0.1)
stop = timeit.default_timer()
self.results.upload = ( self.results.upload = (
sum(finished) / (timeit.default_timer() - start) sum(finished) / (stop - start)
) )
return self.results.upload return self.results.upload