lean4-htt/src/Lean/Elab/Time.lean
2025-07-25 12:02:51 +00:00

30 lines
641 B
Text

/-
Copyright (c) 2021 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
module
prelude
public import Lean.Elab.Command
public section
/-!
# Defines `#time` command.
Time the elaboration of a command, and print the result (in milliseconds).
-/
namespace Lean.Elab.Time
open Command
@[builtin_command_elab Lean.Parser.timeCmd] def elabTimeCmd : CommandElab
| `(#time%$tk $stx:command) => do
let start ← IO.monoMsNow
elabCommand stx
logInfoAt tk m!"time: {(← IO.monoMsNow) - start}ms"
| _ => throwUnsupportedSyntax
end Lean.Elab.Time