From fb049be3fbdc5842fc0c13aed0838d0000fcc7c7 Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Thu, 6 May 2010 16:32:45 -0700 Subject: [PATCH] Keep IP addresses with network measurements. --- parsetrace/analyze-tcp.py | 3 ++- parsetrace/latency-graph.py | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/parsetrace/analyze-tcp.py b/parsetrace/analyze-tcp.py index 83125e7..b83fb82 100755 --- a/parsetrace/analyze-tcp.py +++ b/parsetrace/analyze-tcp.py @@ -101,9 +101,10 @@ def analyze_get(packets): # Check for connection establishment (SYN/SYN-ACK) and use that to estimate # th network RTT. if p.tcp.get_SYN(): + addr = p.ip.get_ip_dst() p = packets.next() #print "Connection establishment: RTT is", p.ts - start_ts - return {'syn_rtt': p.ts - start_ts} + return {'syn_rtt': p.ts - start_ts, 'addr': addr} # Otherwise, we expect the first packet to be the GET request itself if not(p.direction > 0 and p.data.startswith('GET')): diff --git a/parsetrace/latency-graph.py b/parsetrace/latency-graph.py index dcff23c..3340e24 100755 --- a/parsetrace/latency-graph.py +++ b/parsetrace/latency-graph.py @@ -4,11 +4,17 @@ import json, sys for f in sys.argv[1:]: stats = json.load(open(f)) + addr = '' for s in stats: + try: + addr = s['addr'] + except: + pass + try: size = s['bytes'] lat1 = s['start_latency'] lat2 = s['finish_latency'] - print "%d\t%f\t%f" % (size, lat1, lat2) + print "%d\t%f\t%f\t%s" % (size, lat1, lat2, addr) except: pass -- 2.20.1