Author: justi9
Date: 2007-11-02 11:36:42 -0400 (Fri, 02 Nov 2007)
New Revision: 1213
Modified:
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/queue.py
Log:
Simplifies rate calculation.
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-11-02 15:05:32 UTC (rev 1212)
+++ mgmt/cumin/python/cumin/model.py 2007-11-02 15:36:42 UTC (rev 1213)
@@ -356,7 +356,6 @@
values.reverse()
# Pad the values if there are too few
-
if len(values) < limit:
for i in range(len(values), limit):
values.append(0)
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-11-02 15:05:32 UTC (rev 1212)
+++ mgmt/cumin/python/cumin/queue.py 2007-11-02 15:36:42 UTC (rev 1213)
@@ -90,9 +90,10 @@
return queue.get_measurement(key).get_value()
def render_item_depth_accel(self, session, queue):
- key = self.unit.get(session) == "b" and "byteDepth" or
"msgDepth"
- curr, prev = queue.get_measurement(key).get_values(2)
- return "%0.00f" % ((curr - prev) / float(1))
+ unit = self.unit.get(session)
+ key = unit == "b" and "byteDepth" or "msgDepth"
+ value = queue.get_measurement(key).get_rate()
+ return rate(value, unit == "b" and "byte" or "msg",
"sec")
def render_item_status(self, session, queue):
return status(len(queue.errors), len(queue.warnings))
@@ -139,8 +140,8 @@
return queue.get_measurement("msgDepth").get_value()
def render_message_depth_accel(self, session, queue):
- curr, prev = queue.get_measurement("msgDepth").get_values(2)
- return "%.00f" % ((curr - prev) / float(1))
+ value = queue.get_measurement("msgDepth").get_rate()
+ return rate(value, "msg", "sec")
def render_byte_enqueues(self, session, queue):
value = queue.get_measurement("byteTotalEnqueues").get_rate()
@@ -154,8 +155,8 @@
return queue.get_measurement("byteDepth").get_value()
def render_byte_depth_accel(self, session, queue):
- curr, prev = queue.get_measurement("byteDepth").get_values(2)
- return "%.00f" % ((curr - prev) / float(1))
+ value = queue.get_measurement("byteDepth").get_rate()
+ return rate(value, "byte", "sec")
# def render_error_info(self, session, queue):
# return "%i %s, %i %s" % \