Skip to content

Instantly share code, notes, and snippets.

@gliush
Last active August 29, 2015 14:00
Show Gist options
  • Save gliush/11361981 to your computer and use it in GitHub Desktop.
Save gliush/11361981 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import os
import sys
import re
from collections import defaultdict
variants = {
"concurrent" : ["1000", "2000", "3000", "5000"],
"key_generator" : ["uniform_int, 10000", "uniform_int, 10000000", "pareto_int, 10000", "pareto_int, 10000000"],
"value_generator" : ["uniform_bin, 1000, 4512", "uniform_bin, 1000, 2512", "exponential_bin, 1000, 2000"],
"operations": ["put, 1", "put, 5", "put, 10", "put, 10.*delete, 10", "put, 10.*update, 10"]
}
test_root = sys.argv[1]
test_dirs= sorted([os.path.join(test_root, o) for o in os.listdir(test_root) if os.path.isdir(os.path.join(test_root, o))])
known_errors = ["timeout", "disconnected", "other"]
print "<table border=1>"
print "<tr>"
print " <th>image</th>"
for k in variants.keys():
print " <th>" + k + "</th>"
for e in known_errors:
print " <th>" + e + "</th>"
print "</tr>"
for d in test_dirs:
config_path = os.path.join(d, "nsto2.config")
sys.stderr.write("%s\n" % config_path)
if not os.path.isfile(config_path):
continue
config = open(config_path, "r").read()
cur_vars = {}
for (k, vs) in variants.iteritems():
cur_vars.update([ (k,v) for v in vs if re.search(k + ".*" + v, config) ])
errors_file = os.path.join(d, "errors.csv")
errors = defaultdict(int)
for line in open(errors_file, "rb"):
if re.match("^\"error\",\"count\"$", line):
continue
m = re.match("^\".(.*),(.*).\",\"([0-9]*)\"$", line)
#sys.stderr.write("%s\n" % line)
error = m.group(2) if m.group(2) in known_errors else "other"
errors[error] += int(m.group(3))
print "<tr><td><a href=\"%s/summary.png\">%s/summary.png</a></td>" % (d,d)
for k in variants.keys():
print " <td>" + cur_vars[k] + "</td>"
for e in known_errors:
print " <td>" + str(errors[e]) + "</td>"
print "</tr>"
print "</table>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment