diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2011-03-27 13:10:06 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2011-03-27 13:10:06 +1300 |
commit | c3105153a5044c49435094505ae13990f48a483f (patch) | |
tree | 99cfe5727ad33f0c7553e5bb55e63153ea1959fe /libmproxy | |
parent | c0bd1a39e4f717854b424a9c2b86772fbafa843a (diff) | |
download | mitmproxy-c3105153a5044c49435094505ae13990f48a483f.tar.gz mitmproxy-c3105153a5044c49435094505ae13990f48a483f.tar.bz2 mitmproxy-c3105153a5044c49435094505ae13990f48a483f.zip |
Add some debugging output to help troubleshoot a performance problem.
Diffstat (limited to 'libmproxy')
-rw-r--r-- | libmproxy/console.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libmproxy/console.py b/libmproxy/console.py index bbf69d2d..ed6c78af 100644 --- a/libmproxy/console.py +++ b/libmproxy/console.py @@ -651,6 +651,9 @@ class StatusBar(WWrap): if opts: r.append("[%s]"%(":".join(opts))) + if self.master.debug: + r.append("[lt:%0.3f]"%self.master.looptime) + return r def redraw(self): @@ -767,6 +770,7 @@ class Options(object): __slots__ = [ "anticache", "client_replay", + "debug", "keepserving", "kill", "intercept", @@ -809,6 +813,7 @@ class ConsoleMaster(flow.FlowMaster): ] def __init__(self, server, options): flow.FlowMaster.__init__(self, server, ConsoleState()) + self.looptime = 0 self.conn_list_view = None self.set_palette() @@ -849,6 +854,9 @@ class ConsoleMaster(flow.FlowMaster): if options.server_replay: self.server_playback_path(options.server_replay) + self.debug = options.debug + + def _runscript(self, f, path): path = os.path.expanduser(path) self.state.last_script = path @@ -1292,6 +1300,7 @@ class ConsoleMaster(flow.FlowMaster): slave.start() try: while not controller.exit: + startloop = time.time() self.statusbar.redraw() size = self.drawscreen() self.tick(q) @@ -1427,6 +1436,7 @@ class ConsoleMaster(flow.FlowMaster): k = None if k: self.view.keypress(size, k) + self.looptime = time.time() - startloop except (Stop, KeyboardInterrupt): pass |