utils

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: Apache-2.0 Imports: 9 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

func ConstructUniqueTxKey(names ...string) string

ConstructUniqueTxKey txId#count

func CreateDir

func CreateDir(directory string) error

CreateDir create dir

func DockerVMMessageFromPool

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

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) AddTxDuration

func (b *BlockTxsDuration) AddTxDuration(t *TxDuration)

AddTxDuration add a TxDuration

func (*BlockTxsDuration) FinishTxDuration

func (b *BlockTxsDuration) FinishTxDuration(t *TxDuration)

FinishTxDuration end time statistics

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() *BlockTxsDurationMgr

NewBlockTxsDurationMgr construct a BlockTxsDurationMgr

func (*BlockTxsDurationMgr) AddBlockTxsDuration

func (r *BlockTxsDurationMgr) AddBlockTxsDuration(id string)

AddBlockTxsDuration .

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) PrintBlockTxsDuration

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

PrintBlockTxsDuration 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) 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
	ContingentSysCallCnt      int32
	ContingentSysCallDuration int64
	CrossCallCnt              int32
	CrossCallDuration         int64
	SysCallList               []*SysCallDuration
	CrossCallList             []*TxDuration
	Sealed                    bool
}

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) AddContingentSysCall

func (e *TxDuration) AddContingentSysCall(spend int64)

AddContingentSysCall add contingent syscall

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) 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) Seal

func (e *TxDuration) Seal()

Seal the txDuration, The sealed node will no longer update its state and will not generate new cross contract calls at this node and its child nodes

func (*TxDuration) StartSysCall

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

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