mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-20 17:52:50 +00:00
UploadResults: add more helper timing stats (ciphertext fetch times)
This commit is contained in:
parent
124fb5ecdf
commit
652d50d7e0
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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>
|
||||
|
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user