X-Git-Url: http://rtime.felk.cvut.cz/gitweb/can-benchmark.git/blobdiff_plain/606fa78f2b870a5a55e2763d398d70298d2f7d21..0d9e2708eb788e26fb0bf0159cffeb5c803d7e3c:/gw-tests/genhtml/genhtml.py
diff --git a/gw-tests/genhtml/genhtml.py b/gw-tests/genhtml/genhtml.py
index 76eee7b..558ef4b 100755
--- a/gw-tests/genhtml/genhtml.py
+++ b/gw-tests/genhtml/genhtml.py
@@ -127,9 +127,10 @@ class Test:
def isOnPath(cls, path):
f = os.path.join(path, '.results')
return os.path.isfile(f)
- def __init__(self, path):
+ def __init__(self, path, values):
self.path = path
self.name = os.path.basename(path)
+ self.values = values
def printThumbLink(self, file):
thumb = self.path+'/thumb'
try:
@@ -137,8 +138,44 @@ class Test:
except OSError:
imgs = [ self.name + ".png" ]
for img in imgs:
- print >>file, "" % \
- (urllib.quote(self.path), img, urllib.quote(self.path), img)
+ print >>file, "" % \
+ (urllib.quote(self.path), urllib.quote(self.path), img)
+ def generateHtml(self):
+ html = open(os.path.join(path, 'results.html'), "w")
+ print >> html, """
+
+
+
+%s
+
+
+
+%s
""" % (title, title)
+ params = ["%s %s" % (v.dim, v) for v in self.vals]
+ print >>html, "Results for:", ", ".join(params), "
"
+ for d in self.dimOther:
+ print >>html, "%s: " % d
+ print >>html, "X axis, " % \
+ Page((self.dimy, d), self.valsOther - d + self.dimx.getValue(0), self.tests).getName()
+ print >>html, "Y axis; " % \
+ Page((d, self.dimx), self.valsOther - d + self.dimy.getValue(0), self.tests).getName()
+ links = []
+ for v in d.values():
+ if v in self.valsOther:
+ links.append(str(v))
+ else:
+ vv = DimValues(self.valsOther)
+ vv.replace(v)
+ links.append("%s"%(urllib.quote(Page((self.dimy, self.dimx), vv, self.tests).getName()), str(v)))
+ print >>html, " | ".join(links)
+ print >>html, "
"
+ try:
+ print >>html, d.htmlPreamble()
+ except Exception:
+ pass
+
+
+ html.close()
class Space(list):
"""List of Dimensions()s (order matters)"""
@@ -190,21 +227,20 @@ class Tests(dict):
realkey = self.space.reorder(key)
return self[realkey.key()]
- def addTest(self, test, coordinates):
- if len(coordinates) != len(self.space):
- raise KeyError("The number coordinates do not match the number of dimensions: " + str(coordinates))
- self[tuple(coordinates)] = test
- for i in xrange(len(coordinates)):
- DimValue(self.space[i], coordinates[i])
-
+ def addTest(self, test):
+ self[test.values.key()] = test
+
def populate(self, rootpath):
for root, dirs, files in os.walk(rootpath):
if (root.find(rootpath) == 0):
- coordinates = root[len(rootpath):]
+ coordinates = root[len(rootpath):].split("/")
else:
- coordinates = rootpath
+ coordinates = rootpath.split("/")
if Test.isOnPath(root):
- self.addTest(Test(root), coordinates.split("/"))
+ if len(coordinates) != len(self.space):
+ raise KeyError("The number coordinates do not match the number of dimensions: " + str(coordinates))
+ dv = DimValues([DimValue(self.space[i], coordinates[i]) for i in xrange(len(coordinates))])
+ self.addTest(Test(root, dv))
def generateHtml(self):
for pair in self.space.iterDimensionPairs():
remDims = Space(*tuple([d for d in self.space.iterRemainingDimensions(pair)]))
@@ -215,6 +251,14 @@ class Tests(dict):
os.remove("index.html")
except OSError: pass
os.symlink(page.getName(), "index.html")
+ css = open("style.css", "w")
+ print >>css, """img { border: 0; }
+table { border-collapse: collapse; }
+th, td { border: 1px solid lightgray; padding: 4px;}
+h4 { margin: 0; }
+.box { border: 1px solid black; padding: 1ex; margin: 1ex 0}
+"""
+ css.close()
#os.system("source-highlight -d --output-dir=. ../*.sh")
@@ -235,16 +279,13 @@ class Page:
%s
-
+
%s
""" % (title, title)
params = ["%s %s" % (v.dim, v) for v in self.valsOther]
- print >>html, "Results for:", ", ".join(params), "
"
+ print >>html, "Results for ", ", ".join(params), "
"
+ print >>html, "Other views
"
for d in self.dimOther:
print >>html, "%s: " % d
print >>html, "
X axis, " % \
@@ -265,6 +306,7 @@ th, td { border: 1px solid lightgray; padding: 4px;}
print >>html, d.htmlPreamble()
except Exception:
pass
+ print >>html, "
"
print >>html, "%s → %s ↓ | " % (self.dimx.name, self.dimy.name)
for x in self.dimx: