[svn] commit: r245 - in /branches/f2f200910/src/bin/statistics-test: boss-shutdown.py collector.py respondent.py
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Oct 30 19:14:18 UTC 2009
Author: fujiwara
Date: Fri Oct 30 19:14:18 2009
New Revision: 245
Log:
Adopted to python 3.1
Modified:
branches/f2f200910/src/bin/statistics-test/boss-shutdown.py
branches/f2f200910/src/bin/statistics-test/collector.py
branches/f2f200910/src/bin/statistics-test/respondent.py
Modified: branches/f2f200910/src/bin/statistics-test/boss-shutdown.py
==============================================================================
--- branches/f2f200910/src/bin/statistics-test/boss-shutdown.py (original)
+++ branches/f2f200910/src/bin/statistics-test/boss-shutdown.py Fri Oct 30 19:14:18 2009
@@ -3,4 +3,4 @@
import ISC
cc = ISC.CC.Session()
cc.group_subscribe("Boss")
-cc.group_sendmsg({ "command":"shutdown"},"Boss")
+cc.group_sendmsg({ "shutdown":None},"Boss")
Modified: branches/f2f200910/src/bin/statistics-test/collector.py
==============================================================================
--- branches/f2f200910/src/bin/statistics-test/collector.py (original)
+++ branches/f2f200910/src/bin/statistics-test/collector.py Fri Oct 30 19:14:18 2009
@@ -11,7 +11,7 @@
statgroup = "statistics"
cc = ISC.CC.Session()
-print cc.lname
+print (cc.lname)
cc.group_subscribe(statgroup)
cc.group_subscribe("Boss")
@@ -20,6 +20,10 @@
counter = []
timestamp = []
servers = 0
+delta_sum = 0
+received = 0
+output_time = -1
+output_delta = -1
sent = -1
last_sent = -1
@@ -29,29 +33,36 @@
if wait <= 0:
sent = time.time();
command = { "command": "getstat", "sent":time.time() }
- print "loop=", loop, " SEND: ", command
+ print ("loop=", loop, " SEND: ", command)
cc.group_sendmsg(command, "statistics")
wait = last_sent + step_time - time.time()
if wait < 0:
wait = step_time
loop += 1
+ delta_sum = -1
+ received = 0
r,w,e = select.select([cc._socket],[],[], wait)
for sock in r:
if sock == cc._socket:
data,envelope = cc.group_recvmsg(False)
if (envelope["group"] == "Boss"):
- if (data["command"] == "shutdown"):
+ if ("shutdown" in data):
exit()
if (envelope["group"] == statgroup):
if (envelope["from"] in server_by_name):
id = server_by_name[envelope["from"]]
delta_t = float(data["sent"]) - float(timestamp[id])
delta_c = float(data["counter"]) - float(counter[id])
- print "server",id," time=",data["sent"], " counter=", data["counter"], " dT=", delta_t, " dC=", delta_c
+ print ("server",id," time=",data["sent"], end=" "),
+ print ("counter=", data["counter"], end=" ")
+ print ("dT=", delta_t, " dC=", delta_c)
timestamp[id] = data["sent"]
counter[id] = data["counter"]
+#
+ if (timestamp[id] == sent):
+ received += 1
else:
- print "server ", servers, " name ", envelope["from"]
+ print ("server ", servers, " name ", envelope["from"])
server_by_id.append(envelope["from"])
server_by_name[envelope["from"]] = len(server_by_id) - 1
counter.append(data["counter"])
Modified: branches/f2f200910/src/bin/statistics-test/respondent.py
==============================================================================
--- branches/f2f200910/src/bin/statistics-test/respondent.py (original)
+++ branches/f2f200910/src/bin/statistics-test/respondent.py Fri Oct 30 19:14:18 2009
@@ -20,7 +20,7 @@
counter = 0
while 1:
- r,w,e = select.select([cc._socket],[],[])
+ r,w,e = select.select([cc._socket],[],[],1)
for sock in r:
if sock == cc._socket:
data,envelope = cc.group_recvmsg(False);
@@ -34,7 +34,7 @@
})
# Do another statistics command
elif (envelope["group"] == "Boss"):
- if (data["command"] == "shutdown"):
+ if ("shutdown" in data):
exit()
# Do another group
# Do another socket
More information about the bind10-changes
mailing list