[log] add sample log of message handle time

Signed-off-by: Leo Chen <leo@harmony.one>
pull/3179/head
Leo Chen 5 years ago
parent 5602a6c7c7
commit 447e08a6a8
  1. 4
      consensus/consensus_v2.go

@ -13,6 +13,7 @@ import (
"github.com/harmony-one/harmony/core/types" "github.com/harmony-one/harmony/core/types"
vrf_bls "github.com/harmony-one/harmony/crypto/vrf/bls" vrf_bls "github.com/harmony-one/harmony/crypto/vrf/bls"
nodeconfig "github.com/harmony-one/harmony/internal/configs/node" nodeconfig "github.com/harmony-one/harmony/internal/configs/node"
"github.com/harmony-one/harmony/internal/utils"
"github.com/harmony-one/harmony/p2p" "github.com/harmony-one/harmony/p2p"
"github.com/harmony-one/harmony/shard" "github.com/harmony-one/harmony/shard"
"github.com/harmony-one/vdf/src/vdf_go" "github.com/harmony-one/vdf/src/vdf_go"
@ -21,6 +22,9 @@ import (
// handlemessageupdate will update the consensus state according to received message // handlemessageupdate will update the consensus state according to received message
func (consensus *Consensus) handleMessageUpdate(payload []byte) { func (consensus *Consensus) handleMessageUpdate(payload []byte) {
entryTime := time.Now()
defer utils.SampledLogger().Info().Str("cost", time.Now().Sub(entryTime).String()).Msg("[cost:handle_consensus_message]")
if len(payload) == 0 { if len(payload) == 0 {
return return
} }

Loading…
Cancel
Save