From 9f8be74b2a96daa2e4d6faeb725eb168ac1dc479 Mon Sep 17 00:00:00 2001 From: Adrian Dobrita Date: Mon, 29 Apr 2024 11:33:53 +0300 Subject: [PATCH] remove pprof --- .../block/preprocess/smartContractResults.go | 38 +------------------ 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/process/block/preprocess/smartContractResults.go b/process/block/preprocess/smartContractResults.go index 8eeac9cfd8f..bb9e8810a20 100644 --- a/process/block/preprocess/smartContractResults.go +++ b/process/block/preprocess/smartContractResults.go @@ -1,11 +1,6 @@ package preprocess import ( - "fmt" - "math/rand" - "os" - "runtime/debug" - "runtime/pprof" "time" "github.com/multiversx/mx-chain-core-go/core" @@ -16,6 +11,7 @@ import ( "github.com/multiversx/mx-chain-core-go/data/smartContractResult" "github.com/multiversx/mx-chain-core-go/hashing" "github.com/multiversx/mx-chain-core-go/marshal" + "github.com/multiversx/mx-chain-go/common" "github.com/multiversx/mx-chain-go/dataRetriever" "github.com/multiversx/mx-chain-go/process" @@ -261,22 +257,6 @@ func (scr *smartContractResults) ProcessBlockTransactions( totalGasConsumedInSelfShard: scr.getTotalGasConsumed(), } - // TODO: add validator pprof - r := rand.Intn(1000) - fileName := fmt.Sprintf("logs/validator-cpu-profile-%d-%d-%d.pprof", time.Now().Unix(), len(body.MiniBlocks), r) - f, err := os.Create(fileName) - if err != nil { - log.Error("could not create CPU profile", "error", err) - } - debug.SetGCPercent(-1) - _ = pprof.StartCPUProfile(f) - - defer func() { - pprof.StopCPUProfile() - - log.Info("validator-cpu-profile saved", "file", fileName) - }() - log.Debug("smartContractResults.ProcessBlockTransactions: before processing", "totalGasConsumedInSelfShard", gasInfo.totalGasConsumedInSelfShard, "total gas provided", scr.gasHandler.TotalGasProvided(), @@ -598,22 +578,6 @@ func (scr *smartContractResults) ProcessMiniBlock( maxGasLimitUsedForDestMeTxs = scr.economicsFee.MaxGasLimitPerBlock(scr.shardCoordinator.SelfId()) * maxGasLimitPercentUsedForDestMeTxs / 100 } - //TODO: add pprof for leader, when len(miniBlockScrs) > 0 - r := rand.Intn(1000) - fileName := fmt.Sprintf("logs/leader-cpu-profile-%d-%d-%d.pprof", time.Now().Unix(), len(miniBlockScrs), r) - f, err := os.Create(fileName) - if err != nil { - log.Error("could not create CPU profile", "error", err) - } - debug.SetGCPercent(-1) - _ = pprof.StartCPUProfile(f) - - defer func() { - pprof.StopCPUProfile() - - log.Info("leader-cpu-profile saved", "file", fileName) - }() - log.Debug("smartContractResults.ProcessMiniBlock: before processing", "totalGasConsumedInSelfShard", gasInfo.totalGasConsumedInSelfShard, "total gas provided", scr.gasHandler.TotalGasProvided(),