[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r18152: {torflow} Set the number of circuits built at any given time to be dep (torflow/trunk/CircuitAnalysis/BuildTimes)



Author: mikeperry
Date: 2009-01-17 05:49:25 -0500 (Sat, 17 Jan 2009)
New Revision: 18152

Modified:
   torflow/trunk/CircuitAnalysis/BuildTimes/buildtimes.py
   torflow/trunk/CircuitAnalysis/BuildTimes/dist_check.py
   torflow/trunk/CircuitAnalysis/BuildTimes/full_run.sh
Log:

Set the number of circuits built at any given time to be
dependent upon the run. Also more cleanly exit if we run out
of nodes due to our restrictions.




Modified: torflow/trunk/CircuitAnalysis/BuildTimes/buildtimes.py
===================================================================
--- torflow/trunk/CircuitAnalysis/BuildTimes/buildtimes.py	2009-01-17 10:46:35 UTC (rev 18151)
+++ torflow/trunk/CircuitAnalysis/BuildTimes/buildtimes.py	2009-01-17 10:49:25 UTC (rev 18152)
@@ -39,10 +39,6 @@
       use_guards=True,
       restrict_guards=False)
 
-# Maximum number of concurrent circuits to build:
-# (Gets divided by the number of slices)
-max_circuits = 60
-
 # Original value of FetchUselessDescriptors
 FUDValue = None
 
@@ -172,7 +168,7 @@
     usage()
     sys.exit(2)
   try:
-    opts,args = getopt.getopt(sys.argv[1:],"b:e:s:n:d:g")
+    opts,args = getopt.getopt(sys.argv[1:],"b:e:s:n:d:c:g")
   except getopt.GetoptError,err:
     print str(err)
     usage()
@@ -182,6 +178,7 @@
   pslice=5
   dirname=""
   guard_slices = False
+  max_circuits=60
   for o,a in opts:
     if o == '-n': 
       if a.isdigit(): ncircuits = int(a)
@@ -198,15 +195,18 @@
       else: usage()
     elif o == '-g':
       guard_slices = True
+    elif o == '-c':
+      if a.isdigit(): max_circuits = int(a)
+      else: usage()
     else:
       assert False, "Bad option"
-  return guard_slices,ncircuits,begin,end,pslice,dirname
+  return guard_slices,ncircuits,max_circuits,begin,end,pslice,dirname
 
 def usage():
     print 'usage: statscontroller.py [-b <#begin percentile>] [-e <end percentile] [-s <percentile slice size>] [-g] -n <# circuits> -d <output dir name>'
     sys.exit(1)
 
-def guardslice(guard_slices,p,s,end,ncircuits,dirname):
+def guardslice(guard_slices,p,s,end,ncircuits,max_circuits,dirname):
 
   print 'Making new directory:',dirname
   if not os.path.isdir(dirname):
@@ -243,8 +243,11 @@
   # an old sorted router list.
   __selmgr.__ordered_exit_gen = None
 
-  c = open_controller(basefile_name,ncircuits)
-
+  try:
+    c = open_controller(basefile_name,ncircuits)
+  except PathSupport.NoNodesRemain:
+    print 'No nodes remain at this percentile range ('+str(p)+"-"+str(s)+")"
+    return
  
   for i in xrange(0,ncircuits):
     print 'Building circuit',i
@@ -302,16 +305,14 @@
   print "Done in main."
 
 def main():
-  guard_slices,ncircuits,begin,end,pct,dirname = getargs()
+  guard_slices,ncircuits,max_circuits,begin,end,pct,dirname = getargs()
  
   atexit.register(cleanup) 
-  #global max_circuits
-  #max_circuits = max_circuits/((end-begin)/pct)
 
   print "Using max_circuits: "+str(max_circuits)
 
   for p in xrange(begin,end,pct):
-    guardslice(guard_slices,p,p+pct,end,ncircuits,dirname)
+    guardslice(guard_slices,p,p+pct,end,ncircuits,max_circuits,dirname)
 
 if __name__ == '__main__':
   main()

Modified: torflow/trunk/CircuitAnalysis/BuildTimes/dist_check.py
===================================================================
--- torflow/trunk/CircuitAnalysis/BuildTimes/dist_check.py	2009-01-17 10:46:35 UTC (rev 18151)
+++ torflow/trunk/CircuitAnalysis/BuildTimes/dist_check.py	2009-01-17 10:49:25 UTC (rev 18152)
@@ -144,7 +144,6 @@
         log(" 80: "+str(router_map[nodes[2]].will_exit_to("255.255.255.255", 80)))
         log(" 443: "+str(router_map[nodes[2]].will_exit_to("255.255.255.255", 443)))
 
-
   # FIXME: Compare circuits/chosen to %bw. Multiply by pct_min+max
   # FIXME: Verify by guard+exit weighting?
   for i in xrange(0, 3):

Modified: torflow/trunk/CircuitAnalysis/BuildTimes/full_run.sh
===================================================================
--- torflow/trunk/CircuitAnalysis/BuildTimes/full_run.sh	2009-01-17 10:46:35 UTC (rev 18151)
+++ torflow/trunk/CircuitAnalysis/BuildTimes/full_run.sh	2009-01-17 10:49:25 UTC (rev 18152)
@@ -2,8 +2,8 @@
 
 mkdir slices
 
-./buildtimes.py -n 10000 -s 3 -e 80 -d ./slices >& ./slices/bt-slices.log
-./buildtimes.py -n 10000 -s 3 -g -e 50 -d ./slices >& ./slices/bt-guards.log
-./buildtimes.py -n 20000 -d slices/ -s 80 >& ./slices/bt-all.log
+./buildtimes.py -n 10000 -s 3 -e 93 -d -c 15 ./slices >& ./slices/bt-slices.log
+./buildtimes.py -n 10000 -s 3 -g -e 50 -d -c 30 ./slices >& ./slices/bt-guards.log
+./buildtimes.py -n 20000 -d slices/ -s 93 -c 100 >& ./slices/bt-all.log
 
 mv slices slices-`date +%Y-%m-%d-%H:%M`