A structured view of a trace message (MessageData.trace), used by trace postprocessors
(see TracePostprocessor).
- node
(data : TraceData)
(msg : MessageData)
(children : Array TraceTree)
(wrap : MessageData → MessageData)
: TraceTree
A trace node
[data.cls] msgwith the given children.wraprestores the context wrappers (MessageData.withContextetc.) that were peeled off the originalMessageDatawhile decomposing it; it is re-applied around the node bytoMessageData. - leaf
(msg : MessageData)
: TraceTree
A child message that is not itself a trace node (e.g. produced by
addRawTrace).
Instances For
Decomposes trace MessageData into a TraceTree. The MessageData can be reconstructed using
TraceTree.toMessageData.
Equations
Instances For
Reassembles the MessageData of a trace tree.
A trace postprocessor transforms the trace roots of a trace message before it is reported, e.g. by filtering out irrelevant subtrees or pre-expanding interesting nodes. Returning an empty array drops the trace message entirely.
Traces are reported as one message per source range inside a command, and a postprocessor is applied to each of these messages separately; it therefore cannot move trace roots from one source range to another.
Postprocessors are applied by the postprocess_traces post in cmd command and can be composed
left-to-right with >=>.
Equations
Instances For
Equations
- Lean.PostprocessTraces.instInhabitedTracePostprocessor = { default := fun (roots : Array Lean.PostprocessTraces.TraceTree) => pure roots }
A pattern selects the trace subtrees that an operation acts on (see filter, hoist, and
expand). Patterns are ordinary predicates: the built-in ones (such as containsString,
unsuccessful, or minTimeMs) can be combined with custom conditions in a fun.
Instances For
The TraceData of a trace node; none for leaf messages.
Equations
- (Lean.PostprocessTraces.TraceTree.node data msg children wrap).data? = some data
- (Lean.PostprocessTraces.TraceTree.leaf msg).data? = none
Instances For
The trace class of a trace node; none for leaf messages.
Equations
- t.cls? = Option.map (fun (x : Lean.TraceData) => x.cls) t.data?
Instances For
The children of this tree.
Equations
- (Lean.PostprocessTraces.TraceTree.node data msg children wrap).children = children
- (Lean.PostprocessTraces.TraceTree.leaf msg).children = #[]
Instances For
Replaces the children of a trace node. Leaf messages are returned unchanged.
Equations
- (Lean.PostprocessTraces.TraceTree.node data msg children_1 wrap).withChildren children = Lean.PostprocessTraces.TraceTree.node data msg children wrap
- (Lean.PostprocessTraces.TraceTree.leaf msg).withChildren children = Lean.PostprocessTraces.TraceTree.leaf msg
Instances For
Transforms the TraceData of a trace node. Leaf messages are returned unchanged.
Equations
- (Lean.PostprocessTraces.TraceTree.node data msg children wrap).modifyData f = Lean.PostprocessTraces.TraceTree.node (f data) msg children wrap
- (Lean.PostprocessTraces.TraceTree.leaf msg).modifyData f = Lean.PostprocessTraces.TraceTree.leaf msg
Instances For
Elapsed time of this node that is not accounted for by its children, in seconds; 0 if no
profiling data is available.
Equations
- t.selfElapsed = max 0 (t.elapsed - Array.foldl (fun (s : Float) (c : Lean.PostprocessTraces.TraceTree) => s + c.elapsed) 0 t.children)
Instances For
The message of this node (without its children), formatted as a string. Useful for text-based filters but expensive.
Equations
- One or more equations did not get rendered due to their size.
- (Lean.PostprocessTraces.TraceTree.leaf msg).headText = msg.toString
Instances For
The TraceResult of a trace node; none for leaf messages and nodes without a result.
Instances For
Collects all maximal subtrees satisfying p in acc: adds t itself if p t holds, and
otherwise recurses into the children. Matching subtrees are not searched for nested matches.
Prunes the tree to the subtrees satisfying p, keeping their ancestors for context; none if
there is no match. The resulting tree consists of those nodes that either have a matching
ancestor or transitive child. Matching subtrees are not searched for nested matches.
Decomposes the synthetic container message produced by addTraceAsMessages
(.tagged `trace <| .trace _ _ roots, possibly inside context wrappers) into its trace roots,
together with a function that reassembles the container from transformed roots.
Equations
Instances For
Applies post to a trace message (see addTraceAsMessages), returning none if the
postprocessor dropped all roots of the message. Non-trace messages are returned unchanged.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Runs a command and returns all messages (sync and async) it produces, clearing the snapshot tasks after collection so that async messages are not reported twice. The surrounding message log is unaffected; it is restored even if the command is interrupted.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Evaluates the postprocessor without leaking the traces produced by elaborating the postprocessor term itself into the (typically trace-enabled) surrounding context.
Equations
- One or more equations did not get rendered due to their size.