From b964cc6f182391439eedaff22dad73521a8fc3bd Mon Sep 17 00:00:00 2001 From: David Wilson Date: Fri, 26 Aug 2016 19:42:40 +0100 Subject: [PATCH] Import preamble_size.py. --- preamble_size.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 preamble_size.py diff --git a/preamble_size.py b/preamble_size.py new file mode 100644 index 00000000..289d0ea8 --- /dev/null +++ b/preamble_size.py @@ -0,0 +1,21 @@ +""" +Print the size of a typical SSH command line and the bootstrap code sent to new +contexts. +""" + +import inspect +import zlib + +import econtext.master +import econtext.ssh + +context = econtext.master.Context(None, name='default', hostname='default') +stream = econtext.ssh.Stream(context) +print 'SSH command size: %s' % (len(' '.join(stream.get_boot_command())),) +print 'Preamble size: %s (%.2fKiB)' % ( + len(stream.get_preamble()), + len(stream.get_preamble()) / 1024.0, +) + +master = len(zlib.compress(econtext.master.minimize_source(inspect.getsource(econtext.master)))) +print 'econtext.master size: %s (%.2fKiB)' % (master, master / 1024.0)