Commits

Yit Phang Khoo committed 474350a

Add hyperlinks and summary to benchmark results.

Comments (0)

Files changed (1)

Test/runbenchmarksalist.py

     }
 
 
-    with Tee(sys.stderr, os.path.join(output, "summary.txt"), "w") as txtfile:
-        with open(os.path.join(output, "summary.html"), "w") as htmlfile:
-            print>>htmlfile, "<!doctype html>"
-            print>>htmlfile, "<meta charset=utf-8>"
-            print>>htmlfile, "<head>"
-            print>>htmlfile, "<title>%s</title>" % ( output_label, )
-            print>>htmlfile, "<style>figure.inline-figure { display: inline-block; margin: 0; }</style>"
-            print>>htmlfile, "</head>"
+    with open(os.path.join(output, "index.html"), "w") as htmlfile:
+        print>>htmlfile, "<!doctype html>"
+        print>>htmlfile, "<meta charset=utf-8>"
+        print>>htmlfile, "<title>%s</title>" % ( output_label, )
+        print>>htmlfile, "<style>figure.inline-figure { display: inline-block; margin: 0; }</style>"
 
+        with Tee(sys.stderr, os.path.join(output, "summary.txt"), "w") as txtfile:
             for file in files:
                 print>>txtfile, "    Summarizing %s ..." % ( file, )
                 label = file[:-8]
                 summary = os.path.join(output, label)
-                print>>htmlfile, "<h1>%s</h1>" % ( label, )
+                print>>htmlfile, "<h1 id=\"%s\">%s</h1>" % ( label, label )
 
                 try:
                     os.makedirs(summary)
                             fig.savefig(pdffile, format="pdf")
                             print>>htmlfile, "<figure class=inline-figure><img src=%s></figure>" \
                                 % ( os.path.join(label, urllib.pathname2url(pdffilename)), )
+
+        import cgi
+        print>>htmlfile, "<h1 id=\"summary\">Summary</h1>"
+        print>>htmlfile, "<pre>"
+        print>>htmlfile, cgi.escape(open(os.path.join(output, "summary.txt")).read())
+        print>>htmlfile, "</pre>"
+
+        print>>htmlfile, "<style>div#header { position: fixed; top: 0; right: 0; padding: 0.5em; background: white }</style>"
+        print>>htmlfile, "<div id=\"header\">"
+        print>>htmlfile, "<a href=\"#summary\">Summary</a>"
+        for label in ( file[:-8] for file in files ):
+            print>>htmlfile, "<a href=\"#%s\">%s</a>" % ( label, label )
+        print>>htmlfile, "</div>"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.