profiler

package
v1.21.5 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: Apache-2.0 Imports: 5 Imported by: 4 modules, 6 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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