Macro
Timer
macro Timer(context: TokenTreeMacroContext) -> StatementSyntax
Namespace: Raven.Macros
Assembly: Raven.Macros.dll
Source file: Timer.rvn
Measures an ordinary Raven block body with
System.Diagnostics.Stopwatch and writes the elapsed duration. An optional
message template uses {time} for the elapsed duration while retaining
Raven's ordinary $name and ${expression} interpolation.
The invocation occupies statement position. Release builds report a warning so accidental instrumentation is visible without preventing compilation.
Example
import Raven.Macros.*
timer! {
let index = LoadIndex()
Rebuild(index)
Save(index)
}
let operation = "Index rebuild"
timer! "$operation succeeded in {time}" {
RebuildIndex()
}