]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
download status: add time spent paused by the client (when we're serving over a slow...
authorBrian Warner <warner@allmydata.com>
Mon, 21 Apr 2008 19:19:17 +0000 (12:19 -0700)
committerBrian Warner <warner@allmydata.com>
Mon, 21 Apr 2008 19:19:17 +0000 (12:19 -0700)
src/allmydata/download.py
src/allmydata/web/download-status.xhtml
src/allmydata/web/status.py

index e08ef3c6743a82333da3b69c97189cbefd213400..572878ae5a4773d5ffa1a3ae7cfc3a76beb9b38a 100644 (file)
@@ -449,6 +449,7 @@ class FileDownloader:
         self._results.timings["cumulative_fetch"] = 0.0
         self._results.timings["cumulative_decode"] = 0.0
         self._results.timings["cumulative_decrypt"] = 0.0
+        self._results.timings["paused"] = 0.0
 
         if IConsumer.providedBy(downloadable):
             downloadable.registerProducer(self, True)
@@ -489,6 +490,7 @@ class FileDownloader:
         if self._paused:
             return
         self._paused = defer.Deferred()
+        self._paused_at = time.time()
         if self._status:
             self._status.set_paused(True)
 
@@ -503,6 +505,8 @@ class FileDownloader:
     def stopProducing(self):
         self.log("Download.stopProducing")
         self._stopped = True
+        paused_for = time.time() - self._paused_at
+        self._results.timings['paused'] += paused_for
         if self._status:
             self._status.set_stopped(True)
             self._status.set_active(False)
index 5a3d47e2ad5cb4b302a802e98876a51e7c2c0ba8..b782abc673f57b3a609146fda4f79d383ce56350 100644 (file)
@@ -45,6 +45,7 @@
           <li>Cumulative Decrypting: <span n:render="time" n:data="time_cumulative_decrypt" />
           (<span n:render="rate" n:data="rate_decrypt" />)</li>
         </ul>
+        <li>Paused by client: <span n:render="time" n:data="time_paused" /></li>
       </ul>
       <li n:render="server_timings" />
     </ul>
index fc91010f66a44ffc22f5282fbc1768714080f77f..b9b40c15577dd9600cb7c3c186a7b77f0a9de2f5 100644 (file)
@@ -308,6 +308,9 @@ class DownloadResultsRendererMixin(RateAndTimeMixin):
     def data_time_cumulative_decrypt(self, ctx, data):
         return self._get_time("cumulative_decrypt")
 
+    def data_time_paused(self, ctx, data):
+        return self._get_time("paused")
+
     def _get_rate(self, name):
         d = self.download_results()
         def _convert(r):