mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
timer print
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
1b0289c6c6
commit
f10e78bece
1 changed files with 18 additions and 0 deletions
|
|
@ -541,6 +541,22 @@ func InspectDatabase(db ethdb.Database, keyPrefix, keyStart []byte, workers int)
|
||||||
var eg errgroup.Group
|
var eg errgroup.Group
|
||||||
eg.SetLimit(workers)
|
eg.SetLimit(workers)
|
||||||
|
|
||||||
|
// Start progress reporting goroutine
|
||||||
|
done := make(chan struct{})
|
||||||
|
go func() {
|
||||||
|
ticker := time.NewTicker(8 * time.Second)
|
||||||
|
defer ticker.Stop()
|
||||||
|
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-ticker.C:
|
||||||
|
log.Info("Inspecting database progress", "count", totalCount.Load(), "size", common.StorageSize(totalSize.Load()), "elapsed", common.PrettyDuration(time.Since(start)))
|
||||||
|
case <-done:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
log.Info("Starting parallel database inspection", "workers", workers)
|
log.Info("Starting parallel database inspection", "workers", workers)
|
||||||
|
|
||||||
for i := 0; i < 256; i++ {
|
for i := 0; i < 256; i++ {
|
||||||
|
|
@ -549,8 +565,10 @@ func InspectDatabase(db ethdb.Database, keyPrefix, keyStart []byte, workers int)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := eg.Wait(); err != nil {
|
if err := eg.Wait(); err != nil {
|
||||||
|
close(done)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
close(done)
|
||||||
|
|
||||||
// Display the database statistic of key-value store.
|
// Display the database statistic of key-value store.
|
||||||
stats := [][]string{
|
stats := [][]string{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue