profiler

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxOvertimeType = 1
	OvertimeType    = 2
)

Variables

View Source
var DefaultMaxOvertime time.Duration = 5 * time.Second

最大超长时间,一般可以认为是死锁或者死循环,或者极差的性能问题

View Source
var DefaultMaxRecordNum int = 100 //最大记录条数
View Source
var DefaultOvertime time.Duration = 10 * time.Millisecond

超过该时间将会监控报告

Functions

func DefaultReportFunction

func DefaultReportFunction(name string, callNum int, costTime time.Duration, record *list.List)

func Report

func Report()

func SetReportFunction

func SetReportFunction(reportFun ReportFunType)

Types

type Analyzer

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

func (*Analyzer) Pop

func (slf *Analyzer) Pop()

type Element

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

type Profiler

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

func RegProfiler

func RegProfiler(profilerName string) *Profiler

func (*Profiler) Push

func (slf *Profiler) Push(tag string) *Analyzer

func (*Profiler) SetMaxOverTime

func (slf *Profiler) SetMaxOverTime(tm time.Duration)

func (*Profiler) SetMaxRecordNum

func (slf *Profiler) SetMaxRecordNum(num int)

func (*Profiler) SetOverTime

func (slf *Profiler) SetOverTime(tm time.Duration)

type Record

type Record struct {
	RType      RecordType
	CostTime   time.Duration
	RecordName string
}

type RecordType

type RecordType int

type ReportFunType

type ReportFunType func(name string, callNum int, costTime time.Duration, record *list.List)

Jump to

Keyboard shortcuts

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