From a051d6f8301907c0eddb9a444f1661f882791b0e Mon Sep 17 00:00:00 2001
From: Michal Sojka
Date: Thu, 6 Feb 2014 23:07:05 +0100
Subject: [PATCH] Update graph generator to actually work
---
continuous/www/wvperf2html.py | 64 +++++++++++++++++++----------------
1 file changed, 35 insertions(+), 29 deletions(-)
diff --git a/continuous/www/wvperf2html.py b/continuous/www/wvperf2html.py
index 0fed0ed..3c3607b 100755
--- a/continuous/www/wvperf2html.py
+++ b/continuous/www/wvperf2html.py
@@ -17,22 +17,21 @@ import os
import os.path
import string
import time
+from datetime import timedelta,datetime
import numpy as np
import json
re_prefix = "\([0-9]+\) (?:# )?"
-re_date = re.compile('^! Date: (.*) ok')
+re_date = re.compile('^! Date: (.*?) ok')
re_testing = re.compile('^('+re_prefix+')?\s*Testing "(.*)" in (.*):\s*$')
-re_commit = re.compile('.*(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}).*, commit: (.*)')
-re_commithash = re.compile('([0-9a-f]{7})(-dirty)? \(')
+re_repo = re.compile('^! Repo (?P[^ ]*) (?P[^ ]*) (?P[0-9a-f]*) ok')
re_assertion = re.compile('^('+re_prefix+')?!\s*(.*?)\s+(\S+)\s*$')
re_perf = re.compile('^('+re_prefix+')?!\s*(.*?)\s+PERF:\s*(.*?)\s+(\S+)\s*$')
re_perfaxis = re.compile('axis="([^"]+)"')
def dateConv(date):
- d = time.gmtime(time.mktime(date))
- return int(time.mktime(d))*1000
+ return int(time.mktime(date.timetuple()))*1000
class Axis:
@@ -93,6 +92,8 @@ class Graph:
return self.rows[rownum]
def addValue(self, date, col, val, units):
+ if col == "gw_latency" and val == 0:
+ val = None
row = self[date]
row[col] = val
if col not in self.columns:
@@ -146,7 +147,7 @@ class Graph:
def options_json(self):
options = {
'rangeSelector': {
- 'selected': 2 # 6m
+ 'selected': 5 # All
},
'title': {
'text': self.title
@@ -175,6 +176,9 @@ class Graph:
},
}
},
+ 'xAxis': {
+ 'ordinal' : False,
+ },
'yAxis': [{
'lineWidth': 1,
'labels': { 'align': 'right',
@@ -189,7 +193,7 @@ class Graph:
return json.dumps(options, indent=True).replace('"FUN(', '').replace(')END"', '')
def getData(self):
- data = [[[row.getDate(), row[col.name]] for row in self.rows] for col in self.columns_ordered]
+ data = [[[row.getDate(), row[col.name]] for row in sorted(self.rows, cmp, lambda r: r.date)] for col in self.columns_ordered]
return json.dumps(data).replace('], [', '],\n[')
@@ -200,33 +204,35 @@ graphs = Graphs()
date2commit = {}
commit2msg = {}
-date = time.localtime(time.time())
+date = datetime.now()
for line in sys.stdin:
line = line.rstrip()
match = re_date.match(line)
if (match):
- date = time.strptime(match.group(1), "%Y-%m-%d %H:%M:%S")
+ dstr = match.group(1)
+ words = dstr.split()
+
+ date = datetime.strptime(string.join(words[0:2]), "%Y-%m-%d %H:%M:%S")
+ if (len(words) > 2):
+ zone_hours = int(words[2])/100
+ date -= timedelta(hours = zone_hours)
continue
+ match = re_repo.match(line)
+ if (match):
+ url = match.group('url')
+ desc = match.group('desc')
+ hash = match.group('hash')
+
+ date2commit[date] = hash
+ commit2msg[hash] = desc
+
match = re_testing.match(line)
if match:
what = match.group(2)
where = match.group(3)
-
- match = re_commit.match(what)
- if match:
- date = time.strptime(match.group(1), "%Y-%m-%d %H:%M:%S")
- commit = match.group(2)
- match = re_commithash.search(commit);
- if match:
- commithash = match.group(1)
- else:
- commithash = None
- date2commit[dateConv(date)] = commithash
- commit2msg[commithash] = commit
-
(basename, ext) = os.path.splitext(os.path.basename(where))
if what != "all": title = what
@@ -294,9 +300,9 @@ print("""
}
}
if (prevpoint && date2commit[prevpoint.x] != date2commit[event.point.x])
- window.location = "https://github.com/TUD-OS/NUL/compare/"+date2commit[prevpoint.x]+'...'+date2commit[event.point.x];
+ window.location = "https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/log/?qt=range&q="+date2commit[prevpoint.x]+'..'+date2commit[event.point.x];
else
- window.location = "https://github.com/TUD-OS/NUL/commit/"+date2commit[event.point.x];
+ window.location = "https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/log/?id="+date2commit[event.point.x];
}""")
def make_int_keys(json):
@@ -306,7 +312,7 @@ def make_int_keys(json):
s += match.expand('\\1\\2')
return s
-print("var date2commit = {%s};" % ",\n".join(["%d: '%s'" % (k, date2commit[k]) for k in sorted(date2commit.keys())]))
+print("var date2commit = {%s};" % ",\n".join(["%d: '%s'" % (dateConv(k), date2commit[k]) for k in sorted(date2commit.keys())]))
print("var commit2msg = %s;" % json.dumps(commit2msg, indent=True))
# for d in sorted(date2commit.keys()):
# v = commits[d];
@@ -317,18 +323,18 @@ print("""
- NUL Performance Plots
+ Linux CAN subsystem performance plots
The graphs below show performance numbers from various
- benchmarks that run nightly on NUL repository.
+ CAN bus related benchmarks run on different Linux kernel versions.
Table of content:
""")
for graph in graphs:
- print(" - %s
" % (graph.title, graph.title))
+ print(" - %s
" % (graph.id, graph.title))
print("
")
for graph in graphs:
print("""
-
+