check_speed: rearrange a bit to make it easy to disable certain portions
This commit is contained in:
parent
8377244c46
commit
f39f8ae032
|
@ -9,6 +9,10 @@ from foolscap import Tub, eventual
|
||||||
MB = 1000000
|
MB = 1000000
|
||||||
|
|
||||||
class SpeedTest:
|
class SpeedTest:
|
||||||
|
DO_IMMUTABLE = True
|
||||||
|
DO_MUTABLE_CREATE = True
|
||||||
|
DO_MUTABLE = True
|
||||||
|
|
||||||
def __init__(self, test_client_dir):
|
def __init__(self, test_client_dir):
|
||||||
#self.real_stderr = sys.stderr
|
#self.real_stderr = sys.stderr
|
||||||
log.startLogging(open("st.log", "a"), setStdout=False)
|
log.startLogging(open("st.log", "a"), setStdout=False)
|
||||||
|
@ -95,36 +99,42 @@ class SpeedTest:
|
||||||
d.addCallback(self.one_test, "startup", 1, 1000, False) #ignore this one
|
d.addCallback(self.one_test, "startup", 1, 1000, False) #ignore this one
|
||||||
d.addCallback(self.measure_rtt)
|
d.addCallback(self.measure_rtt)
|
||||||
|
|
||||||
# immutable files
|
if self.DO_IMMUTABLE:
|
||||||
d.addCallback(self.one_test, "1x 200B", 1, 200, False)
|
# immutable files
|
||||||
d.addCallback(self.one_test, "10x 200B", 10, 200, False)
|
d.addCallback(self.one_test, "1x 200B", 1, 200, False)
|
||||||
def _maybe_do_100x_200B(res):
|
d.addCallback(self.one_test, "10x 200B", 10, 200, False)
|
||||||
if self.upload_times["10x 200B"] < 5:
|
def _maybe_do_100x_200B(res):
|
||||||
print "10x 200B test went too fast, doing 100x 200B test"
|
if self.upload_times["10x 200B"] < 5:
|
||||||
return self.one_test(None, "100x 200B", 100, 200, False)
|
print "10x 200B test went too fast, doing 100x 200B test"
|
||||||
return
|
return self.one_test(None, "100x 200B", 100, 200, False)
|
||||||
d.addCallback(_maybe_do_100x_200B)
|
|
||||||
d.addCallback(self.one_test, "1MB", 1, 1*MB, False)
|
|
||||||
d.addCallback(self.one_test, "10MB", 1, 10*MB, False)
|
|
||||||
def _maybe_do_100MB(res):
|
|
||||||
if self.upload_times["10MB"] > 30:
|
|
||||||
print "10MB test took too long, skipping 100MB test"
|
|
||||||
return
|
return
|
||||||
return self.one_test(None, "100MB", 1, 100*MB, False)
|
d.addCallback(_maybe_do_100x_200B)
|
||||||
d.addCallback(_maybe_do_100MB)
|
d.addCallback(self.one_test, "1MB", 1, 1*MB, False)
|
||||||
|
d.addCallback(self.one_test, "10MB", 1, 10*MB, False)
|
||||||
|
def _maybe_do_100MB(res):
|
||||||
|
if self.upload_times["10MB"] > 30:
|
||||||
|
print "10MB test took too long, skipping 100MB test"
|
||||||
|
return
|
||||||
|
return self.one_test(None, "100MB", 1, 100*MB, False)
|
||||||
|
d.addCallback(_maybe_do_100MB)
|
||||||
|
|
||||||
# mutable file creation
|
if self.DO_MUTABLE_CREATE:
|
||||||
d.addCallback(self.one_test, "10x 200B SSK creation", 10, 200, "create")
|
# mutable file creation
|
||||||
|
d.addCallback(self.one_test, "10x 200B SSK creation", 10, 200,
|
||||||
|
"create")
|
||||||
|
|
||||||
|
if self.DO_MUTABLE:
|
||||||
|
# mutable file upload/download
|
||||||
|
d.addCallback(self.one_test, "10x 200B SSK", 10, 200, "upload")
|
||||||
|
def _maybe_do_100x_200B_SSK(res):
|
||||||
|
if self.upload_times["10x 200B SSK"] < 5:
|
||||||
|
print "10x 200B SSK test went too fast, doing 100x 200B SSK"
|
||||||
|
return self.one_test(None, "100x 200B SSK", 100, 200,
|
||||||
|
"upload")
|
||||||
|
return
|
||||||
|
d.addCallback(_maybe_do_100x_200B_SSK)
|
||||||
|
d.addCallback(self.one_test, "1MB SSK", 1, 1*MB, "upload")
|
||||||
|
|
||||||
# mutable file upload/download
|
|
||||||
d.addCallback(self.one_test, "10x 200B SSK", 10, 200, "upload")
|
|
||||||
def _maybe_do_100x_200B_SSK(res):
|
|
||||||
if self.upload_times["10x 200B SSK"] < 5:
|
|
||||||
print "10x 200B SSK test went too fast, doing 100x 200B SSK"
|
|
||||||
return self.one_test(None, "100x 200B SSK", 100, 200, "upload")
|
|
||||||
return
|
|
||||||
d.addCallback(_maybe_do_100x_200B_SSK)
|
|
||||||
d.addCallback(self.one_test, "1MB SSK", 1, 1*MB, "upload")
|
|
||||||
d.addCallback(self.calculate_speeds)
|
d.addCallback(self.calculate_speeds)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
@ -132,59 +142,63 @@ class SpeedTest:
|
||||||
# time = A*size+B
|
# time = A*size+B
|
||||||
# we assume that A*200bytes is negligible
|
# we assume that A*200bytes is negligible
|
||||||
|
|
||||||
# upload
|
if self.DO_IMMUTABLE:
|
||||||
if "100x 200B" in self.upload_times:
|
# upload
|
||||||
B = self.upload_times["100x 200B"] / 100
|
if "100x 200B" in self.upload_times:
|
||||||
else:
|
B = self.upload_times["100x 200B"] / 100
|
||||||
B = self.upload_times["10x 200B"] / 10
|
else:
|
||||||
print "upload per-file time: %.3fs" % B
|
B = self.upload_times["10x 200B"] / 10
|
||||||
print "upload per-file times-avg-RTT: %f" % (B / self.average_rtt)
|
print "upload per-file time: %.3fs" % B
|
||||||
print "upload per-file times-total-RTT: %f" % (B / self.total_rtt)
|
print "upload per-file times-avg-RTT: %f" % (B / self.average_rtt)
|
||||||
A1 = 1*MB / (self.upload_times["1MB"] - B) # in bytes per second
|
print "upload per-file times-total-RTT: %f" % (B / self.total_rtt)
|
||||||
print "upload speed (1MB):", self.number(A1, "Bps")
|
A1 = 1*MB / (self.upload_times["1MB"] - B) # in bytes per second
|
||||||
A2 = 10*MB / (self.upload_times["10MB"] - B)
|
print "upload speed (1MB):", self.number(A1, "Bps")
|
||||||
print "upload speed (10MB):", self.number(A2, "Bps")
|
A2 = 10*MB / (self.upload_times["10MB"] - B)
|
||||||
if "100MB" in self.upload_times:
|
print "upload speed (10MB):", self.number(A2, "Bps")
|
||||||
A3 = 100*MB / (self.upload_times["100MB"] - B)
|
if "100MB" in self.upload_times:
|
||||||
print "upload speed (100MB):", self.number(A3, "Bps")
|
A3 = 100*MB / (self.upload_times["100MB"] - B)
|
||||||
|
print "upload speed (100MB):", self.number(A3, "Bps")
|
||||||
|
|
||||||
# download
|
# download
|
||||||
if "100x 200B" in self.download_times:
|
if "100x 200B" in self.download_times:
|
||||||
B = self.download_times["100x 200B"] / 100
|
B = self.download_times["100x 200B"] / 100
|
||||||
else:
|
else:
|
||||||
B = self.download_times["10x 200B"] / 10
|
B = self.download_times["10x 200B"] / 10
|
||||||
print "download per-file time: %.3fs" % B
|
print "download per-file time: %.3fs" % B
|
||||||
print "download per-file times-avg-RTT: %f" % (B / self.average_rtt)
|
print "download per-file times-avg-RTT: %f" % (B / self.average_rtt)
|
||||||
print "download per-file times-total-RTT: %f" % (B / self.total_rtt)
|
print "download per-file times-total-RTT: %f" % (B / self.total_rtt)
|
||||||
A1 = 1*MB / (self.download_times["1MB"] - B) # in bytes per second
|
A1 = 1*MB / (self.download_times["1MB"] - B) # in bytes per second
|
||||||
print "download speed (1MB):", self.number(A1, "Bps")
|
print "download speed (1MB):", self.number(A1, "Bps")
|
||||||
A2 = 10*MB / (self.download_times["10MB"] - B)
|
A2 = 10*MB / (self.download_times["10MB"] - B)
|
||||||
print "download speed (10MB):", self.number(A2, "Bps")
|
print "download speed (10MB):", self.number(A2, "Bps")
|
||||||
if "100MB" in self.download_times:
|
if "100MB" in self.download_times:
|
||||||
A3 = 100*MB / (self.download_times["100MB"] - B)
|
A3 = 100*MB / (self.download_times["100MB"] - B)
|
||||||
print "download speed (100MB):", self.number(A3, "Bps")
|
print "download speed (100MB):", self.number(A3, "Bps")
|
||||||
|
|
||||||
# SSK creation
|
if self.DO_MUTABLE_CREATE:
|
||||||
B = self.upload_times["10x 200B SSK creation"] / 10
|
# SSK creation
|
||||||
print "create per-file time SSK: %.3fs" % B
|
B = self.upload_times["10x 200B SSK creation"] / 10
|
||||||
|
print "create per-file time SSK: %.3fs" % B
|
||||||
|
|
||||||
# upload SSK
|
if self.DO_MUTABLE:
|
||||||
if "100x 200B SSK" in self.upload_times:
|
# upload SSK
|
||||||
B = self.upload_times["100x 200B SSK"] / 100
|
if "100x 200B SSK" in self.upload_times:
|
||||||
else:
|
B = self.upload_times["100x 200B SSK"] / 100
|
||||||
B = self.upload_times["10x 200B SSK"] / 10
|
else:
|
||||||
print "upload per-file time SSK: %.3fs" % B
|
B = self.upload_times["10x 200B SSK"] / 10
|
||||||
A1 = 1*MB / (self.upload_times["1MB SSK"] - B) # in bytes per second
|
print "upload per-file time SSK: %.3fs" % B
|
||||||
print "upload speed SSK (1MB):", self.number(A1, "Bps")
|
A1 = 1*MB / (self.upload_times["1MB SSK"] - B) # in bytes per second
|
||||||
|
print "upload speed SSK (1MB):", self.number(A1, "Bps")
|
||||||
|
|
||||||
# download SSK
|
# download SSK
|
||||||
if "100x 200B SSK" in self.download_times:
|
if "100x 200B SSK" in self.download_times:
|
||||||
B = self.download_times["100x 200B SSK"] / 100
|
B = self.download_times["100x 200B SSK"] / 100
|
||||||
else:
|
else:
|
||||||
B = self.download_times["10x 200B SSK"] / 10
|
B = self.download_times["10x 200B SSK"] / 10
|
||||||
print "download per-file time SSK: %.3fs" % B
|
print "download per-file time SSK: %.3fs" % B
|
||||||
A1 = 1*MB / (self.download_times["1MB SSK"] - B) # in bytes per second
|
A1 = 1*MB / (self.download_times["1MB SSK"] - B) # in bytes per
|
||||||
print "download speed SSK (1MB):", self.number(A1, "Bps")
|
# second
|
||||||
|
print "download speed SSK (1MB):", self.number(A1, "Bps")
|
||||||
|
|
||||||
def number(self, value, suffix=""):
|
def number(self, value, suffix=""):
|
||||||
scaling = 1
|
scaling = 1
|
||||||
|
|
Loading…
Reference in New Issue