utils

package
v2.3.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultMaxConnection is default max connection number
	DefaultMaxConnection = 1
)

Variables

View Source
var (
	// ErrDuplicateTxId is the duplicate tx id err
	ErrDuplicateTxId = errors.New("duplicate txId")
	// ErrMissingByteCode is the missing bytecode err
	ErrMissingByteCode = errors.New("missing bytecode")
	// ErrClientReachLimit is the client limit err
	ErrClientReachLimit = errors.New("clients reach limit")
)

Functions

func ConstructNotifyMapKey

func ConstructNotifyMapKey(names ...string) string

ConstructNotifyMapKey chainId#txId

func ConstructUniqueTxKey added in v2.3.1

func ConstructUniqueTxKey(names ...string) string

ConstructUniqueTxKey txId#count

func CreateDir

func CreateDir(directory string) error

CreateDir create dir

func DockerVMMessageFromPool added in v2.3.2

func DockerVMMessageFromPool() *protogo.DockerVMMessage

DockerVMMessageFromPool get pb msg from pool

func EnterNextStep

func EnterNextStep(msg *protogo.DockerVMMessage, stepType protogo.StepType, getStr func() string)

EnterNextStep enter next duration tx step

func Exists

func Exists(path string) (bool, error)

Exists returns whether the given file or directory exists

func GetMaxConnectionFromConfig

func GetMaxConnectionFromConfig(config *config.DockerVMConfig) uint32

GetMaxConnectionFromConfig returns max connections from config

func GetMaxRecvMsgSizeFromConfig

func GetMaxRecvMsgSizeFromConfig(conf *config.DockerVMConfig) uint32

GetMaxRecvMsgSizeFromConfig returns max recv msg size from config

func GetMaxSendMsgSizeFromConfig

func GetMaxSendMsgSizeFromConfig(conf *config.DockerVMConfig) uint32

GetMaxSendMsgSizeFromConfig returns max send msg size from config

func PrintTxSteps

func PrintTxSteps(msg *protogo.DockerVMMessage) string

PrintTxSteps print all duration tx steps

func PrintTxStepsWithTime

func PrintTxStepsWithTime(msg *protogo.DockerVMMessage) (string, bool)

PrintTxStepsWithTime print all duration tx steps with time limt

func ReturnToPool added in v2.3.2

func ReturnToPool(m *protogo.DockerVMMessage)

ReturnToPool return pb msg to pool

func SplitContractName

func SplitContractName(contractNameAndVersion string) string

SplitContractName split contract name

Types

type BlockTxsDuration

type BlockTxsDuration struct {
	// contains filtered or unexported fields
}

BlockTxsDuration record the duration of all transactions in a block

func (*BlockTxsDuration) ToString

func (b *BlockTxsDuration) ToString() string

ToString .

type BlockTxsDurationMgr

type BlockTxsDurationMgr struct {
	// contains filtered or unexported fields
}

BlockTxsDurationMgr record the txDuration of each block

func NewBlockTxsDurationMgr

func NewBlockTxsDurationMgr(logger protocol.Logger) *BlockTxsDurationMgr

NewBlockTxsDurationMgr construct a BlockTxsDurationMgr

func (*BlockTxsDurationMgr) AddBlockTxsDuration

func (r *BlockTxsDurationMgr) AddBlockTxsDuration(id string)

AddBlockTxsDuration .

func (*BlockTxsDurationMgr) AddCrossTx added in v2.3.5

func (r *BlockTxsDurationMgr) AddCrossTx(id string, txTime *TxDuration)

AddCrossTx add cross tx to block map need lock

func (*BlockTxsDurationMgr) AddTx

func (r *BlockTxsDurationMgr) AddTx(id string, txTime *TxDuration)

AddTx if add tx to block map need lock

func (*BlockTxsDurationMgr) FinishTx

func (r *BlockTxsDurationMgr) FinishTx(id string, txTime *TxDuration)

FinishTx .

func (*BlockTxsDurationMgr) PrintAllBlockTxsDuration added in v2.3.5

func (r *BlockTxsDurationMgr) PrintAllBlockTxsDuration(id string) string

PrintAllBlockTxsDuration returns the duration of the specified block

func (*BlockTxsDurationMgr) PrintBlockTxsDuration

func (r *BlockTxsDurationMgr) PrintBlockTxsDuration(id string) string

PrintBlockTxsDuration returns the duration of the specified block

func (*BlockTxsDurationMgr) PrintDetailBlockTxsDuration added in v2.3.5

func (r *BlockTxsDurationMgr) PrintDetailBlockTxsDuration(id string)

PrintDetailBlockTxsDuration returns the duration of the specified block

func (*BlockTxsDurationMgr) RemoveBlockTxsDuration

func (r *BlockTxsDurationMgr) RemoveBlockTxsDuration(id string)

RemoveBlockTxsDuration .

type SysCallDuration

type SysCallDuration struct {
	OpType          protogo.DockerVMType
	StartTime       int64
	TotalDuration   int64
	StorageDuration int64
}

SysCallDuration .

func NewSysCallDuration

func NewSysCallDuration(opType protogo.DockerVMType, startTime int64, totalTime int64,
	storageTime int64) *SysCallDuration

NewSysCallDuration construct a SysCallDuration

func (*SysCallDuration) AddStorageDuration added in v2.3.5

func (s *SysCallDuration) AddStorageDuration(nanos int64)

AddStorageDuration .

func (*SysCallDuration) ToString

func (s *SysCallDuration) ToString() string

ToString .

type TxDuration

type TxDuration struct {
	OriginalTxId                string
	TxId                        string
	StartTime                   int64
	EndTime                     int64
	TotalDuration               int64
	SysCallCnt                  int32
	SysCallDuration             int64
	StorageDuration             int64
	LoadContractSysCallCnt      int32
	LoadContractSysCallDuration int64
	CrossCallCnt                int32
	CrossCallDuration           int64
	SysCallList                 []*SysCallDuration
	CrossCallList               []*TxDuration
	CurrDurationStack           *list.List
}

TxDuration .

func NewTxDuration

func NewTxDuration(originalTxId, txId string, startTime int64) *TxDuration

NewTxDuration .

func (*TxDuration) Add

func (e *TxDuration) Add(txDuration *TxDuration)

Add the param txDuration to self just add the root duration, the duration of child nodes will be synchronized to the root node at the end of statistics

func (*TxDuration) AddCrossDuration added in v2.3.5

func (e *TxDuration) AddCrossDuration(duration *TxDuration)

AddCrossDuration start new sys call

func (*TxDuration) AddLatestStorageDuration

func (e *TxDuration) AddLatestStorageDuration(duration int64) error

AddLatestStorageDuration add storage time to latest sys call

func (*TxDuration) EndSysCall

func (e *TxDuration) EndSysCall(msg *protogo.DockerVMMessage) error

EndSysCall close new sys call

func (*TxDuration) GetCurrDuration added in v2.3.5

func (e *TxDuration) GetCurrDuration() *TxDuration

GetCurrDuration get current duration

func (*TxDuration) GetLatestSysCall

func (e *TxDuration) GetLatestSysCall() (*SysCallDuration, error)

GetLatestSysCall returns latest sys call

func (*TxDuration) PrintSysCallList

func (e *TxDuration) PrintSysCallList() string

PrintSysCallList print tx duration

func (*TxDuration) StartSysCall

func (e *TxDuration) StartSysCall(msgType protogo.DockerVMType) *SysCallDuration

StartSysCall start new sys call

func (*TxDuration) ToString

func (e *TxDuration) ToString() string

ToString .

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL