fix: mine-validate throughput timing for short runs
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
This commit is contained in:
@@ -169,7 +169,6 @@ func main() {
|
||||
sharesFound++
|
||||
fmt.Printf(" ★ SHARE job=%-14s nonce=%s\n", jobID, nonce)
|
||||
})
|
||||
pool.Start()
|
||||
pool.SetJob(&job.Job{
|
||||
ID: "validate-001",
|
||||
Blob: testBlobHex,
|
||||
@@ -177,9 +176,11 @@ func main() {
|
||||
SeedHash: testSeedHex,
|
||||
Height: 3000000,
|
||||
})
|
||||
pool.Start()
|
||||
|
||||
fmt.Printf(" ✓ %d worker(s) started, job injected\n", *threads)
|
||||
ticker := time.NewTicker(5 * time.Second)
|
||||
pool.ResetHashCounter()
|
||||
ticker := time.NewTicker(1 * time.Second)
|
||||
done := time.After(time.Duration(*seconds) * time.Second)
|
||||
elapsed := 0
|
||||
var finalHS float64
|
||||
@@ -187,20 +188,23 @@ loop:
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
elapsed += 5
|
||||
elapsed += 1
|
||||
hs := pool.HashesPerSecond()
|
||||
pool.ResetHashCounter()
|
||||
finalHS = hs
|
||||
fmt.Printf(" [%2ds] %8.1f H/s shares=%d\n", elapsed, hs, sharesFound)
|
||||
case <-done:
|
||||
ticker.Stop()
|
||||
if hs := pool.HashesPerSecond(); hs > finalHS {
|
||||
finalHS = hs
|
||||
}
|
||||
break loop
|
||||
}
|
||||
}
|
||||
pool.Stop()
|
||||
|
||||
if finalHS < 1 {
|
||||
fail(fmt.Sprintf("hashrate is 0 after %ds", *seconds), &ok)
|
||||
if finalHS < 1 && sharesFound == 0 {
|
||||
fail(fmt.Sprintf("hashrate is 0 and no shares after %ds", *seconds), &ok)
|
||||
} else {
|
||||
fmt.Printf("\n ✓ %.0f H/s total / %.0f H/s per thread\n", finalHS, finalHS/float64(*threads))
|
||||
if sharesFound > 0 {
|
||||
|
||||
Reference in New Issue
Block a user