From 3fcee101eea04291ad6003dc62a256186bb7b13c Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 26 Sep 2007 13:07:33 -0700 Subject: [PATCH] check_speed: measure RTT, report per-file times as a multiple of RTT --- src/allmydata/test/check_speed.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/allmydata/test/check_speed.py b/src/allmydata/test/check_speed.py index b8a92275..586a3633 100644 --- a/src/allmydata/test/check_speed.py +++ b/src/allmydata/test/check_speed.py @@ -67,13 +67,28 @@ class SpeedTest: d.addCallback(self.record_times, name) return d - # TODO: use RIClient.get_nodeid() to measure the foolscap-level RTT + def measure_rtt(self, res): + # use RIClient.get_nodeid() to measure the foolscap-level RTT + d = self.client_rref.callRemote("measure_peer_response_time") + def _got(res): + assert len(res) # need at least one peer + times = res.values() + self.total_rtt = sum(times) + self.average_rtt = sum(times) / len(times) + self.max_rtt = max(times) + print "num-peers: %d" % len(times) + print "total-RTT: %f" % self.total_rtt + print "average-RTT: %f" % self.average_rtt + print "max-RTT: %f" % self.max_rtt + d.addCallback(_got) + return d def do_test(self): print "doing test" rr = self.client_rref d = defer.succeed(None) d.addCallback(self.one_test, "startup", 1, 1000) # ignore this one + d.addCallback(self.measure_rtt) d.addCallback(self.one_test, "1x 200B", 1, 200) d.addCallback(self.one_test, "10x 200B", 10, 200) def _maybe_do_100x_200B(res): @@ -103,6 +118,8 @@ class SpeedTest: else: B = self.upload_times["10x 200B"] / 10 print "upload per-file time: %.3fs" % B + print "upload per-file times-avg-RTT: %f" % (B / self.average_rtt) + print "upload per-file times-total-RTT: %f" % (B / self.total_rtt) A1 = 1*MB / (self.upload_times["1MB"] - B) # in bytes per second print "upload speed (1MB):", self.number(A1, "Bps") A2 = 10*MB / (self.upload_times["10MB"] - B) @@ -117,6 +134,8 @@ class SpeedTest: else: B = self.download_times["10x 200B"] / 10 print "download per-file time: %.3fs" % B + print "download per-file times-avg-RTT: %f" % (B / self.average_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 print "download speed (1MB):", self.number(A1, "Bps") A2 = 10*MB / (self.download_times["10MB"] - B) -- 2.45.2