use chronosFutureDuration to measure time

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2023-07-07 11:53:49 +02:00
parent 2c7685229d
commit f24ca72de0
No known key found for this signature in database
GPG Key ID: 0FE274EE8C95166E
3 changed files with 6 additions and 4 deletions

View File

@ -116,7 +116,6 @@ when isMainModule:
# generate block and push data
info "starting upload to DHT"
let startTime = Moment.now()
var futs = newSeq[Future[seq[Node]]]()
for s in 0 ..< blocksize:
let
@ -127,8 +126,10 @@ when isMainModule:
futs.add(nodes[0][0].addValue(key, segment))
let pass = await allFutures(futs).withTimeout(upload_timeout)
info "uploaded to DHT", by = 0, pass, time = Moment.now() - startTime
let
allFinished = allFutures(futs).withTimeout(upload_timeout)
pass = await allFinished
info "uploaded to DHT", by = 0, pass, time = allFinished.duration
# sample
proc startSamplingDA(n: discv5_protocol.Protocol): seq[Future[DiscResult[seq[byte]]]] =

View File

@ -1,2 +1,3 @@
patchFile("chronos", "chronos", "chronosim/chronos")
patchFile("nimcrypto", "rijndael", "chronosim/rijndael")
--d:chronosFutureDuration

2
vendor/nim-chronos vendored

@ -1 +1 @@
Subproject commit 5b9ec0837c4f6774b68bd9e5ccc36bd79a65e57d
Subproject commit 2f66813f92a4d7cedbd9086c42f6a227be39eed1