Commit 6b7305e9 authored by Shane Hathaway's avatar Shane Hathaway

The database activity chart now shows the number of connections in a period

in addition to the loads and stores.
parent 7613c787
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
############################################################################## ##############################################################################
"""ZODB transfer activity monitoring """ZODB transfer activity monitoring
$Id: ActivityMonitor.py,v 1.3 2002/08/14 22:07:09 mj Exp $""" $Id: ActivityMonitor.py,v 1.4 2002/10/09 15:11:25 shane Exp $"""
__version__='$Revision: 1.3 $'[11:-2] __version__='$Revision: 1.4 $'[11:-2]
import time import time
...@@ -72,12 +72,14 @@ class ActivityMonitor: ...@@ -72,12 +72,14 @@ class ActivityMonitor:
'end': start + (end - start) * (n + 1) / divisions, 'end': start + (end - start) * (n + 1) / divisions,
'loads': 0, 'loads': 0,
'stores': 0, 'stores': 0,
'connections': 0,
}) })
div = res[0] div = res[0]
div_start = div['start'] div_start = div['start']
div_end = div['end'] div_end = div['end']
div_index = 0 div_index = 0
connections = 0
total_loads = 0 total_loads = 0
total_stores = 0 total_stores = 0
for t, loads, stores in self.log: for t, loads, stores in self.log:
...@@ -90,17 +92,21 @@ class ActivityMonitor: ...@@ -90,17 +92,21 @@ class ActivityMonitor:
while t > div_end: while t > div_end:
div['loads'] = total_loads div['loads'] = total_loads
div['stores'] = total_stores div['stores'] = total_stores
div['connections'] = connections
total_loads = 0 total_loads = 0
total_stores = 0 total_stores = 0
connections = 0
div_index = div_index + 1 div_index = div_index + 1
if div_index < divisions: if div_index < divisions:
div = res[div_index] div = res[div_index]
div_start = div['start'] div_start = div['start']
div_end = div['end'] div_end = div['end']
connections = connections + 1
total_loads = total_loads + loads total_loads = total_loads + loads
total_stores = total_stores + stores total_stores = total_stores + stores
div['stores'] = div['stores'] + total_stores div['stores'] = div['stores'] + total_stores
div['loads'] = div['loads'] + total_loads div['loads'] = div['loads'] + total_loads
div['connections'] = div['connections'] + connections
return res return res
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment