Browse Source

Changed output to file "statistics.out".

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/f2f200910@266 e5f2f494-b856-4b98-b285-d166d9295462
Kazunori Fujiwara 15 years ago
parent
commit
2bbcc35155
1 changed files with 8 additions and 2 deletions
  1. 8 2
      src/bin/statistics-test/collector.py

+ 8 - 2
src/bin/statistics-test/collector.py

@@ -6,15 +6,20 @@
 import ISC
 import time
 import select
+import sys
+import os
 
 step_time = 1
 statgroup = "statistics"
 
 cc = ISC.CC.Session()
-print (cc.lname)
+# print (cc.lname)
 cc.group_subscribe(statgroup)
 cc.group_subscribe("Boss")
 
+f = open('statistics.out', 'a')
+sys.stdout = f
+
 server_by_name = {}
 server_by_id = []
 counter = []
@@ -33,7 +38,7 @@ while 1:
     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:
@@ -56,6 +61,7 @@ while 1:
                     print ("server",id,"  time=",data["sent"], end=" "),
                     print ("counter=", data["counter"], end=" ")
                     print ("dT=", delta_t, "  dC=", delta_c)
+                    sys.stdout.flush()
                     timestamp[id] = data["sent"]
                     counter[id] = data["counter"]
 #