Merge pull request #159 from kmanna/elapsed_time

Transfer Rate and Elapsed Time Statistics
This commit is contained in:
Aldo Cortesi 2013-08-22 14:34:55 -07:00
commit 09f651247a
3 changed files with 13 additions and 2 deletions

View File

@ -144,6 +144,10 @@ def raw_format_flow(f, focus, extended, padding):
if f["resp_ctype"]:
resp.append(fcol(f["resp_ctype"], rc))
resp.append(fcol(f["resp_clen"], rc))
resp.append(fcol(f["resp_et"], "time"))
resp.append(fcol(f["resp_rate"], "highlight"))
elif f["err_msg"]:
resp.append(fcol(SYMBOL_RETURN, "error"))
resp.append(
@ -185,11 +189,17 @@ def format_flow(f, focus, extended=False, hostheader=False, padding=2):
contentdesc = "[content missing]"
else:
contentdesc = "[no content]"
delta = f.response.timestamp_end - f.request.timestamp_start
rate = utils.pretty_size(len(f.response.content) / delta)
d.update(dict(
resp_code = f.response.code,
resp_is_replay = f.response.is_replay(),
resp_acked = f.response.reply.acked,
resp_clen = contentdesc
resp_clen = contentdesc,
resp_et = "{0:2.0f}ms".format(delta * 1000),
resp_rate = "{0}/s".format(rate),
))
t = f.response.headers["content-type"]
if t:

View File

@ -35,6 +35,7 @@ palettes = {
('header', 'dark cyan', 'default'),
('highlight', 'white,bold', 'default'),
('time', 'light red', 'default'),
('intercept', 'brown', 'default', None, '#f60', 'default'),
('replay', 'light green', 'default', None, '#0f0', 'default'),
('ack', 'light red', 'default'),

View File

@ -74,7 +74,7 @@ def pretty_size(size):
suffixes = [
("B", 2**10),
("kB", 2**20),
("M", 2**30),
("MB", 2**30),
]
for suf, lim in suffixes:
if size >= lim: