else:
print "System already in target mode. Memory mode unchanged."
-def switchCpus(system, cpuList, do_drain=True):
+def switchCpus(system, cpuList, do_drain=True, verbose=True):
"""Switch CPUs in a system.
By default, this method drains and resumes the system. This
Keyword Arguments:
do_drain -- Perform a drain/resume of the system when switching.
"""
- print "switching cpus"
+
+ if verbose:
+ print "switching cpus"
+
if not isinstance(cpuList, list):
raise RuntimeError, "Must pass a list to this function"
for item in cpuList:
def first(self):
return self.cpus[self.first_cpu]
-def run_test(root, switcher=None, freq=1000):
+def run_test(root, switcher=None, freq=1000, verbose=False):
"""Test runner for CPU switcheroo tests.
The switcheroo test runner is used to switch CPUs in a system that
switcher -- CPU switcher implementation. See Sequential for
an example implementation.
period -- Switching frequency in Hz.
+ verbose -- Enable output at each switch (suppressed by default).
"""
if switcher == None:
system = root.system
system.mem_mode = type(current_cpu).memory_mode()
+ # Suppress "Entering event queue" messages since we get tons of them.
+ # Worse yet, they include the timestamp, which makes them highly
+ # variable and unsuitable for comparing as test outputs.
+ m5.internal.core.cvar.want_info = verbose
+
# instantiate configuration
m5.instantiate()
if exit_cause == "simulate() limit reached":
next_cpu = switcher.next()
- print "Switching CPUs..."
- print "Next CPU: %s" % type(next_cpu)
+ if verbose:
+ print "Switching CPUs..."
+ print "Next CPU: %s" % type(next_cpu)
m5.drain(system)
if current_cpu != next_cpu:
m5.switchCpus(system, [ (current_cpu, next_cpu) ],
- do_drain=False)
+ do_drain=False, verbose=verbose)
else:
print "Source CPU and destination CPU are the same, skipping..."
m5.resume(system)