diff --git a/src/main.rs b/src/main.rs index 6f6adadd4..0e9a7021c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -234,6 +234,7 @@ fn main() -> Result<()> { use_color, &commands, input, + entire_start_time, ) } else if !script_name.is_empty() { run_file( diff --git a/src/run.rs b/src/run.rs index 99eaf4f60..ffd0fb8fc 100644 --- a/src/run.rs +++ b/src/run.rs @@ -16,6 +16,7 @@ pub(crate) fn run_commands( use_color: bool, commands: &nu_protocol::Spanned, input: PipelineData, + entire_start_time: std::time::Instant, ) -> Result<(), miette::ErrReport> { let mut stack = nu_protocol::engine::Stack::new(); let start_time = std::time::Instant::now(); @@ -69,6 +70,8 @@ pub(crate) fn run_commands( use_color, ); + // Before running commands, set up the startup time + engine_state.set_startup_time(entire_start_time.elapsed().as_nanos() as i64); let start_time = std::time::Instant::now(); let ret_val = evaluate_commands( commands,