From ff07ce6234a02bf805dcae98b4d34e23eefce6f7 Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@allmydata.com>
Date: Sat, 22 Sep 2007 00:04:46 -0700
Subject: [PATCH] check_speed: add optional 100MB test, if the 10MB test
 finished fast enough

---
 src/allmydata/test/check_speed.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/allmydata/test/check_speed.py b/src/allmydata/test/check_speed.py
index 11aceab5..5816e2ae 100644
--- a/src/allmydata/test/check_speed.py
+++ b/src/allmydata/test/check_speed.py
@@ -77,6 +77,12 @@ class SpeedTest:
         #d.addCallback(self.one_test, "100x 200B", 100, 200)
         d.addCallback(self.one_test, "1MB", 1, 1*MB)
         d.addCallback(self.one_test, "10MB", 1, 10*MB)
+        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)
+        d.addCallback(_maybe_do_100MB)
         d.addCallback(self.calculate_speeds)
         return d
 
@@ -91,6 +97,9 @@ class SpeedTest:
         print "upload speed (1MB):", self.number(A1, "Bps")
         A2 = 10*MB / (self.upload_times["10MB"] - B)
         print "upload speed (10MB):", self.number(A2, "Bps")
+        if "100MB" in self.upload_times:
+            A3 = 100*MB / (self.upload_times["100MB"] - B)
+            print "upload speed (100MB):", self.number(A3, "Bps")
 
         # download
         B = self.download_times["10x 200B"] / 10
@@ -99,6 +108,9 @@ class SpeedTest:
         print "download speed (1MB):", self.number(A1, "Bps")
         A2 = 10*MB / (self.download_times["10MB"] - B)
         print "download speed (10MB):", self.number(A2, "Bps")
+        if "100MB" in self.download_times:
+            A3 = 100*MB / (self.download_times["100MB"] - B)
+            print "download speed (100MB):", self.number(A3, "Bps")
 
     def number(self, value, suffix=""):
         scaling = 1
-- 
2.45.2