diff -r 63da4a862efd -r dfd9f65d2011 configs/common/Simulation.py --- a/configs/common/Simulation.py Sun Apr 07 22:48:06 2013 -0500 +++ b/configs/common/Simulation.py Mon Apr 08 00:17:45 2013 -0500 @@ -100,7 +100,7 @@ if options.work_cpus_checkpoint_count != None: system.work_cpus_ckpt_count = options.work_cpus_checkpoint_count -def findCptDir(options, maxtick, cptdir, testsys): +def findCptDir(options, cptdir, testsys): """Figures out the directory from which the checkpointed state is read. There are two different ways in which the directories holding checkpoints @@ -111,9 +111,6 @@ This function parses through the options to figure out which one of the above should be used for selecting the checkpoint, and then figures out the appropriate directory. - - It also sets the value of the maximum tick value till which the simulation - will run. """ from os.path import isdir, exists @@ -149,10 +146,10 @@ if cpt_num > len(cpts): fatal('Checkpoint %d not found', cpt_num) - maxtick = maxtick - int(cpts[cpt_num - 1]) + cpt_starttick = int(cpts[cpt_num - 1]) checkpoint_dir = joinpath(cptdir, "cpt.%s" % cpts[cpt_num - 1]) - return maxtick, checkpoint_dir + return cpt_starttick, checkpoint_dir def scriptCheckpoints(options, maxtick, cptdir): if options.at_instruction or options.simpoint: @@ -254,15 +251,6 @@ return exit_event def run(options, root, testsys, cpu_class): - if options.maxtick: - maxtick = options.maxtick - elif options.maxtime: - simtime = m5.ticks.seconds(simtime) - print "simulating for: ", simtime - maxtick = simtime - else: - maxtick = m5.MaxTick - if options.checkpoint_dir: cptdir = options.checkpoint_dir elif m5.options.outdir: @@ -416,9 +404,24 @@ checkpoint_dir = None if options.checkpoint_restore != None: - maxtick, checkpoint_dir = findCptDir(options, maxtick, cptdir, testsys) + cpt_starttick, checkpoint_dir = findCptDir(options, cptdir, testsys) m5.instantiate(checkpoint_dir) + # Handle the maxtick settings now that tick frequency was resolved + # during system instantiation + if options.maxtick: + maxtick = options.maxtick + elif options.maxtime: + maxtick = m5.ticks.fromSeconds(options.maxtime) + print "Simulating %f seconds (until tick %d)" % \ + (options.maxtime, maxtick) + else: + maxtick = m5.MaxTick + + if options.checkpoint_restore != None and maxtick < cpt_starttick: + fatal("Bad maxtick (%d) specified: " + + "Checkpoint starts starts from tick: %d", maxtick, cpt_starttick) + if options.standard_switch or cpu_class: if options.standard_switch: print "Switch at instruction count:%s" % \ diff -r 63da4a862efd -r dfd9f65d2011 configs/common/Options.py --- a/configs/common/Options.py Sun Apr 07 22:48:06 2013 -0500 +++ b/configs/common/Options.py Mon Apr 08 00:17:45 2013 -0500 @@ -71,9 +71,10 @@ number of programs.""") # Run duration options - parser.add_option("-m", "--maxtick", type="int", default=m5.MaxTick, + parser.add_option("-m", "--maxtick", type="int", default=None, metavar="T", help="Stop after T ticks") - parser.add_option("--maxtime", type="float") + parser.add_option("--maxtime", type="float", + help="Run to the specified simulated time in seconds") parser.add_option("-I", "--maxinsts", action="store", type="int", default=None, help="""Total number of instructions to simulate (default: run forever)""")