Commits

Alex Turcu  committed 322b109

Scripts

  • Participants
  • Parent commits 273441d
  • Branches checkpoints

Comments (0)

Files changed (3)

File bin/analyze.py

+from tables import *
+import numpy
+import os.path
+import pylab
+
+
+class HyTest(IsDescription):
+    testtime = StringCol(32)
+    bench = StringCol(32)
+    machine = StringCol(32)
+    throughput = Float64Col()
+    commits = Int32Col()
+    aborts = Int32Col()
+    hyflow_nodes = Int32Col()
+    hyflow_logging_revId = StringCol(32)
+    hyflow_logging_testId = StringCol(32)
+    hyflow_logging_hostname = StringCol(128)
+    hyflow_workload_benchmark = StringCol(32)
+    hyflow_benchmark_warmupTime = Int16Col()
+    hyflow_benchmark_testTime = Int16Col()
+    hyflow_benchmark_injectorThreads = Int16Col()
+    hyflow_workload_objects = Int16Col()
+    hyflow_workload_ops = Int16Col()
+    hyflow_profilerWait = Int16Col()
+    hyflow_hostname = StringCol(32)
+    hyflow_coord = StringCol(32)
+    tag = StringCol(128)
+
+keymap = {
+    "Benchmark": "bench",
+    "Ended at": "testtime",
+    "Throughput": None,
+    "Commits": None,
+    "Aborts": None
+}
+
+class HyTests(object):
+    def __init__(self, h5name = "tests.h5", reset=False):
+        if os.path.exists(h5name) and not reset:
+            self.h5 = openFile(h5name, mode="a")
+            self.group = self.h5.root.main1
+            self.table = self.group.tests
+        else:
+            self.h5 = openFile(h5name, mode="w", title="Hyflow2 tests file")
+            self.group = self.h5.createGroup("/", 'main1', 'Main Group 1')
+            self.table = self.h5.createTable(self.group, "tests", HyTest, "First table")
+        self.row = self.table.row
+    
+            
+def gather_results(fname, row):
+    f = open(fname, "rt")
+    tag = ""
+    for ln in f:
+        ln = ln.strip()
+        if ln == "===":
+            row["tag"] = tag
+            row.append()
+        elif ln == "":
+            continue
+        elif ln[0] == "#":
+            tag = ln.replace("#", "").strip()
+        else:
+            d = ln.split(": ", 2)
+            if d[0] in keymap.keys():
+                key = keymap[d[0]]
+                if key == None:
+                    key = d[0].lower()
+                row[key] = d[1]
+            elif d[0] == "Arguments" or d[0] == "Argumens" :
+                pairs = d[1][5:-1].split(", ")
+                for pair in pairs:
+                    d2 = pair.split("=", 2)
+                    key = d2[0].replace(".", "_")
+                    value = d2[1]
+                    if key not in ["id"]:
+                        row[key] = value
+            else:
+                print "Unknown result reported: %s" % ln
+        pass
+    f.close()
+
+def plot_dict(data, line, label):
+    xa = data.keys()
+    xa = sorted(xa, key = lambda x: int(x))
+    ya = [data[x] for x in xa]
+    pylab.plot(xa, ya, line, label=label)
+
+def plot_series(filt, line="k-", label=""):
+    data = {}
+    mean = {}
+    std = {}
+    for it in hy.table.where(filt):
+        n = it["hyflow_nodes"]
+        if n not in data.keys():
+            data[n] = []
+        data[n].append( it["throughput"] )
+    for n in data.keys():
+        data[n] = numpy.array(data[n])
+        mean[n] = data[n].mean()
+        std[n] = data[n].std()
+    plot_dict(mean, line, label)
+
+def main():
+    plot_series('(tag == "netty local")', "b-", "local 0ms")
+    plot_series('(tag == "netty distrib")', "c-", "3pc 0ms")
+    
+    plot_series('(tag == "hynetty local")', "k-", "local 1ms")
+    plot_series('(tag == "hynetty distrib")', "r-", "3pc 1ms")
+    
+    pylab.legend(loc="best")
+    pylab.show()
+
+if __name__ == "__main__":
+    hy = HyTests(reset=True)
+    gather_results("result-lost.txt", hy.row)
+    gather_results("result-yoshi.txt", hy.row)
+    gather_results("result-luigi.txt", hy.row)
+    hy.h5.flush()
+    
+    main()
+    #print set(hy.table.cols.tag[:])
+    hy.h5.close()
+

File bin/distrib.py

     opts.add_argument("-n", "--nodes", type=int, default=2, help="Number of distributed nodes.")
     opts.add_argument("-a", "--args", type=str, default="", help="Arguments to pass to the tests.")
     opts.add_argument("-f", "--no-file", action="store_true", help="Disable updating slave file.")
+    opts.add_argument("-I", "--test-id", default=None, help="Test ID.")
     return parser
 
 # Utility functions
         self.proto = proto
         self.pid = None
     def run(self):
-        print "[Slave Running: %s]" % str(PROGRAM + self.cmdline.split())
-        p = subprocess.Popen(PROGRAM + self.cmdline.split() , shell=False)
+        cmd = PROGRAM + [x.replace("___", " ") for x in self.cmdline.split()]
+        print "[Slave Running: %s]" % str(cmd)
+        p = subprocess.Popen(cmd , shell=False)
         self.pid = p.pid
         p.wait()
         reactor.callFromThread(self.proto.sendLine, "done")
             host = slave.transport.getPeer().host
             nodes = asgn[i]
             print host, "\t", "%d nodes" % nodes
-            cmd = "-n%d -s%d -f%d -c%s %s hyflow.hostname=%s" % (args.nodes, nodes, offset, self.coord, self.args.run, host)
+            cmd = "-n%d -s%d -f%d -c%s %s hyflow.hostname=%s -I\"%s\"" % (args.nodes, nodes, offset, self.coord, self.args.run, host, 
+                args.test_id.replace(" ", "___")
+            )
             slave.sendLine("run-cmd>"+cmd)
             offset += nodes
 

File bin/ntest.py

+#!/usr/bin/python
+
+import os
+import sys
+import subprocess
+
+repeat = int(os.getenv("REPEAT", 1))
+test_name = os.getenv("TEST_NAME")
+nodes = [int(x) for x in os.getenv("NODES", "4").split()]
+bench = os.getenv("BENCH", "bank")
+
+cmd = ["python", "bin/distrib.py"]
+
+for i in range(repeat):
+	for n in nodes:
+		args = ["-r\"%s -b%s\"" % (" ".join(sys.argv[1:]), bench) ]
+		args = args + ["-n%d" % n]
+		if test_name != None:
+			args = args + ["-I\"%s\"" % test_name]
+		print cmd+args 
+		subprocess.call(" ".join(cmd + args), shell=True)
+
+