[llvm-commits] [zorg] r125920 - in /zorg/trunk/llvmlab/llvmlab: ui/ci/views.py ui/static/View2D.js ui/templates/dashboard.html ui/templates/layout.html util.py
Daniel Dunbar
daniel at zuster.org
Fri Feb 18 08:43:51 PST 2011
Author: ddunbar
Date: Fri Feb 18 10:43:51 2011
New Revision: 125920
URL: http://llvm.org/viewvc/llvm-project?rev=125920&view=rev
Log:
llvmlab: Add dashboard support for showing timing popups.
Added:
zorg/trunk/llvmlab/llvmlab/ui/static/View2D.js (with props)
Modified:
zorg/trunk/llvmlab/llvmlab/ui/ci/views.py
zorg/trunk/llvmlab/llvmlab/ui/templates/dashboard.html
zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html
zorg/trunk/llvmlab/llvmlab/util.py
Modified: zorg/trunk/llvmlab/llvmlab/ui/ci/views.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/ci/views.py?rev=125920&r1=125919&r2=125920&view=diff
==============================================================================
--- zorg/trunk/llvmlab/llvmlab/ui/ci/views.py (original)
+++ zorg/trunk/llvmlab/llvmlab/ui/ci/views.py Fri Feb 18 10:43:51 2011
@@ -9,6 +9,7 @@
from flask import current_app
ci = flask.Module(__name__, url_prefix='/ci')
+from llvmlab import util
from llvmlab.ci import config
# Hard-coded current configuration.
@@ -134,8 +135,11 @@
# Return the timing data as a json object.
data = []
- for name,builds in builders.items():
+ for i,(name,builds) in enumerate(util.sorted(builders.items())):
+ color = list(util.make_dark_color(float(i) / len(builders)))
+ hex_color = '%02x%02x%02x' % tuple(int(x*255)
+ for x in color)
points = [(float(i) / len(builds), b.end_time - b.start_time)
for i,b in enumerate(builds)]
- data.append((name, points))
+ data.append((name, points, color, hex_color))
return flask.jsonify(data = data)
Added: zorg/trunk/llvmlab/llvmlab/ui/static/View2D.js
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/static/View2D.js?rev=125920&view=auto
==============================================================================
--- zorg/trunk/llvmlab/llvmlab/ui/static/View2D.js (added)
+++ zorg/trunk/llvmlab/llvmlab/ui/static/View2D.js Fri Feb 18 10:43:51 2011
@@ -0,0 +1 @@
+link ../../../../lnt/lnt/viewer/js/View2D.js
\ No newline at end of file
Propchange: zorg/trunk/llvmlab/llvmlab/ui/static/View2D.js
------------------------------------------------------------------------------
svn:special = *
Modified: zorg/trunk/llvmlab/llvmlab/ui/templates/dashboard.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/templates/dashboard.html?rev=125920&r1=125919&r2=125920&view=diff
==============================================================================
--- zorg/trunk/llvmlab/llvmlab/ui/templates/dashboard.html (original)
+++ zorg/trunk/llvmlab/llvmlab/ui/templates/dashboard.html Fri Feb 18 10:43:51 2011
@@ -9,6 +9,25 @@
target="_blank">{{ caller() }}</a>
{% endmacro %}
+{% macro timing_popup_link(phase) -%}
+<a href='#'
+ {% if phase == None %}
+ onclick='show_timing_popup("{{ url_for('phase_timing') }}", event); return false;'
+ title='Phase Timing Information'
+ {% else %}
+ onclick='show_timing_popup("{{
+ url_for('phase_timing', index = phase.number - 1)}}", event); return false;'
+ title='Phase {{ phase.number }} {{ phase.name }} - Timing Information'
+ {% endif %}
+ target="_blank">{{ caller() }}</a>
+{%- endmacro %}
+
+{# Include jQuery and View2D graph widget for use by the timing popups. #}
+{% block head %}
+ <script type=text/javascript src="/static/jquery/1.5/jquery.min.js"></script>
+ <script src="/static/View2D.js"></script>
+{% endblock %}
+
{% block javascript %}
// Handler for phase onclick events.
function show_phase_popup(url, event) {
@@ -20,6 +39,51 @@
popup_frame.src = url;
}
+// Handler for timing onclick events.
+function show_timing_popup(url, event) {
+ // Get the popup elements.
+ var popup = document.getElementById("timing_popup");
+ var popup_legend = document.getElementById("timing_popup_legend");
+
+ // Get the timing data from the server.
+ $.getJSON(url, {}, function(data) {
+ var builds = data.data;
+
+ // Create the timing graph if necessary.
+ var graph = window.timing_graph_object;
+ if (graph) {
+ graph.clearPlots();
+ } else {
+ graph = window.timing_graph_object = new Graph2D("timing_graph");
+ graph.clearColor = [1, 1, 1];
+ graph.xAxis.format = graph.xAxis.formats.normal;
+ }
+
+ // Add the plots and build the legend.
+ var legend = "<table cellspacing=4 border=1>";
+ legend += "<tr><th colspan=2>Legend</th></tr>";
+ for (var i = 0, e = builds.length; i != e; ++i) {
+ var item = builds[i];
+ var name = item[0];
+ var points = item[1];
+ var color = item[2];
+ var hex_color = item[3];
+ graph.addPlot(points, new Graph2D_LinePlotStyle(1, color));
+
+ legend += "<tr><td bgcolor=\"" + hex_color + "\"> </td>";
+ legend += "<td>" + name + "</td></tr>";
+ }
+ legend += "</table>";
+ popup_legend.innerHTML = legend;
+
+ graph.draw();
+// popup.innerHTML = data.data;
+
+ // Show the timing popup.
+ popup.style.display = "block";
+ });
+}
+
// Handler for page load events inside the hidden iframe we use to load phase
// popups.
function popup_frame_loaded(event) {
@@ -80,7 +144,8 @@
</font>
-<h2>Current Status</h2>
+<h2>Current Status ({%
+ call timing_popup_link(None) %}T{% endcall %})</h2>
{# The traffic light... #}
<table>
@@ -126,7 +191,8 @@
<tr>
<th>Result Type</th>
{% for phase in ci_config.phases %}
- <th>Phase {{ phase.number }}</th>
+ <th>Phase {{ phase.number }} ({%
+ call timing_popup_link(phase) %}T{% endcall %})</th>
{% endfor %}
</tr>
</thead>
@@ -208,4 +274,10 @@
displayed, just used to load the HTML we insert into the popup div. #}
<iframe id="phase_popup_frame" style="display: none;"></iframe>
+{# The div we use to include timing popups. #}
+<div id="timing_popup" style="display: none;">
+ <canvas id="timing_graph" width="400" height="300"></canvas>
+ <div id="timing_popup_legend"></div>
+</div>
+
{% endblock %}
Modified: zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html?rev=125920&r1=125919&r2=125920&view=diff
==============================================================================
--- zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html (original)
+++ zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html Fri Feb 18 10:43:51 2011
@@ -6,6 +6,7 @@
<title>{{ self.title() }}</title>
<link rel="stylesheet" type="text/css"{#
#} href="{{ url_for('.static', filename='style.css') }}">
+ {% block head %}{% endblock %}
<script type='text/javascript'>
{% block javascript %}{% endblock %}
</script>
Modified: zorg/trunk/llvmlab/llvmlab/util.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/util.py?rev=125920&r1=125919&r2=125920&view=diff
==============================================================================
--- zorg/trunk/llvmlab/llvmlab/util.py (original)
+++ zorg/trunk/llvmlab/llvmlab/util.py Fri Feb 18 10:43:51 2011
@@ -1,12 +1,20 @@
-__all__ = []
-
-def sorted(items):
- items = list(items)
- items.sort()
- return items
+import colorsys
class simple_repr_mixin(object):
def __repr__(self):
return "%s(%s)" % (self.__class__.__name__,
", ".join("%s=%r" % (k,v)
for k,v in sorted(self.__dict__.items())))
+
+def sorted(items):
+ items = list(items)
+ items.sort()
+ return items
+
+def make_dark_color(h):
+ h = h % 1.
+ s = 0.95
+ v = 0.8
+ return colorsys.hsv_to_rgb(h,0.9+s*.1,v)
+
+__all__ = []
More information about the llvm-commits
mailing list