]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
UploadResults: add more helper timing stats (ciphertext fetch times)
authorBrian Warner <warner@allmydata.com>
Wed, 6 Feb 2008 09:12:35 +0000 (02:12 -0700)
committerBrian Warner <warner@allmydata.com>
Wed, 6 Feb 2008 09:12:35 +0000 (02:12 -0700)
src/allmydata/offloaded.py
src/allmydata/upload.py
src/allmydata/web/unlinked-upload.xhtml
src/allmydata/webish.py

index 7f2a34f4fe92a700bd5bc20deae45d804477614c..9561920a125491f1c44600d702ee19ddca41f494 100644 (file)
@@ -196,6 +196,7 @@ class CHKUploadHelper(Referenceable, upload.CHKUploader):
         r.uri_extension_hash = uri_extension_hash
         f_times = self._fetcher.get_times()
         r.timings["cumulative_fetch"] = f_times["cumulative_fetch"]
+        r.ciphertext_fetched = self._fetcher.get_ciphertext_fetched()
         r.timings["total_fetch"] = f_times["total"]
         self._reader.close()
         os.unlink(self._encoding_file)
@@ -258,6 +259,7 @@ class CHKCiphertextFetcher(AskUntilSuccessMixin):
             "cumulative_fetch": 0.0,
             "total": 0.0,
             }
+        self._ciphertext_fetched = 0
 
     def log(self, *args, **kwargs):
         if "facility" not in kwargs:
@@ -370,6 +372,7 @@ class CHKCiphertextFetcher(AskUntilSuccessMixin):
             for data in ciphertext_v:
                 self._f.write(data)
                 self._have += len(data)
+                self._ciphertext_fetched += len(data)
             return False # not done
         d.addCallback(_got_data)
         return d
@@ -401,6 +404,9 @@ class CHKCiphertextFetcher(AskUntilSuccessMixin):
     def get_times(self):
         return self._times
 
+    def get_ciphertext_fetched(self):
+        return self._ciphertext_fetched
+
 
 class LocalCiphertextReader(AskUntilSuccessMixin):
     implements(interfaces.IEncryptedUploadable)
index 72b27faaab2f447bbd97e7666f91213e642ab415..becf5b03493c936fa93ed90320e032d1c0f73802 100644 (file)
@@ -42,6 +42,7 @@ class UploadResults(Copyable, RemoteCopy):
     copytype = typeToCopy
 
     file_size = None
+    ciphertext_fetched = None # how much the helper fetched
     uri = None
     sharemap = None # dict of shnum to placement string
     servermap = None # dict of peerid to set(shnums)
index eb4283a7fbe97d0f93d0c569dc5516c1c4971f2e..6265af65128cda41f668611ffb003504f56af95f 100644 (file)
     <ul>
       <li>Storage Index: <span n:render="time" n:data="time_storage_index" />
      (<span n:render="rate" n:data="rate_storage_index" />)</li>
+      <li>[Contacting Helper]: <span n:render="time" n:data="time_contacting_helper" /></li>
+      <li>[Upload Ciphertext To Helper]: <span n:render="time" n:data="time_cumulative_fetch" />
+     (<span n:render="rate" n:data="rate_ciphertext_fetch" />)</li>
+      <li>[Helper Total]: <span n:render="time" n:data="time_helper_total" /></li>
+
       <li>Peer Selection: <span n:render="time" n:data="time_peer_selection" /></li>
       <li>Encode And Push: <span n:render="time" n:data="time_total_encode_and_push" /></li>
       <ul>
index 0bdf0d81c4b2d40de0b95caac93d875f1d118bc8..ae47138f13cd4ac0349a4ea4ca7da56b45b59218 100644 (file)
@@ -1343,6 +1343,15 @@ class UnlinkedPOSTCHKUploader(rend.Page):
     def data_time_storage_index(self, ctx, data):
         return self._get_time("storage_index")
 
+    def data_time_contacting_helper(self, ctx, data):
+        return self._get_time("contacting_helper")
+
+    def data_time_cumulative_fetch(self, ctx, data):
+        return self._get_time("cumulative_fetch")
+
+    def data_time_helper_total(self, ctx, data):
+        return self._get_time("helper_total")
+
     def data_time_peer_selection(self, ctx, data):
         return self._get_time("peer_selection")
 
@@ -1384,6 +1393,21 @@ class UnlinkedPOSTCHKUploader(rend.Page):
     def data_rate_push(self, ctx, data):
         return self._get_rate("cumulative_sending")
 
+    def data_rate_ciphertext_fetch(self, ctx, data):
+        d = self.upload_results()
+        def _convert(r):
+            fetch_size = r.ciphertext_fetched
+            if fetch_size is None:
+                return None
+            time = r.timings.get("cumulative_fetch")
+            if time is None:
+                return None
+            try:
+                return 1.0 * fetch_size / time
+            except ZeroDivisionError:
+                return None
+        d.addCallback(_convert)
+        return d
 
 class UnlinkedPOSTSSKUploader(rend.Page):
     def renderHTTP(self, ctx):