Author: justi9
Date: 2008-12-17 13:34:21 -0500 (Wed, 17 Dec 2008)
New Revision: 3018
Modified:
mgmt/trunk/mint/python/mint/tools.py
mgmt/trunk/mint/python/mint/update.py
Log:
Extend the mint-bench output with finer-grained counters
Modified: mgmt/trunk/mint/python/mint/tools.py
===================================================================
--- mgmt/trunk/mint/python/mint/tools.py 2008-12-17 18:21:34 UTC (rev 3017)
+++ mgmt/trunk/mint/python/mint/tools.py 2008-12-17 18:34:21 UTC (rev 3018)
@@ -157,30 +157,73 @@
enq_last = 0
deq_last = 0
+ drp_last = 0
+ dfr_last = 0
+ prop_last = 0
+ stat_last = 0
+ meth_last = 0
+ exp_last = 0
- head = "%10s %10s %10s %10s %10s" % \
- ("enqs", "deqs", "depth",
"discard", "defer")
- row = "%10i %10i %10i %10i %10i"
+ head = "%6s %6s %6s %6s %6s %6s %6s %6s %6s" % \
+ ("enqs", "deqs", "depth", "drop",
"defer",
+ "prop", "stat", "meth", "exp")
+ row = "%6i %6i %6i %6i %6i %6i %6i %6i %6i"
- print head
+ samples = 0
while True:
+ if samples % 24 == 0:
+ print head
+
+ samples += 1
+
sleep(1)
ut = model.updateThread
enq = ut.enqueueCount
deq = ut.dequeueCount
+ drp = ut.dropCount
+ dfr = ut.deferCount
+ prop = ut.propUpdateCount
+ stat = ut.statUpdateCount
+ meth = ut.methUpdateCount
+ exp = ut.expireUpdateCount
+
print row % (enq - enq_last,
deq - deq_last,
enq - deq,
- ut.discardCount,
- ut.deferCount)
+ drp - drp_last,
+ dfr - dfr_last,
+ prop - prop_last,
+ stat - stat_last,
+ meth - meth_last,
+ exp - exp_last)
enq_last = enq
deq_last = deq
+ drp_last = drp
+ dfr_last = dfr
+
+ prop_last = prop
+ stat_last = stat
+ meth_last = meth
+ exp_last = exp
finally:
+
+ print "Totals:"
+
+ print row % (enq,
+ deq,
+ enq - deq,
+ drp,
+ dfr,
+ prop,
+ stat,
+ meth,
+ exp)
+
#from threading import enumerate
#for item in enumerate():
# print item
Modified: mgmt/trunk/mint/python/mint/update.py
===================================================================
--- mgmt/trunk/mint/python/mint/update.py 2008-12-17 18:21:34 UTC (rev 3017)
+++ mgmt/trunk/mint/python/mint/update.py 2008-12-17 18:34:21 UTC (rev 3018)
@@ -25,7 +25,11 @@
self.enqueueCount = 0
self.dequeueCount = 0
- self.discardCount = 0
+ self.statUpdateCount = 0
+ self.propUpdateCount = 0
+ self.methUpdateCount = 0
+ self.expireUpdateCount = 0
+ self.dropCount = 0
self.deferCount = 0
self.commitThreshold = 100
@@ -148,6 +152,7 @@
# handled by sqlobject
results[name] = str(value)
elif key.type == 15:
+ #if value:
results[name] = pickle.dumps(value)
elif not hasattr(cls, name):
# Discard attrs that we don't have in our schema
@@ -186,7 +191,7 @@
except ReferenceException, e:
log.info("Referenced class %r not found", e.sought)
- thread.discardCount += 1
+ thread.dropCount += 1
return
oid = self.object.getObjectId()
@@ -287,6 +292,8 @@
except KeyError:
pass
+ thread.propUpdateCount += 1
+
def processBroker(self, cursor, id):
if self.broker.databaseId is None:
op = SqlGetBrokerRegistration()
@@ -320,7 +327,7 @@
id = self.broker.objectDatabaseIds.get(oid)
if id is None:
- thread.discardCount += 1
+ thread.dropCount += 1
return
timestamps = self.object.getTimestamps()
@@ -331,13 +338,13 @@
if t < tnow - timedelta(seconds=30):
log.debug("Update is %i seconds old; skipping it", (tnow -t).seconds)
- thread.discardCount += 1
+ thread.dropCount += 1
return
try:
attrs = self.processAttributes(self.object.getStatistics(), statsCls)
except ReferenceException:
- thread.discardCount += 1
+ thread.dropCount += 1
return
attrs["qmfUpdateTime"] = t > tnow and tnow or t
@@ -350,6 +357,8 @@
log.debug("%s(%s) created", statsCls.__name__, id)
+ thread.statUpdateCount += 1
+
class MethodUpdate(ModelUpdate):
def __init__(self, model, broker, seq, response):
super(MethodUpdate, self).__init__(model, broker, response)
@@ -365,6 +374,8 @@
finally:
self.model.unlock()
+ thread.methUpdateCount += 1
+
class DBExpireUpdate(ModelUpdate):
def __init__(self, model):
super(DBExpireUpdate, self).__init__(model, None, None)
@@ -389,6 +400,8 @@
log.debug("%i total records expired", total)
+ thread.expireUpdateCount += 1
+
class UpdateQueue(ConcurrentQueue):
def __init__(self, maxsize=0, slotCount=1):
self.slotCount = slotCount