Browse Source

HAL_SITL: run nanf fill every 10 loops

this saves a lot of cpu while still giving protection
it reduces time to run a test replay from 8.1s to 4.1s
c415-sdk
Andrew Tridgell 4 years ago
parent
commit
c321025725
  1. 5
      libraries/AP_HAL_SITL/HAL_SITL_Class.cpp

5
libraries/AP_HAL_SITL/HAL_SITL_Class.cpp

@ -234,13 +234,18 @@ void HAL_SITL::run(int argc, char * const argv[], Callbacks* callbacks) const @@ -234,13 +234,18 @@ void HAL_SITL::run(int argc, char * const argv[], Callbacks* callbacks) const
setup_signal_handlers();
uint32_t last_watchdog_save = AP_HAL::millis();
uint8_t fill_count = 0;
while (!HALSITL::Scheduler::_should_reboot) {
if (HALSITL::Scheduler::_should_exit) {
::fprintf(stderr, "Exitting\n");
exit(0);
}
if (fill_count++ % 10 == 0) {
// only fill every 10 loops. This still gives us a lot of
// protection, but saves a lot of CPU
fill_stack_nan();
}
callbacks->loop();
HALSITL::Scheduler::_run_io_procs();

Loading…
Cancel
Save