__init__.py (3203:81c29f9756cf) __init__.py (3325:55e7e009b618)
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

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

145
146def changeToAtomic(system):
147 if not isinstance(system, objects.Root) and not isinstance(system, objects.System):
148 raise TypeError, "Object is not a root or system object. Checkpoint must be "
149 "called on a root object."
150 doDrain(system)
151 print "Changing memory mode to atomic"
152 system.changeTiming(cc_main.SimObject.Atomic)
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

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

145
146def changeToAtomic(system):
147 if not isinstance(system, objects.Root) and not isinstance(system, objects.System):
148 raise TypeError, "Object is not a root or system object. Checkpoint must be "
149 "called on a root object."
150 doDrain(system)
151 print "Changing memory mode to atomic"
152 system.changeTiming(cc_main.SimObject.Atomic)
153 resume(system)
154
155def changeToTiming(system):
156 if not isinstance(system, objects.Root) and not isinstance(system, objects.System):
157 raise TypeError, "Object is not a root or system object. Checkpoint must be "
158 "called on a root object."
159 doDrain(system)
160 print "Changing memory mode to timing"
161 system.changeTiming(cc_main.SimObject.Timing)
153
154def changeToTiming(system):
155 if not isinstance(system, objects.Root) and not isinstance(system, objects.System):
156 raise TypeError, "Object is not a root or system object. Checkpoint must be "
157 "called on a root object."
158 doDrain(system)
159 print "Changing memory mode to timing"
160 system.changeTiming(cc_main.SimObject.Timing)
162 resume(system)
163
164def switchCpus(cpuList):
165 print "switching cpus"
166 if not isinstance(cpuList, list):
167 raise RuntimeError, "Must pass a list to this function"
168 for i in cpuList:
169 if not isinstance(i, tuple):
170 raise RuntimeError, "List must have tuples of (oldCPU,newCPU)"

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

185 unready_cpus += old_cpu.startDrain(drain_event, False)
186 # If we've got some objects that can't drain immediately, then simulate
187 if unready_cpus > 0:
188 drain_event.setCount(unready_cpus)
189 simulate()
190 cc_main.cleanupCountedDrain(drain_event)
191 # Now all of the CPUs are ready to be switched out
192 for old_cpu in old_cpus:
161
162def switchCpus(cpuList):
163 print "switching cpus"
164 if not isinstance(cpuList, list):
165 raise RuntimeError, "Must pass a list to this function"
166 for i in cpuList:
167 if not isinstance(i, tuple):
168 raise RuntimeError, "List must have tuples of (oldCPU,newCPU)"

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

183 unready_cpus += old_cpu.startDrain(drain_event, False)
184 # If we've got some objects that can't drain immediately, then simulate
185 if unready_cpus > 0:
186 drain_event.setCount(unready_cpus)
187 simulate()
188 cc_main.cleanupCountedDrain(drain_event)
189 # Now all of the CPUs are ready to be switched out
190 for old_cpu in old_cpus:
193 print "switching"
194 old_cpu._ccObject.switchOut()
195 index = 0
196 for new_cpu in new_cpus:
197 new_cpu.takeOverFrom(old_cpus[index])
198 new_cpu._ccObject.resume()
199 index += 1
200
201# Since we have so many mutual imports in this package, we should:

--- 12 unchanged lines hidden ---
191 old_cpu._ccObject.switchOut()
192 index = 0
193 for new_cpu in new_cpus:
194 new_cpu.takeOverFrom(old_cpus[index])
195 new_cpu._ccObject.resume()
196 index += 1
197
198# Since we have so many mutual imports in this package, we should:

--- 12 unchanged lines hidden ---