Download:
child 10:0dcbc688ad6b
parent 8:b46f133a82ab
9:95a9dbed32a6
Anton Shestakov <engored@ya.ru>, Tue, 05 May 2015 23:27:29 +0800
viewer: show second time in .html view

2 файлов изменено, 34 вставок(+), 14 удалений(-) [+]
templates/results.html file | annotate | diff | comparison | revisions
viewer.py file | annotate | diff | comparison | revisions
--- a/templates/results.html Tue May 05 23:19:13 2015 +0800
+++ b/templates/results.html Tue May 05 23:27:29 2015 +0800
@@ -63,10 +63,13 @@
<td class="hint"><div title="{{ cset['desc'] }}">{{ cset['desc'].partition('\n')[0] }}</div></td>
{% for mark in marks %}
{% set result = results.get(cset['node'], {}) %}
- {% set value, color = result.get(mark, (None, None)) %}
+ {% set v1, c1, v2, c2 = result.get(mark, (None, None, None, None)) %}
<td>
- <span style="{% if color is not None %}background-color: rgb{{ str(color) }}{% end %}">&nbsp;</span>
- <span title="{{ value }}">{{ '{:.2f}s'.format(value) if value is not None else 'N/A' }}</span>
+ <span style="{% if c1 is not None %}background-color: rgb{{ str(c1) }}{% end %}">&nbsp;</span>{#
+ #}<span style="{% if c2 is not None %}background-color: rgb{{ str(c2) }}{% end %}">&nbsp;</span>
+ <span title="w/o .hg/cache: {{ v1 }}">{{ '{:.2f}s'.format(v1) if v1 is not None else '-' }}</span>{#
+ #}/{#
+ #}<span title="with .hg/cache: {{ v2 }}">{{ '{:.2f}s'.format(v2) if v2 is not None else '-' }}</span>
</td>
{% end %}
</tr>
--- a/viewer.py Tue May 05 23:19:13 2015 +0800
+++ b/viewer.py Tue May 05 23:27:29 2015 +0800
@@ -48,28 +48,45 @@
elif ext == 'html':
self.results_html()
- def getdata(self):
+ def getchangesets(self):
rev = self.get_argument('rev', 'tip')
revcount = 120
+
+ return getinfo('first(%s:0, %d)' % (rev, revcount))
+
+ def getresults(self, changesets):
results = {}
limits = {
- mark: self.conn.execute(
- 'SELECT MIN(time), MAX(time) FROM results WHERE mark = ? AND cache = ?',
- (mark, False)).fetchone()
+ mark:
+ self.conn.execute(
+ 'SELECT MIN(time), MAX(time) FROM results WHERE mark = ? AND cache = ?',
+ (mark, False)).fetchone()
+ +
+ self.conn.execute(
+ 'SELECT MIN(time), MAX(time) FROM results WHERE mark = ? AND cache = ?',
+ (mark, True)).fetchone()
for mark in MARKS
}
- changesets = getinfo('first(%s:0, %d)' % (rev, revcount))
-
for cset in changesets:
node = cset['node']
resultsq = self.conn.execute(
- 'SELECT mark, time FROM results WHERE node = ? AND cache = ?',
- (node, False))
- for mark, time in resultsq:
- color = green_to_red(limits[mark], time) if time is not None else None
- results.setdefault(node, {})[mark] = (time, color)
+ 'SELECT mark, time, cache FROM results WHERE node = ?',
+ (node,))
+ for mark, time, cache in resultsq:
+ results.setdefault(node, {}).setdefault(mark, [None, None, None, None])
+ if not cache:
+ color = green_to_red(limits[mark][0:2], time) if time is not None else None
+ results[node][mark][0:2] = [time, color]
+ else:
+ color = green_to_red(limits[mark][2:4], time) if time is not None else None
+ results[node][mark][2:4] = [time, color]
+ return results
+
+ def getdata(self):
+ changesets = self.getchangesets()
+ results = self.getresults(changesets)
return changesets, results
def results_tsv(self):