Skip to content

Commit

Permalink
pause execution timer during &sc
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Mar 25, 2024
1 parent f050403 commit 0264272
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use std::{
path::{Path, PathBuf},
str::FromStr,
sync::Arc,
time::Instant,
};

use crossbeam_channel::{Receiver, Sender, TryRecvError};
Expand All @@ -25,7 +26,7 @@ use crate::{
lex::Span,
value::Value,
Assembly, Compiler, Complex, Global, Ident, Inputs, IntoSysBackend, LocalName, Primitive,
SafeSys, SysBackend, TraceFrame, UiuaError, UiuaResult, VERSION,
SafeSys, SysBackend, SysOp, TraceFrame, UiuaError, UiuaResult, VERSION,
};

/// The Uiua interpreter
Expand Down Expand Up @@ -451,6 +452,15 @@ code:
}
let res = match instr {
Instr::Comment(_) => Ok(()),
// Pause execution timer during &sc
&Instr::Prim(prim @ Primitive::Sys(SysOp::ScanLine), span) => {
self.with_prim_span(span, Some(prim), |env| {
let start = instant::now();
let res = prim.run(env);
env.rt.execution_start += instant::now() - start;
res
})
}
&Instr::Prim(prim, span) => {
self.with_prim_span(span, Some(prim), |env| prim.run(env))
}
Expand Down

0 comments on commit 0264272

Please sign in to comment.