if len(segment) > 0:
yield segment
-def analyze_get(packets):
+def analyze_get(packets, prev_time = None):
packets = iter(packets)
p = packets.next()
tot_bytes = max(tot_bytes, bytenr)
#print "Transferred %d bytes in %s seconds, initial response after %s" % (tot_bytes, last_ts - start_ts, resp_ts - start_ts)
+ if prev_time is not None:
+ prev_delay = start_ts - prev_time
+ else:
+ prev_delay = 0
return {'bytes': tot_bytes,
'start_latency': resp_ts - start_ts,
'finish_latency': last_ts - start_ts,
- 'interpacket_times': spacings}
+ 'interpacket_times': spacings,
+ 'delay_from_previous': prev_delay}
if __name__ == '__main__':
for f in sys.argv[1:]:
def request_start(p):
return p.direction > 0 and p.datalen > 0
result_list = []
+ prev_time = None
for s in split_trace(conn.packets, request_start):
s = list(s)
if False:
#print p
#if p.direction > 0 and p.datalen > 0:
#print "Request:", repr(p.data)
- results = analyze_get(s)
+ results = analyze_get(s, prev_time)
if results is not None:
result_list.append(results)
+ prev_time = s[-1].ts
#print "===="
print dump_data(result_list)