[llvm-commits] [zorg] r148877 - in /zorg/trunk/lnt/lnt/server/ui: templates/v4_graph.html views.py
Daniel Dunbar
daniel at zuster.org
Tue Jan 24 15:28:28 PST 2012
Author: ddunbar
Date: Tue Jan 24 17:28:28 2012
New Revision: 148877
URL: http://llvm.org/viewvc/llvm-project?rev=148877&view=rev
Log:
[lnt/v0.4] Add some hacky code to autoconvert graphs from machines which report
revisions as "<year><month><day>" into a date format. The 2011 to 2012 jump
otherwise makes graphs completely unreadable.
Modified:
zorg/trunk/lnt/lnt/server/ui/templates/v4_graph.html
zorg/trunk/lnt/lnt/server/ui/views.py
Modified: zorg/trunk/lnt/lnt/server/ui/templates/v4_graph.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/templates/v4_graph.html?rev=148877&r1=148876&r2=148877&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/templates/v4_graph.html (original)
+++ zorg/trunk/lnt/lnt/server/ui/templates/v4_graph.html Tue Jan 24 17:28:28 2012
@@ -24,8 +24,13 @@
{% for plot in graph_plots %}
{{ plot }}
{% endfor %}
-
+
+{% if use_day_axis %}
+ graph.xAxis.format = graph.xAxis.formats.day;
+{% else %}
graph.xAxis.format = graph.xAxis.formats.normal;
+{% endif %}
+
graph.draw();
}
{% endblock %}
Modified: zorg/trunk/lnt/lnt/server/ui/views.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/views.py?rev=148877&r1=148876&r2=148877&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/views.py (original)
+++ zorg/trunk/lnt/lnt/server/ui/views.py Tue Jan 24 17:28:28 2012
@@ -923,6 +923,7 @@
graph_plots = []
num_points = 0
num_plots = len(graph_tests)
+ use_day_axis = None
for i,(test,field) in enumerate(graph_tests):
# Determine the base plot color.
col = list(util.makeDarkColor(float(i) / num_plots))
@@ -949,6 +950,30 @@
for v,r in q).items()
data.sort()
+ # Infer whether or not we should use a day axis. This is a total hack to
+ # try and get graphs of machines which report in the %04Y%02M%02D format
+ # to look readable.
+ #
+ # We only do this detection for the first test.
+ if use_day_axis is None:
+ if data:
+ use_day_axis = (20000000 <= data[0][0] < 20990000)
+ else:
+ use_day_axis = False
+
+ # If we are using a day axis, convert the keys into seconds since the
+ # epoch.
+ if use_day_axis:
+ def convert((x,y)):
+ year = x//10000
+ month = (x//100) % 100
+ day = x % 100
+ seconds = datetime.datetime
+ timestamp = time.mktime((year, month, day,
+ 0, 0, 0, 0, 0, 0))
+ return (timestamp,y)
+ data = map(convert, data)
+
# Compute the graph points.
errorbar_data = []
points_data = []
@@ -1037,4 +1062,5 @@
compare_to=compare_to, options=options,
num_plots=num_plots, num_points=num_points,
neighboring_runs=neighboring_runs,
- graph_plots=graph_plots, legend=legend)
+ graph_plots=graph_plots, legend=legend,
+ use_day_axis=use_day_axis)
More information about the llvm-commits
mailing list