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
This commit is contained in:
parent
690af580c9
commit
c321025725
@ -234,13 +234,18 @@ void HAL_SITL::run(int argc, char * const argv[], Callbacks* callbacks) const
|
|||||||
setup_signal_handlers();
|
setup_signal_handlers();
|
||||||
|
|
||||||
uint32_t last_watchdog_save = AP_HAL::millis();
|
uint32_t last_watchdog_save = AP_HAL::millis();
|
||||||
|
uint8_t fill_count = 0;
|
||||||
|
|
||||||
while (!HALSITL::Scheduler::_should_reboot) {
|
while (!HALSITL::Scheduler::_should_reboot) {
|
||||||
if (HALSITL::Scheduler::_should_exit) {
|
if (HALSITL::Scheduler::_should_exit) {
|
||||||
::fprintf(stderr, "Exitting\n");
|
::fprintf(stderr, "Exitting\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
fill_stack_nan();
|
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();
|
callbacks->loop();
|
||||||
HALSITL::Scheduler::_run_io_procs();
|
HALSITL::Scheduler::_run_io_procs();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user