From: Brian Warner Date: Mon, 21 Apr 2008 19:19:17 +0000 (-0700) Subject: download status: add time spent paused by the client (when we're serving over a slow... X-Git-Tag: allmydata-tahoe-1.1.0~204 X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/readonly?a=commitdiff_plain;h=f16f48a90965b8c9d449f06c041c72d0bb99d5b5;p=tahoe-lafs%2Ftahoe-lafs.git download status: add time spent paused by the client (when we're serving over a slow HTTP link) --- diff --git a/src/allmydata/download.py b/src/allmydata/download.py index e08ef3c6..572878ae 100644 --- a/src/allmydata/download.py +++ b/src/allmydata/download.py @@ -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) diff --git a/src/allmydata/web/download-status.xhtml b/src/allmydata/web/download-status.xhtml index 5a3d47e2..b782abc6 100644 --- a/src/allmydata/web/download-status.xhtml +++ b/src/allmydata/web/download-status.xhtml @@ -45,6 +45,7 @@
  • Cumulative Decrypting: ()
  • +
  • Paused by client:
  • diff --git a/src/allmydata/web/status.py b/src/allmydata/web/status.py index fc91010f..b9b40c15 100644 --- a/src/allmydata/web/status.py +++ b/src/allmydata/web/status.py @@ -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):