Measure duration of mempool sync

pull/1/head
Martin Boehm 2018-02-01 11:23:37 +01:00
parent 7185060f62
commit ed47171406
1 changed files with 4 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package bchain
import (
"encoding/hex"
"sync"
"time"
"github.com/golang/glog"
)
@ -39,7 +40,8 @@ func (m *Mempool) updateMaps(newScriptToTx map[string][]string, newTxToScript ma
// Resync is not reentrant, it should be called from a single thread.
// Read operations (GetTransactions) are safe.
func (m *Mempool) Resync() error {
glog.Info("Mempool: resync")
start := time.Now()
glog.V(1).Info("Mempool: resync")
txs, err := m.chain.GetMempool()
if err != nil {
return err
@ -68,6 +70,6 @@ func (m *Mempool) Resync() error {
}
}
m.updateMaps(newScriptToTx, newTxToScript)
glog.Info("Mempool: resync finished, ", len(m.txToScript), " transactions in mempool")
glog.Info("Mempool: resync finished in ", time.Since(start), ", ", len(m.txToScript), " transactions in mempool")
return nil
}