trace

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 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"
	Storage     = "Storage"
	//RecvBlock        = "RecvBlock"
	First2LastPart = "First2LastPart"

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

	Delta      = "Delta"
	InvalidTxs = "InvalidTxs"

	Abci = "abci"
	//SaveResp        = "saveResp"
	Persist        = "persist"
	PersistDetails = "persistDTL"
	FlushCache     = "fCache"
	CommitStores   = "ciStores"
	FlushMeta      = "fMeta"

	//MempoolUpdate   = "mpUpdate"
	//SaveState       = "saveState"
	ApplyBlock    = "ApplyBlock"
	Consensus     = "Consensus"
	LastBlockTime = "LastBlockTime"
	BTInterval    = "BTInterval"
	RecommendedGP = "RecommendedGP"
	IsCongested   = "IsCongested"
	UpdateState   = "UpdateState"
	Waiting       = "Waiting"

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

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

	BlockPartsP2P = "BlockPartsP2P"

	Workload = "Workload"
	ACOffset = "ACOffset"
)
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 BaseStatistics

type BaseStatistics interface {
	Init(tags ...string)
	Accumulate(tag string, lastPinTime time.Time)
	GetTags() []string
	GetValue(tag string) int64
}

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 StatisticsCell

type StatisticsCell interface {
	StartTiming()
	EndTiming(tag string)
}

type Summary

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

func GetTraceSummary

func GetTraceSummary() *Summary

func NewSummary

func NewSummary() *Summary

func (*Summary) Accumulate

func (s *Summary) Accumulate(tag string, lastPinTime time.Time)

func (*Summary) Dump

func (s *Summary) Dump(context string)

func (*Summary) GetTags

func (s *Summary) GetTags() []string

func (*Summary) GetValue

func (s *Summary) GetValue(tag string) int64

func (*Summary) Init

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

type Tracer

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

func NewTracer

func NewTracer(name string) *Tracer

func (*Tracer) EnableSummary

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

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

type WorkloadStatistic

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

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

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

func (ws *WorkloadStatistic) Format() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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