]> rtime.felk.cvut.cz Git - can-benchmark.git/commitdiff
Merge branch 'master' of rtime.felk.cvut.cz:/can-benchmark
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 7 Dec 2010 18:14:41 +0000 (19:14 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 7 Dec 2010 18:14:41 +0000 (19:14 +0100)
gw-tests/genhtml/genhtml.py
gw-tests/lib.sh

index 70e918fba48dfd1a021fa5a3c99857d33d3bd557..83995bc660a184b5d2551c97918957282a2688ad 100755 (executable)
@@ -34,6 +34,10 @@ class Dimension(dict):
                self[value] = DimValue(self, value)
     def htmlLabel(self, v):
        return v
+    def __str__(self):
+        return self.name
+    def __repr__(self):
+        return self.type
 
 class DimensionKern(Dimension):
     def __init__(self):
@@ -83,11 +87,12 @@ class DimensionTraffic(Dimension):
 class Test:
     @classmethod
     def isOnPath(cls, path):
-       f = os.path.join(path, 'plot.gp')
+       f = os.path.join(path, '.results')
        return os.path.isfile(f)
     def __init__(self, path):
        self.path = path
     def printThumbLink(self, file):
+        print self.path
        for img in dircache.listdir(self.path+'/thumb'):
            print >>file, "<a href='%s/%s'><img src='%s/thumb/%s'></a>" % \
                (urllib.quote(self.path), img, urllib.quote(self.path), img)
@@ -151,16 +156,17 @@ class Tests(dict):
                yield d
     def generateHtml(self):
        for pair in self.iterDimensionPairs():
-           remdims = [d for d in self.iterRemainingDimensions(pair)]
-           for vals in iterDimValues(remdims):
-               page = Page(pair, remdims, vals, self)
+           remDims = [d for d in self.iterRemainingDimensions(pair)]
+            print pair, remDims
+           for vals in iterDimValues(remDims):
+               page = Page(pair, remDims, vals, self)
                page.generate()
        try:
            os.remove("index.html")
        except OSError: pass
        os.symlink(page.getName(), "index.html")
 
-       os.system("source-highlight -d --output-dir=. ../*.sh")
+       #os.system("source-highlight -d --output-dir=. ../*.sh")
 
 class Page:
     def __init__(self, dimPair, dimOther, valsOther, tests):
@@ -173,8 +179,9 @@ class Page:
     def generate(self):
        html = open(self.getName(), "w")
        title = "CAN gateway timing analysis" + ", ".join([v.dim.name+" "+v.value for v in self.valsOther])
-       print >> html, """<html>
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+       print >> html, """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
 <title>%s</title>
 <style>
index da31988a62fa2e19b0d46b24da41a3485e8a21f9..2fdf1ff2a5579f656186c129addb8192c6b814f7 100644 (file)
@@ -79,17 +79,21 @@ traffic_and_length() {
 }
 
 _run() {
-    if [[ ! "$OPT_PLOT_ONLY" ]]
-    then kernel_versions=$(sshgw uname -r)
-    else kernel_versions= # TODO $(ls results/by-kern)
+    if [[ ! "$OPT_PLOT_ONLY" ]]; then
+       host_kernel_versions=host-$(uname -r)
+       kernel_versions=$(sshgw uname -r)
+    else
+       host_kernel_versions=$(cd results; ls -d host-*)
+       kernel_versions=$(cd results/host-$(uname -r)/; ls)
     fi
     if [[ $OPT_TRAFFIC = all ]]
     then traffics="flood 50 oneatatime"
     else traffics=$OPT_TRAFFIC
     fi
+    for hostkvers in $host_kernel_versions; do
     for OPT_TRAFFIC in $traffics; do
     for kvers in $kernel_versions; do
-       dir="results/host-$(uname -r)/$kvers/$OPT_TRAFFIC/$(basename $0 .sh)"
+       dir="results/$hostkvers/$kvers/$OPT_TRAFFIC/$(basename $0 .sh)"
        mkdir -p $dir
        script=$PWD/$0
        cd $dir
@@ -97,6 +101,7 @@ _run() {
        if [[ ! "$OPT_PLOT_ONLY" ]]; then
            # Remove data from the last measurement
            rm -rf *
+           touch .results
            # Set can interfaces up
            sshgw 'for i in 0 1; do ip link show dev can$i|grep -q UP || ip link set can$i up type can bitrate 1000000; done'
            # Delete all vcan interfaces
@@ -119,6 +124,7 @@ _run() {
        cd -
     done
     done
+    done
 }
 
 test_end() {