This commit is contained in:
Jaremy Creechley 2023-10-31 14:11:57 -07:00 committed by gmega
parent 46c6efd780
commit 2f4bc85d58
No known key found for this signature in database
GPG Key ID: FFD8DAF00660270F
2 changed files with 12 additions and 11 deletions

View File

@ -38,7 +38,7 @@ proc setFutureCreate(fut: FutureBase) {.raises: [].} =
perFutureMetrics[fut.id] = FutureMetric()
perFutureMetrics.withValue(fut.id, metric):
metric.created = Moment.now()
echo loc, "; future create "
# echo loc, "; future create "
proc setFutureStart(fut: FutureBase) {.raises: [].} =
## used for setting the duration
@ -48,7 +48,7 @@ proc setFutureStart(fut: FutureBase) {.raises: [].} =
let ts = Moment.now()
metric.start = some ts
metric.blocks.inc()
echo loc, "; future start: ", metric.initDuration
# echo loc, "; future start: ", metric.initDuration
proc setFuturePause(fut, child: FutureBase) {.raises: [].} =
## used for setting the duration
@ -71,11 +71,11 @@ proc setFuturePause(fut, child: FutureBase) {.raises: [].} =
# the first block of a child iterator also
# runs on the parents clock, so we track our first block
# time so any parents can get it
echo loc, "; child firstBlock time: ", initDurationChildren
# echo loc, "; child firstBlock time: ", initDurationChildren
metric.durationChildren += durationChildren
metric.start = none Moment
echo loc, "; future pause ", if childLoc.isNil: "" else: " child: " & $childLoc
# echo loc, "; future pause ", if childLoc.isNil: "" else: " child: " & $childLoc
proc setFutureDuration(fut: FutureBase) {.raises: [].} =
## used for setting the duration
@ -88,11 +88,11 @@ proc setFutureDuration(fut: FutureBase) {.raises: [].} =
discard futureSummaryMetrics.hasKeyOrPut(loc, CallbackMetric(minSingleTime: InfiniteDuration))
futureSummaryMetrics.withValue(loc, metric):
echo loc, " set duration: ", futureSummaryMetrics.hasKey(loc)
# echo loc, " set duration: ", futureSummaryMetrics.hasKey(loc)
metric.totalExecTime += fm.duration
metric.totalWallTime += Moment.now() - fm.created
metric.totalRunTime += metric.totalExecTime + fm.durationChildren
echo loc, " child duration: ", fm.durationChildren
# echo loc, " child duration: ", fm.durationChildren
metric.count.inc
metric.minSingleTime = min(metric.minSingleTime, fm.duration)
metric.maxSingleTime = max(metric.maxSingleTime, fm.duration)
@ -102,19 +102,20 @@ proc setFutureDuration(fut: FutureBase) {.raises: [].} =
metric.count = 0
onFutureCreate =
proc (f: FutureBase) {.gcsafe.} =
proc (f: FutureBase) {.gcsafe, raises: [].} =
{.cast(gcsafe).}:
f.setFutureCreate()
onFutureRunning =
proc (f: FutureBase) {.gcsafe.} =
proc (f: FutureBase) {.gcsafe, raises: [].} =
{.cast(gcsafe).}:
f.setFutureStart()
onFuturePause =
proc (f, child: FutureBase) {.gcsafe.} =
proc (f, child: FutureBase) {.gcsafe, raises: [].} =
{.cast(gcsafe).}:
# echo "onFuturePause: ", f.pointer.repr, " ch: ", child.pointer.repr
f.setFuturePause(child)
onFutureStop =
proc (f: FutureBase) {.gcsafe.} =
proc (f: FutureBase) {.gcsafe, raises: [].} =
{.cast(gcsafe).}:
f.setFuturePause(nil)
f.setFutureDuration()

2
vendor/nim-chronos vendored

@ -1 +1 @@
Subproject commit d79aa01d7dac8bd033955e4f24dba30c857049b1
Subproject commit bd656ab6dfa61497533ebd2f38a1a5d98bfa40aa