Use data types in command line options, rather than all strings
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Thu May 21 11:05:55 2009 +0100 (8 months ago)
changeset 399102321651ffff
parent 3990 b18f0b4a2567
child 3992 fccfd78cab31
Use data types in command line options, rather than all strings
utils/flowmon/bench-all.py
     1.1 --- a/utils/flowmon/bench-all.py	Thu May 21 11:01:38 2009 +0100
     1.2 +++ b/utils/flowmon/bench-all.py	Thu May 21 11:05:55 2009 +0100
     1.3 @@ -46,24 +46,24 @@
     1.4  def main():
     1.5  
     1.6      parser = OptionParser()
     1.7 -    parser.add_option("-j", None, dest="concurrency", default="2",
     1.8 -                      help="Number of tasks to run in parallel")
     1.9 -    parser.add_option("-c", "--cpu-limit", dest="cpu_limit", default="5",
    1.10 +    #parser.add_option("-j", None, dest="concurrency", type=int, default=2,
    1.11 +    #                  help="Number of tasks to run in parallel")
    1.12 +    parser.add_option("-c", "--cpu-limit", dest="cpu_limit", type=float, default=5.0,
    1.13                        help="CPU limit, in hours")
    1.14      parser.add_option("-m", "--memory-limit", dest="mem_limit", default="detect",
    1.15                        help="Memory limit, total, in GigaBytes.  "
    1.16                        "Actual per-process memory limit will be this value divided"
    1.17                        " by the concurrency level setting.")
    1.18 -    parser.add_option("-n", "--num-nodes-side", dest="num_nodes_side_max", default="32",
    1.19 +    parser.add_option("-n", "--num-nodes-side", dest="num_nodes_side_max", type=int, default=32,
    1.20                        help="Maximum NumNodesSide")
    1.21 -    parser.add_option('', "--num-nodes-step", dest="num_nodes_side_step", default="4",
    1.22 +    parser.add_option('', "--num-nodes-step", dest="num_nodes_side_step", type=int, default=4,
    1.23                        help="Maximum NumNodesSide")
    1.24 -    parser.add_option("-s", "--stop-time", dest="stop_time", default="300",
    1.25 +    parser.add_option("-s", "--stop-time", dest="stop_time", type=float, default=300.0,
    1.26                        help="Simulation stop time (s)")
    1.27      (options, args) = parser.parse_args()
    1.28  
    1.29      global CPU_LIMIT, DATA_LIMIT
    1.30 -    CPU_LIMIT = long(float(options.cpu_limit)*60*60)
    1.31 +    CPU_LIMIT = long(options.cpu_limit*60*60)
    1.32  
    1.33      if options.mem_limit == 'detect':
    1.34          for line in file("/proc/meminfo"):
    1.35 @@ -77,7 +77,7 @@
    1.36              DATA_LIMIT = long(float(0.5)*1024*1024*1024)
    1.37      else:
    1.38          DATA_LIMIT = long(float(options.mem_limit)*1024*1024*1024)
    1.39 -    DATA_LIMIT /= int(int(options.concurrency)*1.25)
    1.40 +    #DATA_LIMIT /= int(int(options.concurrency)*1.25)
    1.41      print >> sys.stderr, "Per-process data limit: %.3f GiB (%r)" % (DATA_LIMIT/1024.0/1024.0/1024.0, DATA_LIMIT)
    1.42  
    1.43      out = open("results.xml", "wt")
    1.44 @@ -103,14 +103,14 @@
    1.45      out.write("<results branch=%r revision=%r date=%r>\n" % (branch, revision, date))
    1.46      try:
    1.47          for num_nodes_side in range(4,
    1.48 -                                    int(options.num_nodes_side_max) + int(options.num_nodes_side_step),
    1.49 -                                    int(options.num_nodes_side_step)):
    1.50 +                                    options.num_nodes_side_max + options.num_nodes_side_step,
    1.51 +                                    options.num_nodes_side_step):
    1.52              for run_number in range(10):
    1.53                  for enable_monitor in [False, True]:
    1.54                      args = ["--NumNodesSide=%i" % num_nodes_side,
    1.55                              "--RunNumber=%i" % run_number,
    1.56                              "--EnableMonitor=%i" % enable_monitor,
    1.57 -                            "--StopTime=%s" % options.stop_time,
    1.58 +                            "--StopTime=%f" % options.stop_time,
    1.59                              ]
    1.60                      try:
    1.61                          max_mem, duration, results_fname = run_sim(args)