Author: justi9
Date: 2008-11-18 11:49:48 -0500 (Tue, 18 Nov 2008)
New Revision: 2830
Modified:
mgmt/trunk/mint/bin/mint-bench
mgmt/trunk/mint/python/mint/tools.py
mgmt/trunk/mint/python/mint/update.py
Log:
Add basic reporting to mint-bench
Modified: mgmt/trunk/mint/bin/mint-bench
===================================================================
--- mgmt/trunk/mint/bin/mint-bench 2008-11-18 16:12:14 UTC (rev 2829)
+++ mgmt/trunk/mint/bin/mint-bench 2008-11-18 16:49:48 UTC (rev 2830)
@@ -9,10 +9,10 @@
def main():
root = logging.getLogger("mint")
- root.setLevel(logging.DEBUG)
+ root.setLevel(logging.INFO)
h = logging.StreamHandler()
- h.setLevel(logging.DEBUG)
+ h.setLevel(logging.INFO)
root.addHandler(h)
if "--profile" in sys.argv:
Modified: mgmt/trunk/mint/python/mint/tools.py
===================================================================
--- mgmt/trunk/mint/python/mint/tools.py 2008-11-18 16:12:14 UTC (rev 2829)
+++ mgmt/trunk/mint/python/mint/tools.py 2008-11-18 16:49:48 UTC (rev 2830)
@@ -1,6 +1,6 @@
import sys, os
-from time import sleep
+from time import sleep, clock
from parsley.config import *
from parsley.command import *
@@ -80,7 +80,23 @@
for arg in args[1:]:
model.getSession().addBroker(arg)
+ enq_last = 0
+ deq_last = 0
+
+ print "enqs", "\t", "deqs"
+
while True:
sleep(1)
+
+ enq = model.updateThread.enqueueCount
+ deq = model.updateThread.dequeueCount
+
+ enq_rate = enq - enq_last
+ deq_rate = deq - deq_last
+
+ print enq_rate, "\t", deq_rate
+
+ enq_last = enq
+ deq_last = deq
finally:
model.stop()
Modified: mgmt/trunk/mint/python/mint/update.py
===================================================================
--- mgmt/trunk/mint/python/mint/update.py 2008-11-18 16:12:14 UTC (rev 2829)
+++ mgmt/trunk/mint/python/mint/update.py 2008-11-18 16:49:48 UTC (rev 2830)
@@ -25,9 +25,14 @@
self.stopRequested = False
self.setDaemon(False)
+ self.enqueueCount = 0
+ self.dequeueCount = 0
+
def enqueue(self, update, priority=0):
try:
self.updates.put((priority, update))
+
+ self.enqueueCount += 1
except Full:
log.exception("Queue is full")
pass
@@ -36,6 +41,9 @@
while True:
try:
priority, update = self.updates.get(True, 1)
+
+ self.dequeueCount += 1
+
if self.stopRequested:
break
except Empty: