diff --git a/feather/common/src/tick_loop.rs b/feather/common/src/tick_loop.rs index 8709087c7..ce985490d 100644 --- a/feather/common/src/tick_loop.rs +++ b/feather/common/src/tick_loop.rs @@ -1,4 +1,6 @@ use std::time::Instant; +use std::backtrace::Backtrace; +use std::time::Duration; use base::TICK_DURATION; @@ -22,6 +24,7 @@ impl TickLoop { pub fn run(mut self) { loop { let start = Instant::now(); + let should_exit = (self.function)(); if should_exit { return; @@ -29,7 +32,8 @@ impl TickLoop { let elapsed = start.elapsed(); if elapsed > TICK_DURATION { - log::warn!("Tick took too long ({:?})", elapsed); + let bt = Backtrace::force_capture(); + log::warn!("Tick took too long ({:?}), backtrace: {:?}", elapsed, bt); } else { std::thread::sleep(TICK_DURATION - elapsed); }