Skip to content

Commit

Permalink
Added stopwatches in important functions. (#1581)
Browse files Browse the repository at this point in the history
Co-authored-by: StefanIliev545 <[email protected]>
  • Loading branch information
StefanIliev545 and StefanIliev545 authored Oct 5, 2023
1 parent 1dea9e9 commit 1e7e94c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions go/enclave/enclave.go
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,8 @@ func (e *enclaveImpl) EstimateGas(encryptedParams common.EncryptedParamsEstimate
return nil, responses.ToInternalError(fmt.Errorf("requested EstimateGas with the enclave stopping"))
}

defer core.LogMethodDuration(e.logger, measure.NewStopwatch(), "enclave.go:EstimateGas()")

// decode the received request into a []interface
paramList, err := e.decodeRequest(encryptedParams)
if err != nil {
Expand Down Expand Up @@ -1396,6 +1398,7 @@ func (e *enclaveImpl) GetPublicTransactionData(pagination *common.QueryPaginatio
// Create a helper to check if a gas allowance results in an executable transaction
// isGasEnough returns whether the gaslimit should be raised, lowered, or if it was impossible to execute the message
func (e *enclaveImpl) isGasEnough(args *gethapi.TransactionArgs, gas uint64, blkNumber *gethrpc.BlockNumber) (bool, *gethcore.ExecutionResult, error) {
core.LogMethodDuration(e.logger, measure.NewStopwatch(), "enclave.go:IsGasEnough")
args.Gas = (*hexutil.Uint64)(&gas)
result, err := e.chain.ObsCallAtBlock(args, blkNumber)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions go/enclave/evm/evm_facade.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import (
"github.com/obscuronet/go-obscuro/go/common/errutil"
"github.com/obscuronet/go-obscuro/go/common/gethencoding"
"github.com/obscuronet/go-obscuro/go/common/log"
"github.com/obscuronet/go-obscuro/go/common/measure"
"github.com/obscuronet/go-obscuro/go/enclave/core"
"github.com/obscuronet/go-obscuro/go/enclave/crypto"
"github.com/obscuronet/go-obscuro/go/enclave/storage"

Expand Down Expand Up @@ -162,6 +164,8 @@ func ExecuteObsCall(
noBaseFee = false
}

core.LogMethodDuration(logger, measure.NewStopwatch(), "evm_facade.go:ObsCall()")

chain, vmCfg, gp := initParams(storage, noBaseFee, nil)
ethHeader, err := gethencoding.CreateEthHeaderForBatch(header, secret(storage))
if err != nil {
Expand Down

0 comments on commit 1e7e94c

Please sign in to comment.