DAS: run sampling in parallel from each node
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
3af8b672c6
commit
660118684c
17
das/das.nim
17
das/das.nim
|
@ -171,8 +171,23 @@ when isMainModule:
|
|||
info "sample", by = n.localNode, pass, cnt = passcount, time
|
||||
return (pass, passcount, time)
|
||||
|
||||
# all nodes start sampling in parallel
|
||||
var samplings = newSeq[Future[(bool, int, Duration)]]()
|
||||
for n in 1 ..< nodecount:
|
||||
discard await sample(nodes[n][0])
|
||||
samplings.add(sample(nodes[n][0]))
|
||||
await allFutures(samplings)
|
||||
|
||||
# print statistics
|
||||
var
|
||||
passed = 0
|
||||
for f in samplings:
|
||||
if f.finished():
|
||||
let (pass, passcount, time) = await f
|
||||
passed += pass.int
|
||||
debug "sampleStats", pass, cnt = passcount, time
|
||||
else:
|
||||
error "This should not happen!"
|
||||
info "sampleStats", passed, total = samplings.len
|
||||
|
||||
waitfor main()
|
||||
|
||||
|
|
Loading…
Reference in New Issue