trace

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//----- DeliverTx
	DeliverTx = "DeliverTx"
	TxDecoder = "TxDecoder"

	//----- RunTx details
	ValTxMsgs  = "valTxMsgs"
	RunAnte    = "RunAnte"
	RunMsg     = "RunMsg"
	Refund     = "refund"
	EvmHandler = "EvmHandler"

	//------ RunAnte details
	CacheTxContext  = "cacheTxContext"
	AnteChain       = "AnteChain"
	AnteOther       = "AnteOther"
	CacheStoreWrite = "cacheStoreWrite"

	//----- handler details
	ParseChainID = "ParseChainID"
	VerifySig    = "VerifySig"
	Txhash       = "txhash"
	SaveTx       = "SaveTx"
	TransitionDb = "TransitionDb"
	Bloomfilter  = "Bloomfilter"
	EmitEvents   = "EmitEvents"
	HandlerDefer = "handler_defer"
)
View Source
const (
	GasUsed     = "GasUsed"
	SimGasUsed  = "SimGasUsed"
	Produce     = "Produce"
	RunTx       = "RunTx"
	LastRun     = "lastRun"
	Height      = "Height"
	Tx          = "Tx"
	SimTx       = "SimTx"
	BlockSize   = "BlockSize"
	Elapsed     = "Elapsed"
	CommitRound = "CommitRound"
	Round       = "Round"
	BlockParts  = "BlockParts"
	Evm         = "Evm"
	Iavl        = "Iavl"
	FlatKV      = "FlatKV"
	//RecvBlock        = "RecvBlock"
	First2LastPart = "First2LastPart"

	SigCacheRatio    = "SigCacheRatio"
	DeliverTxs       = "DeliverTxs"
	EvmHandlerDetail = "EvmHandlerDetail"
	RunAnteDetail    = "RunAnteDetail"
	AnteChainDetail  = "AnteChainDetail"

	Delta      = "Delta"
	InvalidTxs = "InvalidTxs"

	Abci = "abci"
	//SaveResp        = "saveResp"
	Persist = "persist"
	//MempoolUpdate   = "mpUpdate"
	//SaveState       = "saveState"
	ApplyBlock      = "ApplyBlock"
	Consensus       = "Consensus"
	LastBlockTime   = "LastBlockTime"
	TimeoutInterval = "TimeoutInterval"

	MempoolCheckTxCnt  = "CheckTx"
	MempoolTxsCnt      = "MempoolTxs"
	MempoolCheckTxTime = "CheckTxTime"

	CompressBlock   = "Compress"
	UncompressBlock = "Uncompress"
	Prerun          = "Prerun"
	IavlRuntime     = "IavlRuntime"

	BlockPartsP2P = "BlockPartsP2P"

	Workload = "Workload"
)
View Source
const (
	READ         = 1
	WRITE        = 2
	EVMALL       = 3
	UNKNOWN_TYPE = 4
	EVM_FORMAT   = "read<%dms>, write<%dms>, execute<%dms>"
	EVMCORE      = "evmcore"
)
View Source
const FlagEnableAnalyzer string = "enable-analyzer"

Variables

View Source
var (
	STATEDB_WRITE = []string{"AddBalance", "SubBalance", "SetNonce", "SetState", "SetCode", "AddLog",
		"AddPreimage", "AddRefund", "SubRefund", "AddAddressToAccessList", "AddSlotToAccessList",
		"PrepareAccessList", "AddressInAccessList", "Suicide", "CreateAccount", "ForEachStorage"}

	STATEDB_READ = []string{"SlotInAccessList", "GetBalance", "GetNonce", "GetCode", "GetCodeSize",
		"GetCodeHash", "GetState", "GetCommittedState", "GetRefund",
		"HasSuicided", "Snapshot", "RevertToSnapshot", "Empty", "Exist"}

	EVM_OPER = []string{EVMCORE}
)

Functions

func EnableAnalyzer

func EnableAnalyzer(flag bool)

func InitializePprofDumper

func InitializePprofDumper(logger log.Logger, dumpPath string, coolDownStr string, abciElapsed int64)

func OnAppBeginBlockEnter

func OnAppBeginBlockEnter(height int64)

func OnAppDeliverTxEnter

func OnAppDeliverTxEnter()

func OnCommitDone

func OnCommitDone()

func SetDynamicConfig

func SetDynamicConfig(c IDynamicConfig)

func SetInfoObject

func SetInfoObject(e IElapsedTimeInfos)

func StartTxLog

func StartTxLog(oper string)

func StopTxLog

func StopTxLog(oper string)

Types

type Analyzer

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

type DbRecord

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

func (*DbRecord) AddOperType

func (s *DbRecord) AddOperType(oper string, value int)

func (*DbRecord) GetOperType

func (s *DbRecord) GetOperType(oper string) int

type EmptyTimeInfo

type EmptyTimeInfo struct {
}

func (*EmptyTimeInfo) AddInfo

func (e *EmptyTimeInfo) AddInfo(key string, info string)

func (*EmptyTimeInfo) Dump

func (e *EmptyTimeInfo) Dump(logger interface{})

func (*EmptyTimeInfo) GetElapsedTime

func (e *EmptyTimeInfo) GetElapsedTime() int64

func (*EmptyTimeInfo) SetElapsedTime

func (e *EmptyTimeInfo) SetElapsedTime(elapsedTime int64)

type IDynamicConfig

type IDynamicConfig interface {
	GetEnableAnalyzer() bool
}

type IElapsedTimeInfos

type IElapsedTimeInfos interface {
	AddInfo(key string, info string)
	Dump(logger interface{})
	SetElapsedTime(elapsedTime int64)
	GetElapsedTime() int64
}

func GetElapsedInfo

func GetElapsedInfo() IElapsedTimeInfos

type MockDynamicConfig

type MockDynamicConfig struct {
}

func (MockDynamicConfig) GetEnableAnalyzer

func (c MockDynamicConfig) GetEnableAnalyzer() bool

type Summary

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

func GetTraceSummary

func GetTraceSummary() *Summary

func (*Summary) Dump

func (s *Summary) Dump(context string)

func (*Summary) Init

func (s *Summary) Init(keys ...string)

type Tracer

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

func NewTracer

func NewTracer(name string) *Tracer

func (*Tracer) EnableSummary added in v1.5.2

func (t *Tracer) EnableSummary()

func (*Tracer) Format

func (t *Tracer) Format() string

func (*Tracer) FormatRepeatingPins

func (t *Tracer) FormatRepeatingPins(ignoredTags string) string

func (*Tracer) GetElapsedTime

func (t *Tracer) GetElapsedTime() int64

func (*Tracer) Pin

func (t *Tracer) Pin(format string, args ...interface{})

func (*Tracer) RepeatingPin

func (t *Tracer) RepeatingPin(format string, args ...interface{})

func (*Tracer) Reset

func (t *Tracer) Reset()

func (*Tracer) SetWorkloadStatistic added in v1.6.6

func (t *Tracer) SetWorkloadStatistic(wls *WorkloadStatistic)

type WorkloadStatistic added in v1.6.6

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

WorkloadStatistic accumulate workload for specific trace tags during some specific period. Everytime `Add` or `end` method be called, it record workload on corresponding `summaries` fields, and send this workload info to `shrinkLoop`, which will subtract this workload from `summaries` when the workload out of statistic period. To do that, `shrinkLoop` will record the workload and it's out-of-date timestamp; `shrinkLoop` also has a ticker promote current time once a second. If current time is larger or equal than recorded timestamp, it remove that workload and subtract it's value from `summaries`.

func GetApplyBlockWorkloadSttistic added in v1.6.6

func GetApplyBlockWorkloadSttistic() *WorkloadStatistic

GetApplyBlockWorkloadSttistic return a global `WorkloadStatistic` object. WARNING: if you call `WorkloadStatistic.Add` concurrently, the summary result will be incorrect.

func (*WorkloadStatistic) Add added in v1.6.6

func (ws *WorkloadStatistic) Add(tag string, endTime time.Time, duration time.Duration)

Add accumulate workload to summary. WARNING: if you call `Add` concurrently, the summary result will be incorrect.

func (*WorkloadStatistic) Format added in v1.6.6

func (ws *WorkloadStatistic) Format() string

Jump to

Keyboard shortcuts

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