From db842fedbf46275ec4b3c262f9ca7ad21e74bcbc Mon Sep 17 00:00:00 2001 From: David Li Date: Thu, 7 Jan 2016 15:35:31 -0700 Subject: Always provide stall report --- src/simulator.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/simulator.rs b/src/simulator.rs index dd851e5..c1a300d 100644 --- a/src/simulator.rs +++ b/src/simulator.rs @@ -384,22 +384,25 @@ impl<'a, T: SyscallHandler> Simulator<'a, T> { core.cache.borrow_mut().step(); ran = true; } - if !ran { - println!("All cores are not running, stopping..."); - for (i, core) in self.cores.iter().enumerate() { - println!("Core {}: stalled {} of {}", i, core.stall_count, core.cycle_count); - } - } ran } + fn report(&self) { + for (i, core) in self.cores.iter().enumerate() { + println!("Core {}: stalled {} of {}", i, core.stall_count, core.cycle_count); + } + } + pub fn run(&mut self) { loop { if !self.step() { break } } + + println!("All cores are not running, stopping..."); + self.report(); } pub fn run_max(&mut self, cycles: usize) { @@ -408,5 +411,8 @@ impl<'a, T: SyscallHandler> Simulator<'a, T> { break } } + + println!("Out of cycles, stopping..."); + self.report(); } } -- cgit v1.2.3