mirror of
https://github.com/logos-storage/nim-chroprof.git
synced 2026-03-23 04:23:35 +00:00
enable/stop -> attach/detach
This commit is contained in:
parent
b972187054
commit
a732b55488
@ -15,7 +15,7 @@ proc enableProfiling*(callback: EventCallback = nil) =
|
||||
## Enables profiling for the the event loop running in the current thread.
|
||||
## The client may optionally supply a callback to be notified of `Future`
|
||||
## events.
|
||||
enableMonitoring(
|
||||
attachMonitoring(
|
||||
if (isNil(callback)):
|
||||
proc(e: Event) {.nimcall.} =
|
||||
profilerInstance.processEvent(e)
|
||||
|
||||
@ -58,7 +58,7 @@ proc handleAsyncFutureEvent*(
|
||||
if not isNil(handleFutureEvent):
|
||||
handleFutureEvent(mkEvent(future, extendedState))
|
||||
|
||||
proc enableMonitoring*(callback: EventCallback) =
|
||||
proc attachMonitoring*(callback: EventCallback) =
|
||||
## Enables monitoring of Chronos `Future` state transitions on the
|
||||
## event loop that runs in the current thread. The provided callback will be
|
||||
## called at every such event.
|
||||
@ -66,7 +66,7 @@ proc enableMonitoring*(callback: EventCallback) =
|
||||
onAsyncFutureEvent = handleAsyncFutureEvent
|
||||
handleFutureEvent = callback
|
||||
|
||||
proc stopMonitoring*() =
|
||||
proc detachMonitoring*() =
|
||||
onBaseFutureEvent = nil
|
||||
onAsyncFutureEvent = nil
|
||||
handleFutureEvent = nil
|
||||
|
||||
@ -30,11 +30,11 @@ proc recordSegment*(segment: string) =
|
||||
proc stopRecording*(): void =
|
||||
recording = @[]
|
||||
rawRecording = @[]
|
||||
stopMonitoring()
|
||||
detachMonitoring()
|
||||
|
||||
proc startRecording*() =
|
||||
stopRecording()
|
||||
enableMonitoring(recordEvent)
|
||||
attachMonitoring(recordEvent)
|
||||
|
||||
proc forProc*(self: var MetricsTotals, procedure: string): AggregateMetrics =
|
||||
for (key, aggMetrics) in self.mpairs:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user