From 7bce17f56b81edcc29936a852358c411fb8ccfa7 Mon Sep 17 00:00:00 2001 From: colin Date: Mon, 22 Aug 2022 02:32:58 -0700 Subject: [PATCH] driver: more precisely measure stimuli "prep" i'm beginning to think the `threadpool` library is actually just kinda slow. --- crates/coremem/src/diagnostics.rs | 3 +-- crates/coremem/src/driver.rs | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/coremem/src/diagnostics.rs b/crates/coremem/src/diagnostics.rs index 0290a48..539e29e 100644 --- a/crates/coremem/src/diagnostics.rs +++ b/crates/coremem/src/diagnostics.rs @@ -62,8 +62,7 @@ impl Diagnostics { let render_prep_time = self.time_prepping_render.as_secs_f64(); let stim_block_time = self.time_blocked_on_stim.as_secs_f64(); let render_block_time = self.time_blocked_on_render.as_secs_f64(); - // "stimuli prep" includes any blocking operations - let stim_prep_time = self.time_prepping_stim.as_secs_f64() - stim_block_time; + let stim_prep_time = self.time_prepping_stim.as_secs_f64(); let other_driver_time = driver_time - ( step_time + stim_block_time + stim_prep_time + render_block_time + render_prep_time diff --git a/crates/coremem/src/driver.rs b/crates/coremem/src/driver.rs index a25d4e6..7714b32 100644 --- a/crates/coremem/src/driver.rs +++ b/crates/coremem/src/driver.rs @@ -273,11 +273,10 @@ where let steps_this_time = (step_to - start_step).try_into().unwrap(); let meta = self.state.meta(); - let stim = self.diag.instrument_stimuli_prep(|| { - let stim = self.stimuli.get_for(meta, start_step); - // prefetch the next stimulus, in the background. + let stim = self.stimuli.get_for(meta, start_step); + // prefetch the next stimulus, in the background. + self.diag.instrument_stimuli_prep(|| { self.stimuli.start_job(meta, step_to); - stim }); trace!("step begin");