jtroo / jtroo.github.io

jtroo's GitHub Pages page
https://jtroo.github.io/
Mozilla Public License 2.0
0 stars 0 forks source link

Simulator should handle `on-idle` correctly #4

Open jtroo opened 2 months ago

jtroo commented 2 months ago

It does not today; since this is extra code that runs in a different part of the processing loop, on-idle never activates.

jtroo commented 2 months ago

Wait... is that right? Maybe I just had a buggy cfg

jtroo commented 2 months ago

Ah yes indeed it is here:

                    let is_idle = k.is_idle();
                    // Note: checking waiting_for_idle can not be part of the computation for
                    // is_idle() since incrementing ticks_since_idle is dependent on the return
                    // value of is_idle().
                    let counting_idle_ticks =
                        !k.waiting_for_idle.is_empty() || k.live_reload_requested;
                    if !is_idle {
                        k.ticks_since_idle = 0;
                    } else if is_idle && counting_idle_ticks {
                        k.ticks_since_idle = k.ticks_since_idle.saturating_add(ms_elapsed);
                        #[cfg(feature = "perf_logging")]
                        log::info!("ticks since idle: {}", k.ticks_since_idle);
                    }