mirror of
https://github.com/logos-storage/nim-chronos.git
synced 2026-01-05 23:13:08 +00:00
futures profiling instrumentation
This commit is contained in:
parent
f9909c4053
commit
ac6c22c51a
@ -319,6 +319,9 @@ proc futureContinue*(fut: FutureBase) {.raises: [], gcsafe.} =
|
||||
var next: FutureBase
|
||||
template iterate =
|
||||
while true:
|
||||
when chronosFuturesInstrumentation:
|
||||
if not(isNil(onFutureRunning)):
|
||||
onFutureRunning(fut)
|
||||
# Call closure to make progress on `fut` until it reaches `yield` (inside
|
||||
# `await` typically) or completes / fails / is cancelled
|
||||
next = fut.internalClosure(fut)
|
||||
|
||||
@ -247,6 +247,7 @@ suite "Asynchronous utilities test suite":
|
||||
echo "avg wallTime:\t", v.totalWallTime div count, "\ttotal: ", v.totalWallTime
|
||||
echo "avg runTime:\t", v.totalRunTime div count, "\ttotal: ", v.totalRunTime
|
||||
if k.procedure == "simpleAsync1":
|
||||
echo "v: ", v
|
||||
check v.totalExecTime >= 150.milliseconds()
|
||||
check v.totalExecTime <= 180.milliseconds()
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user