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: (.*)')
+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<url>[^ ]*) (?P<desc>[^ ]*) (?P<hash>[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:
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:
def options_json(self):
options = {
+ 'chart': {
+ 'borderWidth': 1,
+ },
'rangeSelector': {
- 'selected': 2 # 6m
+ 'selected': 5 # All
},
'title': {
'text': self.title
},
}
},
+ 'xAxis': {
+ 'ordinal' : False,
+ },
'yAxis': [{
'lineWidth': 1,
'labels': { 'align': 'right',
'x': -3 },
'title': { 'text': axis.getLabel() },
'minRange': axis.minrange,
+ 'tickPixelInterval': 40,
} for axis in self.axes_ordered],
'series': [{ 'name': '%s [%s]' % (col.name, col.units),
'yAxis': col.axis.num }
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[')
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), "%a, %d %b %Y %H:%M:%S +0200")
+ 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
g.findRanges()
g.fixupAxisNumbers()
+pagetitle="Linux CAN subsystem performance plots"
print("""
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>NUL Performance Plots</title>
+ <title>%(pagetitle)s</title>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript">
function tooltip_formatter() {
- var s = '<b>'+ Highcharts.dateFormat('%a, %d %b %Y %H:%M:%S', this.x) +'</b><br/>';
+ var s = '<b>'+ Highcharts.dateFormat('%%a, %%d %%b %%Y %%H:%%M:%%S', this.x) +'</b><br/>';
s += commit2msg[date2commit[this.x]];
$.each(this.points, function(i, point) {
s += '<br/><span style="color:'+ point.series.color+';">'+ point.series.name +'</span>: '+point.y;
}
}
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];
+ }""" % locals())
def make_int_keys(json):
r = re.compile('"(\d+)"(.*)')
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];
</head>
<body>
- <h1>NUL Performance Plots</h1>
+ <h1>%(pagetitle)s</h1>
<p>The graphs below show performance numbers from various
- benchmarks that run nightly on NUL repository.</p>
+ CAN bus related benchmarks run on different Linux kernel versions.</p>
<p>Table of content:</p>
<ul>
-""")
+""" % locals())
for graph in graphs:
- print(" <li><a href='#%s'>%s</a></li>" % (graph.title, graph.title))
+ print(" <li><a href='#%s'>%s</a></li>" % (graph.id, graph.title))
print(" </ul>")
for graph in graphs:
print("""
- <h2><a name='%(title)s'>%(title)s</a></h2>
+ <h2><a name='%(id)s'>%(title)s</a></h2>
<div id="%(id)s" style="height: 400px"></div>
<script>
$.getJSON('%(dataname)s', function(data) {