[or-cvs] r21420: {torflow} Add results displaying script. Change test runs to to includ (torflow/trunk/CircuitAnalysis/BuildTimes/CBT-Test)

Mike Perry mikeperry-svn at fscked.org
Sun Jan 17 02:33:47 UTC 2010


Author: mikeperry
Date: 2010-01-17 02:33:46 +0000 (Sun, 17 Jan 2010)
New Revision: 21420

Added:
   torflow/trunk/CircuitAnalysis/BuildTimes/CBT-Test/cbtshow.py
Modified:
   torflow/trunk/CircuitAnalysis/BuildTimes/CBT-Test/run_test.sh
Log:

Add results displaying script. Change test runs to
to include one with 100% of guards.



Added: torflow/trunk/CircuitAnalysis/BuildTimes/CBT-Test/cbtshow.py
===================================================================
--- torflow/trunk/CircuitAnalysis/BuildTimes/CBT-Test/cbtshow.py	                        (rev 0)
+++ torflow/trunk/CircuitAnalysis/BuildTimes/CBT-Test/cbtshow.py	2010-01-17 02:33:46 UTC (rev 21420)
@@ -0,0 +1,114 @@
+#!/usr/bin/python
+
+import os
+import sys
+import re
+
+# Stats:
+# Pct Avg
+#   0. MIN_CIRCS
+#   1. NUM_CIRCS
+#   2. NUM_TIMEOUT
+# Overall Avg (weighted)
+#   2. BUILD_RATE
+
+# Recompute:
+#  Build rate +/- 1 second, +/- 2 second
+
+def walk_single_pct(pct_dir):
+  built_succeed_tot = 0
+  built_tot = 0
+  avg_min_circs = 0
+  avg_num_circs = 0
+  avg_num_timeout = 0
+  reset_test_cnt = 0
+  avg_reset_cnt = 0
+  res_count = 0
+
+  for pct_root, pct_dirs, pct_files in os.walk(pct_dir):
+    for pct_run in pct_dirs:
+      for run_root, dirs, files in os.walk(pct_dir+"/"+pct_run):
+        for ds in dirs:
+          if re.match("^redo.[\d+]$", ds):
+            for sr, sd, sf in os.walk(pct_dir+"/"+pct_run+"/"+ds):
+              for f in sf:
+                if f == "result":
+                  r = open(pct_dir+"/"+pct_run+"/"+ds+"/"+f)
+                  for l in r.readlines():
+                    bg = re.match("^BUILD_RATE\: ([\d]+)/([\d]+)", l)
+                    if bg: built,total = map(int, bg.groups())
+                    ncg = re.match("^NUM_CIRCS\: ([\d]+)", l)
+                    if ncg: num_circs = int(ncg.groups()[0])
+                    ntg = re.match("^NUM_TIMEOUT\: ([\d]+)", l)
+                    if ntg: num_timeout = int(ntg.groups()[0])
+                    rcg = re.match("^RESET_CNT\: ([\d]+)", l)
+                    if rcg: reset_cnt = int(rcg.groups()[0])
+          
+                  avg_reset_cnt += reset_cnt
+                  reset_test_cnt += 1
+                  
+                  if built <= 0 or num_circs <= 0 or num_timeout <= 0:
+                    print "Skipping -1 file in "+pct_root+pct_run
+                    continue
+
+                  built_succeed_tot += built
+                  built_tot += total
+              if built <= 0 or num_circs <= 0 or num_timeout <= 0:
+                continue
+
+              # XXX: Hrmm..
+              for f in sf:
+                if f == "buildtimes":
+                  counts = [0,0,0,0]
+
+        for f in files:
+          if f == "result":
+            r = open(pct_root+"/"+pct_run+"/"+f)
+            res_count += 1
+            for l in r.readlines():
+              bg = re.match("^BUILD_RATE\: ([\d]+)/([\d]+)", l)
+              if bg: built,total = map(int, bg.groups())
+              ncg = re.match("^NUM_CIRCS\: ([\d]+)", l)
+              if ncg: num_circs = int(ncg.groups()[0])
+              ntg = re.match("^NUM_TIMEOUT\: ([\d]+)", l)
+              if ntg: num_timeout = int(ntg.groups()[0])
+              mcg = re.match("^MIN_CIRCS\: ([\d]+)", l)
+              if mcg: min_circs = int(mcg.groups()[0])
+              rcg = re.match("^RESET_CNT\: ([\d]+)", l)
+              if rcg: reset_cnt = int(rcg.groups()[0])
+
+            # Only count resets for redo runs 
+            #avg_reset_cnt += reset_cnt
+            #reset_test_cnt += 1
+               
+            if built <= 0 or min_circs <= 0 or num_circs <= 0 \
+                 or num_timeout <= 0:
+              print "Skipping -1 file in "+pct_root+pct_run
+              continue
+           
+            # Only count build_rate from redo runs
+            #built_succeed_tot += built
+            #built_tot += total
+
+            avg_min_circs += min_circs
+            avg_num_circs += num_circs
+            avg_num_timeout += num_timeout
+
+  avg_min_circs /= float(res_count)
+  avg_num_circs /= float(res_count)
+  avg_num_timeout /= float(res_count)
+  avg_reset_cnt /= float(reset_test_cnt)
+
+  print "Avg Min Circs: "+str(avg_min_circs)
+  print "Avg Num Circs: "+str(avg_num_circs)
+  print "Avg Num Timeout: "+str(avg_num_timeout)
+  print "Avg Reset Cnt: "+str(avg_reset_cnt)
+  print str(built_succeed_tot)+"/"+str(built_tot)+"="+str(float(built_succeed_tot)/built_tot)
+
+
+def main():
+  walk_single_pct(sys.argv[1])
+
+main()
+
+


Property changes on: torflow/trunk/CircuitAnalysis/BuildTimes/CBT-Test/cbtshow.py
___________________________________________________________________
Added: svn:executable
   + *

Modified: torflow/trunk/CircuitAnalysis/BuildTimes/CBT-Test/run_test.sh
===================================================================
--- torflow/trunk/CircuitAnalysis/BuildTimes/CBT-Test/run_test.sh	2010-01-17 02:30:40 UTC (rev 21419)
+++ torflow/trunk/CircuitAnalysis/BuildTimes/CBT-Test/run_test.sh	2010-01-17 02:33:46 UTC (rev 21420)
@@ -45,7 +45,7 @@
   fi
 fi
 
-for p in 0 10 20 30 40 50 60 70 80 90
+for p in 0 10 20 30 40 50 60 70 80 90 100
 do
   N=0
   while [ $N -lt 5 ]
@@ -59,7 +59,6 @@
     sleep 10
     mkdir -p results/$p/$N
     ./cbttest.py -p $p -o results/$p/$N 2>&1 | tee results/$p/$N/cbt.log || exit
-    N=`expr $N + 1`
 
     # Redo this run M=3 times
     M=0
@@ -76,6 +75,7 @@
       ./cbttest.py -r -p $p -o results/$p/$N/redo.$M 2>&1 | tee results/$p/$N/redo.$M/cbt.log || exit
       M=`expr $M + 1`
     done
+    N=`expr $N + 1`
   done
 done
 



More information about the tor-commits mailing list