Rev 3: Add the ability to drop a stats file, showing the times when we get bytes. in http://bzr.arbash-meinel.com/plugins/dummy_request
John Arbash Meinel
john at arbash-meinel.com
Sat Dec 12 21:06:58 GMT 2009
At http://bzr.arbash-meinel.com/plugins/dummy_request
------------------------------------------------------------
revno: 3
revision-id: john at arbash-meinel.com-20091212210650-x0vrshjs1oh4dgq0
parent: john at arbash-meinel.com-20091212205615-hjkcmgy621n9fmjx
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dummy_request
timestamp: Sat 2009-12-12 15:06:50 -0600
message:
Add the ability to drop a stats file, showing the times when we get bytes.
The result is fairly interesting. Overall we average 1MB/s.
But when we are getting good bulk data transfer, it can peak as
high as 140MB/s.
However, during the CHK pages, it looks like we are closer to 200kB/s,
which is actually slower than my network download. Though it never
drops below 100kB/s which is babune's upload rate. Which may explain why
babune always shows nice steady throughput, but chinstrap gets very
'peaky'.
I need to run this on chinstrap to get a better idea, though.
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py 2009-12-12 20:56:15 +0000
+++ b/__init__.py 2009-12-12 21:06:50 +0000
@@ -59,15 +59,18 @@
class BlackHoleFile(object):
- def __init__(self, pb=None):
+ def __init__(self, pb=None, stats_file=None):
self.bytes_written = 0
self.pb = pb
+ self.stats_file = stats_file
def write(self, bytes):
self.bytes_written += len(bytes)
ui.ui_factory.report_transport_activity(None, len(bytes), None)
if self.pb is not None:
self.pb.tick()
+ if self.stats_file is not None:
+ self.stats_file.write('%.3f\t%d\n' % (time.clock(), len(bytes)))
def tell(self):
return self.bytes_written
@@ -84,9 +87,12 @@
"""
- takes_options = [option.Option('keep', help='keep the output files')]
+ takes_options = [option.Option('keep', help='keep the output files'),
+ option.Option('stats-file', type=unicode,
+ help='Output stream tats here.'),
+ ]
- def run(self, keep=False):
+ def run(self, keep=False, stats_file=None):
b = branch.Branch.open('.')
req_fn, req_name = tempfile.mkstemp(prefix='bzr-request-')
# resp_fn, resp_name = tempfile.mkstemp(prefix='bzr-response-')
@@ -98,7 +104,9 @@
# structure, so that we avoid any sort of disk I/O limitations
# resp_f = os.fdopen(resp_fn, 'wb+')
pb = ui.ui_factory.nested_progress_bar()
- resp_f = BlackHoleFile(pb)
+ if stats_file is not None:
+ stats_file = open(stats_file, 'wb')
+ resp_f = BlackHoleFile(pb, stats_file)
# We don't have the client ever read the response, we just place the
# request into the temp file
@@ -134,5 +142,7 @@
if not keep:
os.remove(req_name)
# os.remove(resp_name)
+ if stats_file is not None:
+ stats_file.close()
commands.register_command(cmd_test_stream)
More information about the bazaar-commits
mailing list