From 447e08a6a82fb1dcc40b5f7247dd03322d71098c Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Mon, 15 Jun 2020 06:59:21 +0000 Subject: [PATCH] [log] add sample log of message handle time Signed-off-by: Leo Chen --- consensus/consensus_v2.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/consensus/consensus_v2.go b/consensus/consensus_v2.go index 90a90cd1f..41d0bfada 100644 --- a/consensus/consensus_v2.go +++ b/consensus/consensus_v2.go @@ -13,6 +13,7 @@ import ( "github.com/harmony-one/harmony/core/types" vrf_bls "github.com/harmony-one/harmony/crypto/vrf/bls" 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/shard" "github.com/harmony-one/vdf/src/vdf_go" @@ -21,6 +22,9 @@ import ( // handlemessageupdate will update the consensus state according to received message 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 { return }