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

[or-cvs] r15479: Added ability to go through as many percentiles as possible (torflow/branches/gsoc2008)



Author: fallon
Date: 2008-06-26 16:31:11 -0400 (Thu, 26 Jun 2008)
New Revision: 15479

Modified:
   torflow/branches/gsoc2008/guardslices.py
Log:
Added ability to go through as many percentiles as possible before there are no more guard routers.


Modified: torflow/branches/gsoc2008/guardslices.py
===================================================================
--- torflow/branches/gsoc2008/guardslices.py	2008-06-26 20:29:11 UTC (rev 15478)
+++ torflow/branches/gsoc2008/guardslices.py	2008-06-26 20:31:11 UTC (rev 15479)
@@ -135,7 +135,7 @@
   ncircuits = ""
   dirname = ""
   filename = ""
-  if len(sys.argv[1:]) < 4:
+  if len(sys.argv[1:]) < 3:
     usage()
     sys.exit(2)
   try:
@@ -143,6 +143,9 @@
   except getopt.GetoptError,err:
     print str(err)
     usage()
+  ncircuits=None
+  percentile=None
+  dirname=""
   for o,a in opts:
     if o == '-n': 
       if a.isdigit(): ncircuits = int(a)
@@ -156,12 +159,11 @@
   return ncircuits,percentile,dirname
 
 def usage():
-    print 'usage: statscontroller.py -p <#percentile>  -n <# circuits> -d <output dir name>'
+    print 'usage: statscontroller.py [-p <#percentile>]  -n <# circuits> -d <output dir name>'
     sys.exit(1)
 
 
-def main():
-  ncircuits,p,dirname = setargs()
+def guardslice(p,ncircuits,dirname):
 
   print 'Making new directory:',dirname
   if not os.path.isdir(dirname):
@@ -195,5 +197,16 @@
       break
   c._handler.write_stats(aggfile_name)
 
+def main():
+
+ 
+  ncircuits,p,dirname = setargs()
+
+  if p is None:
+    # do all
+    for p in range(0,100,5):
+      guardslice(p,ncircuits,dirname)
+  else:
+    guardslice(p,ncircuits,dirname)
 if __name__ == '__main__':
   main()