Per-stage computation times

This commit is contained in:
greg 2019-05-25 22:21:52 -07:00
parent fe7ba339b5
commit 6162bae1ac
3 changed files with 16 additions and 0 deletions

View File

@ -90,6 +90,16 @@ pub fn get_directives(language_state: &mut Box<ProgrammingLanguageInterface>) ->
None
})),
CommandTree::terminal("off", None, vec![], Box::new(turn_off)),
]),
CommandTree::nonterm("stage-times", Some("Computation time per-stage"), vec![
CommandTree::terminal("on", None, vec![], Box::new(|repl: &mut Repl, _: &[&str]| {
repl.options.show_stage_times = true;
None
})),
CommandTree::terminal("off", None, vec![], Box::new(|repl: &mut Repl, _: &[&str]| {
repl.options.show_stage_times = false;
None
})),
])
]
),

View File

@ -197,6 +197,10 @@ impl Repl {
buf.push_str(&format!("Total duration: {:?}\n", response.global_output_stats.total_duration));
}
if self.options.show_stage_times {
buf.push_str(&format!("{:?}\n", response.global_output_stats.stage_durations));
}
buf.push_str(&match response.main_output {
Ok(s) => s,
Err(e) => format!("{} {}", "Error".red(), e)

View File

@ -8,6 +8,7 @@ use std::fs::File;
pub struct ReplOptions {
pub debug_asks: HashSet<DebugAsk>,
pub show_total_time: bool,
pub show_stage_times: bool,
}
impl ReplOptions {
@ -15,6 +16,7 @@ impl ReplOptions {
ReplOptions {
debug_asks: HashSet::new(),
show_total_time: true,
show_stage_times: false,
}
}