diff options
author | David Li <li.davidm96@gmail.com> | 2016-01-07 15:35:31 -0700 |
---|---|---|
committer | David Li <li.davidm96@gmail.com> | 2016-01-07 15:35:31 -0700 |
commit | db842fedbf46275ec4b3c262f9ca7ad21e74bcbc (patch) | |
tree | 5307f5cc73ce06ab2ea58a300cd15c86cef5f9c8 /src | |
parent | 1374c4e812ea584b59a5ed08001e8362a8aa3a66 (diff) |
Always provide stall report
Diffstat (limited to 'src')
-rw-r--r-- | src/simulator.rs | 18 |
1 files 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(); } } |