__init__.py (2865:ce65e5ab786f) __init__.py (2868:6a7e69fa92d3)
1# Copyright (c) 2005 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

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

29
30import sys, os, time, atexit, optparse
31
32# import the SWIG-wrapped main C++ functions
33import cc_main
34# import a few SWIG-wrapped items (those that are likely to be used
35# directly by user scripts) completely into this module for
36# convenience
1# Copyright (c) 2005 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

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

29
30import sys, os, time, atexit, optparse
31
32# import the SWIG-wrapped main C++ functions
33import cc_main
34# import a few SWIG-wrapped items (those that are likely to be used
35# directly by user scripts) completely into this module for
36# convenience
37from cc_main import simulate, SimLoopExitEvent, setCheckpointDir
37from cc_main import simulate, SimLoopExitEvent
38
39# import the m5 compile options
40import defines
41
42# define this here so we can use it right away if necessary
43def panic(string):
44 print >>sys.stderr, 'panic:', string
45 sys.exit(1)

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

234 else:
235 all_drained = True
236 cc_main.cleanupCountedDrain(drain_event)
237 return all_drained
238
239def resume(root):
240 root.resume()
241
38
39# import the m5 compile options
40import defines
41
42# define this here so we can use it right away if necessary
43def panic(string):
44 print >>sys.stderr, 'panic:', string
45 sys.exit(1)

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

234 else:
235 all_drained = True
236 cc_main.cleanupCountedDrain(drain_event)
237 return all_drained
238
239def resume(root):
240 root.resume()
241
242def checkpoint(root):
242def checkpoint(root, dir):
243 if not isinstance(root, objects.Root):
244 raise TypeError, "Object is not a root object. Checkpoint must be called on a root object."
245 doDrain(root)
246 print "Writing checkpoint"
243 if not isinstance(root, objects.Root):
244 raise TypeError, "Object is not a root object. Checkpoint must be called on a root object."
245 doDrain(root)
246 print "Writing checkpoint"
247 cc_main.serializeAll()
247 cc_main.serializeAll(dir)
248 resume(root)
249
248 resume(root)
249
250def restoreCheckpoint(root):
250def restoreCheckpoint(root, dir):
251 print "Restoring from checkpoint"
251 print "Restoring from checkpoint"
252 cc_main.unserializeAll()
252 cc_main.unserializeAll(dir)
253 resume(root)
254
255def changeToAtomic(system):
256 if not isinstance(system, objects.Root) and not isinstance(system, System):
257 raise TypeError, "Object is not a root or system object. Checkpoint must be "
258 "called on a root object."
259 doDrain(system)
260 print "Changing memory mode to atomic"

--- 47 unchanged lines hidden ---
253 resume(root)
254
255def changeToAtomic(system):
256 if not isinstance(system, objects.Root) and not isinstance(system, System):
257 raise TypeError, "Object is not a root or system object. Checkpoint must be "
258 "called on a root object."
259 doDrain(system)
260 print "Changing memory mode to atomic"

--- 47 unchanged lines hidden ---