mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
cosmetic: refactor log
This commit is contained in:
parent
f2c21d5814
commit
cea17ee755
3 changed files with 24 additions and 24 deletions
|
|
@ -48,7 +48,6 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/metrics"
|
"github.com/ethereum/go-ethereum/metrics"
|
||||||
"github.com/ethereum/go-ethereum/node"
|
"github.com/ethereum/go-ethereum/node"
|
||||||
"github.com/ethereum/go-ethereum/params"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
"github.com/ethereum/go-ethereum/trie"
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -447,9 +446,19 @@ func showMetrics() {
|
||||||
fmt.Println("blockCrossValidationTimer", blockCrossValidationTimer.Total())
|
fmt.Println("blockCrossValidationTimer", blockCrossValidationTimer.Total())
|
||||||
|
|
||||||
// execution
|
// execution
|
||||||
fmt.Println("prefetchTimer", blockPrefetchExecuteTimer.Total())
|
fmt.Println("prefetchTimer :", blockPrefetchExecuteTimer.Total())
|
||||||
|
fmt.Println("prefetchBALtime: ", core.PrefetchBALTime)
|
||||||
|
|
||||||
|
// execution: parallel merging post state for deriving the new stateRoot
|
||||||
|
fmt.Println("postStateMergeTime:", core.PostMergeTime)
|
||||||
|
fmt.Println("prefetchTrieWallT:", core.PrefetchTrieTimer)
|
||||||
|
// execution: parallel execution for validation
|
||||||
|
fmt.Println("prestateMergeTime:", core.PrefetchMergeBALTime)
|
||||||
|
fmt.Println("parallelExeTime: ", core.ParallelExeTime)
|
||||||
|
// Other:Sync state time
|
||||||
|
fmt.Println("prefetchChTime: ", core.PrefetchChTime)
|
||||||
|
|
||||||
fmt.Println("accountReadTimer", accountReadTimer.Total())
|
fmt.Println("accountReadTimer", accountReadTimer.Total())
|
||||||
fmt.Println("ResolveTimer", trie.ResolveTime)
|
|
||||||
fmt.Println("storageReadTimer", storageReadTimer.Total())
|
fmt.Println("storageReadTimer", storageReadTimer.Total())
|
||||||
fmt.Println("blockExecutionTimer", blockExecutionTimer.Total())
|
fmt.Println("blockExecutionTimer", blockExecutionTimer.Total())
|
||||||
|
|
||||||
|
|
@ -465,27 +474,19 @@ func showMetrics() {
|
||||||
fmt.Println("triedbCommitTimer", triedbCommitTimer.Total())
|
fmt.Println("triedbCommitTimer", triedbCommitTimer.Total())
|
||||||
fmt.Println("blockWriteTimer", blockWriteTimer.Total())
|
fmt.Println("blockWriteTimer", blockWriteTimer.Total())
|
||||||
|
|
||||||
// Parallel
|
// Others
|
||||||
fmt.Println("StateSetTime: ", state.StateSetTime)
|
fmt.Println("StateSetTime: ", state.StateSetTime)
|
||||||
fmt.Println("StateLoadTime: ", state.StateLoadTime)
|
fmt.Println("StateLoadTime: ", state.StateLoadTime)
|
||||||
fmt.Println("StateFinaliTime: ", state.StateFinalizeTime)
|
fmt.Println("StateFinaliTime: ", state.StateFinalizeTime)
|
||||||
fmt.Println("StateCopyTime: ", state.StateCopyTime)
|
fmt.Println("StateCopyTime: ", state.StateCopyTime)
|
||||||
fmt.Println("StateCopyNewTime: ", state.StateNewTime)
|
fmt.Println("StateCopyNewTime: ", state.StateNewTime)
|
||||||
fmt.Println("StateDeepCpTime: ", state.StateDeepCpTime)
|
fmt.Println("StateDeepCpTime: ", state.StateDeepCpTime)
|
||||||
fmt.Println("PrefetchBALtime: ", core.PrefetchBALTime)
|
|
||||||
fmt.Println("PrefetchMergeTime:", core.PrefetchMergeBALTime)
|
|
||||||
fmt.Println("ParallelExeTime: ", core.ParallelExeTime)
|
|
||||||
fmt.Println("PrefetchTrieWallTime: ", core.PrefetchTrieTimer)
|
|
||||||
// fmt.Println("PrefetchTrieCPUtime: ", state.PrefetchTrieCPUTime)
|
|
||||||
|
|
||||||
// Sync state time
|
|
||||||
fmt.Println("PrefetchChTime: ", core.PrefetchChTime)
|
|
||||||
|
|
||||||
// total
|
// total
|
||||||
fmt.Println("blockInsertTimer", blockInsertTimer.Total())
|
fmt.Println("blockInsertTimer: ", blockInsertTimer.Total())
|
||||||
|
|
||||||
mgasps := chainMgaspsMeter.Snapshot()
|
mgasps := chainMgaspsMeter.Snapshot()
|
||||||
fmt.Println("mgasps,mean,max,min:", int64(mgasps.Mean()), mgasps.Max(), mgasps.Min())
|
fmt.Println("mgasps min,mean,max:", mgasps.Min(), int64(mgasps.Mean()), mgasps.Max())
|
||||||
}
|
}
|
||||||
|
|
||||||
func exportChain(ctx *cli.Context) error {
|
func exportChain(ctx *cli.Context) error {
|
||||||
|
|
|
||||||
|
|
@ -305,11 +305,19 @@ func (bc *BlockChain) insertChainN(chain types.Blocks, setHead bool, makeWitness
|
||||||
|
|
||||||
// Validate stateRoot for N-blocks at once.
|
// Validate stateRoot for N-blocks at once.
|
||||||
xvtime := time.Now()
|
xvtime := time.Now()
|
||||||
|
statedb.AccountUpdates = time.Duration(0)
|
||||||
|
statedb.StorageUpdates = time.Duration(0)
|
||||||
|
statedb.AccountHashes = time.Duration(0)
|
||||||
header := endBlock.Header()
|
header := endBlock.Header()
|
||||||
if root := statedb.IntermediateRoot(true); header.Root != root {
|
if root := statedb.IntermediateRoot(true); header.Root != root {
|
||||||
log.Crit("invalid merkle root (remote: %x local: %x) dberr: %w", header.Root, root, statedb.Error())
|
log.Crit("invalid merkle root (remote: %x local: %x) dberr: %w", header.Root, root, statedb.Error())
|
||||||
}
|
}
|
||||||
blockCrossValidationTimer.Update(time.Since(xvtime))
|
accountUpdateTimer.Update(statedb.AccountUpdates) // Account updates are complete(in validation)
|
||||||
|
storageUpdateTimer.Update(statedb.StorageUpdates) // Storage updates are complete(in validation)
|
||||||
|
accountHashTimer.Update(statedb.AccountHashes) // Account hashes are complete(in validation)
|
||||||
|
triehash := statedb.AccountHashes // The time spent on tries hashing
|
||||||
|
trieUpdate := statedb.AccountUpdates + statedb.StorageUpdates // The time spent on tries update
|
||||||
|
blockValidationTimer.Update(time.Since(xvtime) - (triehash + trieUpdate)) // The time spent on block validation
|
||||||
|
|
||||||
// Commit N-blocks together to the chain and get the status.
|
// Commit N-blocks together to the chain and get the status.
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
|
|
@ -325,8 +324,6 @@ func (t *Trie) update(key, value []byte) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var ResolveTime = time.Duration(0)
|
|
||||||
|
|
||||||
func (t *Trie) insert(n node, prefix, key []byte, value node) (bool, node, error) {
|
func (t *Trie) insert(n node, prefix, key []byte, value node) (bool, node, error) {
|
||||||
if len(key) == 0 {
|
if len(key) == 0 {
|
||||||
if v, ok := n.(valueNode); ok {
|
if v, ok := n.(valueNode); ok {
|
||||||
|
|
@ -390,9 +387,7 @@ func (t *Trie) insert(n node, prefix, key []byte, value node) (bool, node, error
|
||||||
// We've hit a part of the trie that isn't loaded yet. Load
|
// We've hit a part of the trie that isn't loaded yet. Load
|
||||||
// the node and insert into it. This leaves all child nodes on
|
// the node and insert into it. This leaves all child nodes on
|
||||||
// the path to the value in the trie.
|
// the path to the value in the trie.
|
||||||
start := time.Now()
|
|
||||||
rn, err := t.resolveAndTrack(n, prefix)
|
rn, err := t.resolveAndTrack(n, prefix)
|
||||||
ResolveTime += time.Since(start)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, nil, err
|
return false, nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -522,9 +517,7 @@ func (t *Trie) delete(n node, prefix, key []byte) (bool, node, error) {
|
||||||
// shortNode{..., shortNode{...}}. Since the entry
|
// shortNode{..., shortNode{...}}. Since the entry
|
||||||
// might not be loaded yet, resolve it just for this
|
// might not be loaded yet, resolve it just for this
|
||||||
// check.
|
// check.
|
||||||
start := time.Now()
|
|
||||||
cnode, err := t.resolve(n.Children[pos], append(prefix, byte(pos)))
|
cnode, err := t.resolve(n.Children[pos], append(prefix, byte(pos)))
|
||||||
ResolveTime += time.Since(start)
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, nil, err
|
return false, nil, err
|
||||||
|
|
@ -556,9 +549,7 @@ func (t *Trie) delete(n node, prefix, key []byte) (bool, node, error) {
|
||||||
// We've hit a part of the trie that isn't loaded yet. Load
|
// We've hit a part of the trie that isn't loaded yet. Load
|
||||||
// the node and delete from it. This leaves all child nodes on
|
// the node and delete from it. This leaves all child nodes on
|
||||||
// the path to the value in the trie.
|
// the path to the value in the trie.
|
||||||
start := time.Now()
|
|
||||||
rn, err := t.resolveAndTrack(n, prefix)
|
rn, err := t.resolveAndTrack(n, prefix)
|
||||||
ResolveTime += time.Since(start)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, nil, err
|
return false, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue