Deleted Added
sdiff udiff text old ( 9793:6e6cefc1db1f ) new ( 9816:971507cbbe65 )
full compact
1# Copyright (c) 2012-2013 ARM Limited
2# All rights reserved
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

--- 92 unchanged lines hidden (view full) ---

101 system.work_end_ckpt_count = options.work_end_checkpoint_count
102 if options.work_begin_exit_count != None:
103 system.work_begin_exit_count = options.work_begin_exit_count
104 if options.work_begin_checkpoint_count != None:
105 system.work_begin_ckpt_count = options.work_begin_checkpoint_count
106 if options.work_cpus_checkpoint_count != None:
107 system.work_cpus_ckpt_count = options.work_cpus_checkpoint_count
108
109def findCptDir(options, maxtick, cptdir, testsys):
110 """Figures out the directory from which the checkpointed state is read.
111
112 There are two different ways in which the directories holding checkpoints
113 can be named --
114 1. cpt.<benchmark name>.<instruction count when the checkpoint was taken>
115 2. cpt.<some number, usually the tick value when the checkpoint was taken>
116
117 This function parses through the options to figure out which one of the
118 above should be used for selecting the checkpoint, and then figures out
119 the appropriate directory.
120
121 It also sets the value of the maximum tick value till which the simulation
122 will run.
123 """
124
125 from os.path import isdir, exists
126 from os import listdir
127 import re
128
129 if not isdir(cptdir):
130 fatal("checkpoint dir %s does not exist!", cptdir)

--- 19 unchanged lines hidden (view full) ---

150 cpts.append(match.group(1))
151
152 cpts.sort(lambda a,b: cmp(long(a), long(b)))
153
154 cpt_num = options.checkpoint_restore
155 if cpt_num > len(cpts):
156 fatal('Checkpoint %d not found', cpt_num)
157
158 maxtick = maxtick - int(cpts[cpt_num - 1])
159 checkpoint_dir = joinpath(cptdir, "cpt.%s" % cpts[cpt_num - 1])
160
161 return maxtick, checkpoint_dir
162
163def scriptCheckpoints(options, maxtick, cptdir):
164 if options.at_instruction or options.simpoint:
165 checkpoint_inst = int(options.take_checkpoints)
166
167 # maintain correct offset if we restored from some instruction
168 if options.checkpoint_restore != None:
169 checkpoint_inst += options.checkpoint_restore

--- 85 unchanged lines hidden (view full) ---

255 tmp_cpu_list.append((new_cpu, old_cpu))
256 repeat_switch_cpu_list = tmp_cpu_list
257
258 if (maxtick - m5.curTick()) <= switch_freq:
259 exit_event = m5.simulate(maxtick - m5.curTick())
260 return exit_event
261
262def run(options, root, testsys, cpu_class):
263 if options.maxtick:
264 maxtick = options.maxtick
265 elif options.maxtime:
266 simtime = m5.ticks.seconds(simtime)
267 print "simulating for: ", simtime
268 maxtick = simtime
269 else:
270 maxtick = m5.MaxTick
271
272 if options.checkpoint_dir:
273 cptdir = options.checkpoint_dir
274 elif m5.options.outdir:
275 cptdir = m5.options.outdir
276 else:
277 cptdir = getcwd()
278
279 if options.fast_forward and options.checkpoint_restore != None:

--- 136 unchanged lines hidden (view full) ---

416 else:
417 options.take_checkpoints = offset
418 # Set all test cpus with the right number of instructions
419 # for the upcoming simulation
420 for i in xrange(np):
421 testsys.cpu[i].max_insts_any_thread = offset
422
423 checkpoint_dir = None
424 if options.checkpoint_restore != None:
425 maxtick, checkpoint_dir = findCptDir(options, maxtick, cptdir, testsys)
426 m5.instantiate(checkpoint_dir)
427
428 if options.standard_switch or cpu_class:
429 if options.standard_switch:
430 print "Switch at instruction count:%s" % \
431 str(testsys.cpu[0].max_insts_any_thread)
432 exit_event = m5.simulate()
433 elif cpu_class and options.fast_forward:
434 print "Switch at instruction count:%s" % \
435 str(testsys.cpu[0].max_insts_any_thread)

--- 57 unchanged lines hidden ---