More trace analysis scripts.
authorMichael Vrable <mvrable@cs.ucsd.edu>
Thu, 13 May 2010 20:32:24 +0000 (13:32 -0700)
committerMichael Vrable <mvrable@cs.ucsd.edu>
Thu, 13 May 2010 20:32:24 +0000 (13:32 -0700)
cloudbench/latency-plot.py [new file with mode: 0755]
parsetrace/ipt.py [new file with mode: 0755]

diff --git a/cloudbench/latency-plot.py b/cloudbench/latency-plot.py
new file mode 100755 (executable)
index 0000000..f757bb2
--- /dev/null
@@ -0,0 +1,33 @@
+#!/usr/bin/python
+
+import sys
+
+lines = list(open('delays.data'))
+classes = set()
+classes.add("")
+for line in lines:
+    line = line.strip().split('\t')
+    try:
+        classes.add(line[3])
+    except:
+        pass
+
+cmd = "plot"
+replace = {}
+n = 0
+print classes
+for c in sorted(classes):
+    if n > 0:
+        cmd += ","
+    cmd += ' "delays-1.data" using ($4 == %d ? $2 : 1.0/0.0):1 title "%s"' % (n, c or 'NORMAL')
+    replace[c] = n
+    n += 1
+
+print cmd
+
+fp = open('delays-1.data', 'w')
+for line in lines:
+    line = line.strip().split('\t')
+    while len(line) < 4: line.append("")
+    line[3] = str(replace[line[3]])
+    fp.write('\t'.join(line) + '\n')
diff --git a/parsetrace/ipt.py b/parsetrace/ipt.py
new file mode 100755 (executable)
index 0000000..ab76dc8
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+#
+# Analyze the inter-packet times of requests to/from cloud storage providers.
+
+import json, sys
+
+RTT_EST = 0.03
+
+def analyze_transfer(timings):
+    for (delay, bytes) in timings:
+        gap = False
+        if delay > 2 * RTT_EST:
+            gap = True
+            print "Long gap of", delay
+        elif delay > RTT_EST / 2:
+            gap = True
+            print "Short gap of", delay
+        if gap:
+            print "    [occurred after", bytes, "bytes]"
+
+for f in sys.argv[1:]:
+    stats = json.load(open(f))
+    for s in stats:
+        if 'interpacket_times' in s:
+            analyze_transfer(s['interpacket_times'])