[rhmessaging-commits] rhmessaging commits: r3393 - in mgmt/trunk/cumin/python/cumin: grid and 1 other directories.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Wed May 27 17:43:33 EDT 2009


Author: eallen
Date: 2009-05-27 17:43:33 -0400 (Wed, 27 May 2009)
New Revision: 3393

Modified:
   mgmt/trunk/cumin/python/cumin/charts.py
   mgmt/trunk/cumin/python/cumin/grid/collector.py
   mgmt/trunk/cumin/python/cumin/grid/pool.py
   mgmt/trunk/cumin/python/cumin/messaging/queue.py
   mgmt/trunk/cumin/python/cumin/model.py
   mgmt/trunk/cumin/python/cumin/stat.py
Log:
Default all charts to fullpageable.
Add data points and stddev to charts.

Modified: mgmt/trunk/cumin/python/cumin/charts.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/charts.py	2009-05-27 18:24:23 UTC (rev 3392)
+++ mgmt/trunk/cumin/python/cumin/charts.py	2009-05-27 21:43:33 UTC (rev 3393)
@@ -154,7 +154,7 @@
 
         tnow = time()
 
-        for dt, value in samples:
+        for dt, value, dev in samples:
             if value is None:
                 continue
 
@@ -170,8 +170,48 @@
 
         cr.stroke()
 
+    def plot_ticks(self, samples, color=(0, 0, 0)):
+        cr = Context(self.surface)
+        cr.set_line_width(1.5)
+
+        tnow = time()
+        dot_size = max(int(self.height / 100), 2)
+        half_dot = int(dot_size / 2)
+
+        for dt, value, dev in samples:
+            if value is None:
+                continue
+
+            t = secs(dt)
+
+            # prevent line from drawing off right side of grid
+            if tnow - t < 0:
+                t = tnow
+
+            cr.set_source_rgba(color[0], color[1], color[2], 0.66)
+            x = self.width - ((tnow - t) / float(self.x_max)) * self.width
+            y = self.height - (value / float(self.y_max)) * self.height
+            cr.move_to(x, y)
+            cr.rectangle(x - half_dot, y - half_dot, dot_size, dot_size)
+            cr.fill()
+
+            if dev:
+                cr.set_source_rgba(0, 0, 0, 0.66)
+                half_dev = int(dev/2)
+                cr.move_to(x - dot_size, y - half_dev)
+                cr.line_to(x + dot_size, y - half_dev)
+
+                cr.move_to(x, y - half_dev)
+                cr.line_to(x, y + half_dev)
+
+                cr.move_to(x - dot_size, y + half_dev)
+                cr.line_to(x + dot_size, y + half_dev)
+
+            cr.stroke()
+
     def plot_legend(self, titles, colors):
         cr = Context(self.surface)
+        cr.set_line_width(1.5)
 
         for i, item in enumerate(zip(titles, colors)):
             title, color = item
@@ -183,8 +223,16 @@
             cr.stroke()
 
             cr.set_source_rgb(*color)
-            cr.rectangle(8, y, 8, -8)
-            cr.fill()
+            if title == "Standard Deviation":
+                cr.move_to(8, y-8)
+                cr.line_to(16, y-8)
+                cr.move_to(12, y-8)
+                cr.line_to(12, y)
+                cr.move_to(8, y)
+                cr.line_to(16, y)
+            else:
+                cr.rectangle(8, y, 8, -8)
+                cr.fill()
             cr.stroke()
 
             cr.move_to(20, y)

Modified: mgmt/trunk/cumin/python/cumin/grid/collector.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/collector.py	2009-05-27 18:24:23 UTC (rev 3392)
+++ mgmt/trunk/cumin/python/cumin/grid/collector.py	2009-05-27 21:43:33 UTC (rev 3393)
@@ -115,12 +115,10 @@
 
         chart = self.JobStackedChart(app, "jobs")
         chart.stats = ("RunningJobs", "IdleJobs")
-        chart.fullpageable = True
         self.add_child(chart)
 
         chart = self.SlotStackedChart(app, "slots")
         chart.stats = ("HostsClaimed", "HostsUnclaimed", "HostsOwner")
-        chart.fullpageable = True
         self.add_child(chart)
 
     def render_title(self, session):

Modified: mgmt/trunk/cumin/python/cumin/grid/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/pool.py	2009-05-27 18:24:23 UTC (rev 3392)
+++ mgmt/trunk/cumin/python/cumin/grid/pool.py	2009-05-27 21:43:33 UTC (rev 3393)
@@ -322,13 +322,11 @@
         self.add_child(slot_map)
 
         chart = self.JobStackedChart(app, "jobs")
-        chart.fullpageable = True
         chart.duration.param.default = "3600"
         chart.stats = ("RunningJobs", "IdleJobs")
         self.add_child(chart)
 
         chart = self.SlotStackedChart(app, "slots")
-        chart.fullpageable = True
         chart.duration.param.default = "3600"
         chart.stats = ("HostsClaimed", "HostsUnclaimed", "HostsOwner")
         self.add_child(chart)

Modified: mgmt/trunk/cumin/python/cumin/messaging/queue.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/messaging/queue.py	2009-05-27 18:24:23 UTC (rev 3392)
+++ mgmt/trunk/cumin/python/cumin/messaging/queue.py	2009-05-27 21:43:33 UTC (rev 3393)
@@ -835,16 +835,13 @@
         self.add_child(StatSet(app, "io", "io"))
 
         chart = self.EnqueueDequeueRateChart(app, "enqdeq")
-        chart.fullpageable = True
         self.add_child(chart)
 
         chart = self.DepthChart(app, "depth")
-        chart.fullpageable = True
         self.add_child(chart)
 
         chart = StatValueChart(app, "consumers")
         chart.stats = ("consumerCount",)
-        chart.fullpageable = True
         self.add_child(chart)
 
     def render_title(self, session):

Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py	2009-05-27 18:24:23 UTC (rev 3392)
+++ mgmt/trunk/cumin/python/cumin/model.py	2009-05-27 21:43:33 UTC (rev 3393)
@@ -389,7 +389,7 @@
     def avg_samples(self, object, secs, interval):
         conn = self.get_connection()
 
-        when = "(qmf_update_time >= now() - interval '%i seconds')" % secs
+        when = "(qmf_update_time >= now() - interval '%i seconds')" % int(secs * 1.5)
         where = "%s and %s" % (object.stats.clause, when)
 
         table_name = self.cumin_class.mint_stats_class.q.tableName
@@ -399,11 +399,12 @@
             cursor = conn.cursor()
 
             sql = """select max(qmf_update_time) as interval_end, 
-            cast(avg(%s) as integer) as value
+            cast(avg(%s) as integer) as value,
+            stddev(%s) as dev
             from %s
             where %s
             group by floor(extract(epoch from qmf_update_time) / %i)
-            order by interval_end desc;""" % (field_name, 
+            order by interval_end desc;""" % (field_name, field_name,
                                               table_name, 
                                               where, 
                                               interval)

Modified: mgmt/trunk/cumin/python/cumin/stat.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.py	2009-05-27 18:24:23 UTC (rev 3392)
+++ mgmt/trunk/cumin/python/cumin/stat.py	2009-05-27 21:43:33 UTC (rev 3393)
@@ -104,7 +104,7 @@
         self.duration = JSDurationSwitch(app, "duration")
         self.add_child(self.duration)
 
-        self.fullpageable = False
+        self.fullpageable = True
 
     def get_args(self, session):
         return self.frame.get_args(session)
@@ -434,7 +434,7 @@
                         rate = calc_rate(sample[1], prev[1],
                                          secs(sample[0]), secs(prev[0]))
 
-                        ns.insert(0, (sample[0], rate))
+                        ns.insert(0, (sample[0], rate, None))
 
                     prev = sample
 
@@ -481,18 +481,28 @@
         chart.plot_x_axis(x_intervals, x_step)
         chart.plot_y_axis(y_intervals, y_step)
 
-        colors = ((1,0,0), (0,0,1), (0,1,0))
+        colors = ((1,0,0), (0,0,1), (0,1,0), (0,0,0))
 
         for stat, color in zip(stats, colors):
             chart.plot_values(samples[stat], color=color)
 
+        for stat, color in zip(stats, colors):
+            chart.plot_ticks(samples[stat], color=color)
+
         chart.plot_frame()
 
-        if self.mode.get(session) == "rate":
+        if mode == "rate":
             titles = ["%s / sec" % x.title for x in stats]
         else:
             titles = [x.title for x in stats]
+            stds = [x[2] for x in samples[stat] if x[2] is not None and int(x[2]) is not 0 for stat in stats]
 
+            if len(stds):
+                clrs = list(colors)
+                clrs[len(titles)] = (0,0,0)
+                colors = tuple(clrs)
+                titles.append("Standard Deviation")
+
         chart.plot_legend(titles, colors)
 
         self.cache_it(session, chart, recent)




More information about the rhmessaging-commits mailing list