mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-14 07:53:47 +00:00
adding block size metric in both worker and clique.go files
This commit is contained in:
parent
ce59a9b6a1
commit
bbc42f5279
2 changed files with 6 additions and 6 deletions
|
|
@ -589,8 +589,6 @@ func (c *Clique) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *
|
||||||
// Assemble and return the final block for sealing.
|
// Assemble and return the final block for sealing.
|
||||||
block := types.NewBlock(header, txs, nil, receipts, trie.NewStackTrie(nil))
|
block := types.NewBlock(header, txs, nil, receipts, trie.NewStackTrie(nil))
|
||||||
|
|
||||||
fmt.Println("*************CLIQUE*************************************")
|
|
||||||
fmt.Printf("clique.go block_size_in_bytes: %v\n", int64(block.Size()))
|
|
||||||
if metrics.Enabled {
|
if metrics.Enabled {
|
||||||
metrics.GetOrRegisterGauge(blockSizeGaugeName, nil).Update(int64(block.Size()))
|
metrics.GetOrRegisterGauge(blockSizeGaugeName, nil).Update(int64(block.Size()))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ package miner
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/ethereum/go-ethereum/metrics"
|
||||||
"math/big"
|
"math/big"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
@ -77,6 +78,8 @@ var (
|
||||||
errBlockInterruptedByNewHead = errors.New("new head arrived while building block")
|
errBlockInterruptedByNewHead = errors.New("new head arrived while building block")
|
||||||
errBlockInterruptedByRecommit = errors.New("recommit interrupt while building block")
|
errBlockInterruptedByRecommit = errors.New("recommit interrupt while building block")
|
||||||
errBlockInterruptedByTimeout = errors.New("timeout while building block")
|
errBlockInterruptedByTimeout = errors.New("timeout while building block")
|
||||||
|
|
||||||
|
blockSizeGaugeName = "clique/block_size_in_bytes"
|
||||||
)
|
)
|
||||||
|
|
||||||
// environment is the worker's current environment and holds all
|
// environment is the worker's current environment and holds all
|
||||||
|
|
@ -1122,10 +1125,9 @@ func (w *worker) commit(env *environment, interval func(), update bool, start ti
|
||||||
env := env.copy()
|
env := env.copy()
|
||||||
// Withdrawals are set to nil here, because this is only called in PoW.
|
// Withdrawals are set to nil here, because this is only called in PoW.
|
||||||
block, err := w.engine.FinalizeAndAssemble(w.chain, env.header, env.state, env.txs, nil, env.receipts, nil)
|
block, err := w.engine.FinalizeAndAssemble(w.chain, env.header, env.state, env.txs, nil, env.receipts, nil)
|
||||||
//log.PrintOrigins(true)
|
if metrics.Enabled {
|
||||||
//log.Info(fmt.Sprintf("block_size_in_bytes: %v", int64(block.Size())))
|
metrics.GetOrRegisterGauge(blockSizeGaugeName, nil).Update(int64(block.Size()))
|
||||||
fmt.Println("********************************************************")
|
}
|
||||||
fmt.Printf("block_size_in_bytes: %v\n", int64(block.Size()))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue