fix: trace.profiler pretty-printing (#6138)
This PR fixes `trace.profiler.pp` not using the term pretty printer. Fixes #5872
This commit is contained in:
parent
17419aca7f
commit
2fbc46641d
2 changed files with 7 additions and 7 deletions
|
|
@ -244,8 +244,8 @@ partial def formatAux : NamingContext → Option MessageDataContext → MessageD
|
|||
| panic! s!"MessageData.ofLazy: expected MessageData in Dynamic, got {dyn.typeName}"
|
||||
formatAux nCtx ctx? msg
|
||||
|
||||
protected def format (msgData : MessageData) : IO Format :=
|
||||
formatAux { currNamespace := Name.anonymous, openDecls := [] } none msgData
|
||||
protected def format (msgData : MessageData) (ctx? : Option MessageDataContext := none) : IO Format :=
|
||||
formatAux { currNamespace := Name.anonymous, openDecls := [] } ctx? msgData
|
||||
|
||||
protected def toString (msgData : MessageData) : IO String := do
|
||||
return toString (← msgData.format)
|
||||
|
|
|
|||
|
|
@ -147,9 +147,9 @@ private partial def getFirstStart? : MessageData → Option Float
|
|||
|
||||
private partial def addTrace (pp : Bool) (thread : ThreadWithMaps) (trace : MessageData) :
|
||||
IO ThreadWithMaps :=
|
||||
(·.2) <$> StateT.run (go none trace) thread
|
||||
(·.2) <$> StateT.run (go none none trace) thread
|
||||
where
|
||||
go parentStackIdx? : _ → StateT ThreadWithMaps IO Unit
|
||||
go parentStackIdx? ctx? : _ → StateT ThreadWithMaps IO Unit
|
||||
| .trace data msg children => do
|
||||
if data.startTime == 0 then
|
||||
return -- no time data, skip
|
||||
|
|
@ -157,7 +157,7 @@ where
|
|||
if !data.tag.isEmpty then
|
||||
funcName := s!"{funcName}: {data.tag}"
|
||||
if pp then
|
||||
funcName := s!"{funcName}: {← msg.format}"
|
||||
funcName := s!"{funcName}: {← msg.format ctx?}"
|
||||
let strIdx ← modifyGet fun thread =>
|
||||
if let some idx := thread.stringMap[funcName]? then
|
||||
(idx, thread)
|
||||
|
|
@ -212,7 +212,7 @@ where
|
|||
threadCPUDelta := thread.samples.threadCPUDelta.push 0.0 |>.push (nextStart - thread.lastTime)
|
||||
length := thread.samples.length + 2
|
||||
} }
|
||||
go (some stackIdx) c
|
||||
go (some stackIdx) ctx? c
|
||||
-- add remaining slice after last child
|
||||
modify fun thread => { thread with
|
||||
lastTime := data.stopTime
|
||||
|
|
@ -223,7 +223,7 @@ where
|
|||
threadCPUDelta := thread.samples.threadCPUDelta.push 0.0 |>.push (data.stopTime - thread.lastTime)
|
||||
length := thread.samples.length + 2
|
||||
} }
|
||||
| .withContext _ msg => go parentStackIdx? msg
|
||||
| .withContext ctx msg => go parentStackIdx? (some ctx) msg
|
||||
| _ => return
|
||||
|
||||
def Thread.new (name : String) : Thread := {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue