profiler

package
v0.0.0-...-27cef4d Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseCaller

func ParseCaller(funcName string) (string, string)

ParseCaller returns the package based function name from the runtime based function call name

Types

type Call

type Call struct {
	PkgName  string
	FuncName string
}

Call represents the package of the calling position and the function of the calling position

type Data

type Data struct {
	CallCount int64
	TSum      int64
	TMin      int64
	TMax      int64
}

Data represents statistics data of the instance

type Instance

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

Instance represents profiler of the goroutine

func Enter

func Enter() *Instance

Enter returns the profiler of the current function in the current goroutine

func EnterTag

func EnterTag(Tag string) *Instance

EnterTag returns the profiler of the current function in the current goroutine with the tag

func (*Instance) Exit

func (pi *Instance) Exit()

Exit apply the estimation time of the instance of the profiler

type Profiler

type Profiler struct {
	sync.RWMutex
	Caller    string
	FileName  string
	Line      int
	GOID      int64
	ParentMap map[string]bool
	// contains filtered or unexported fields
}

Profiler is an alpha stage (*unstable yet) It provides profile functions regardless of goroutines

func (*Profiler) Exit

func (p *Profiler) Exit(Tag string, tLastEnter int64)

Exit apply the estimation time of the instance of the profiler with the tag

func (*Profiler) ID

func (p *Profiler) ID() string

ID returns the unique ID of the profiler

type SnapshotData

type SnapshotData struct {
	ID       string
	PkgName  string
	FuncName string
	FileName string
	Line     int
	Parents  []*Call
	Tag      string
	Data     Data
	TDiff    int64
}

SnapshotData represents the profile data of the profiler instance

func Snapshot

func Snapshot() []SnapshotData

Snapshot returns all snapshots that are generated by all profiler instances

type Watcher

type Watcher struct {
	C chan SnapshotData
}

Watcher is an alpha stage (*unstable yet) It provides a subscription channel of the profiler

func Watch

func Watch() *Watcher

Watch returns a subscription channel of the profiler

Jump to

Keyboard shortcuts

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