From: Brian Warner <warner@allmydata.com> Date: Wed, 6 Feb 2008 09:12:35 +0000 (-0700) Subject: UploadResults: add more helper timing stats (ciphertext fetch times) X-Git-Tag: allmydata-tahoe-0.8.0~130 X-Git-Url: https://git.rkrishnan.org/%5B/FOOURL?a=commitdiff_plain;h=652d50d7e0bba69993da48c268f329c14935cdfb;p=tahoe-lafs%2Ftahoe-lafs.git UploadResults: add more helper timing stats (ciphertext fetch times) --- diff --git a/src/allmydata/offloaded.py b/src/allmydata/offloaded.py index 7f2a34f4..9561920a 100644 --- a/src/allmydata/offloaded.py +++ b/src/allmydata/offloaded.py @@ -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) diff --git a/src/allmydata/upload.py b/src/allmydata/upload.py index 72b27faa..becf5b03 100644 --- a/src/allmydata/upload.py +++ b/src/allmydata/upload.py @@ -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) diff --git a/src/allmydata/web/unlinked-upload.xhtml b/src/allmydata/web/unlinked-upload.xhtml index eb4283a7..6265af65 100644 --- a/src/allmydata/web/unlinked-upload.xhtml +++ b/src/allmydata/web/unlinked-upload.xhtml @@ -24,6 +24,11 @@ <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> diff --git a/src/allmydata/webish.py b/src/allmydata/webish.py index 0bdf0d81..ae47138f 100644 --- a/src/allmydata/webish.py +++ b/src/allmydata/webish.py @@ -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):