pangolin

package module
v0.0.0-...-10a401a Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

README

pangolin

Golang server profiling package

installation

go get github.com/leesper/pangolin

usage

Add one line at the top of your main function, and profiling will be enabled during server running. Then you can analysis the .prof file by go tool pprof

import "github.com/leesper/pangolin"

func main() {
    defer pangolin.Start().Stop()
    ...
}

decorators

  • CPUProfile
  • MemProfile
  • MemProfileRate(r int)
  • BlockProfile
  • NoInterruptHook
  • ProfilePath(path string)

The CPU profiling mode is enabled by default, and you can alter behaviours such as changing profile directory or enabling memory profiling by passing decorators into pangolin.Start()

import "github.com/leesper/pangolin"

func main() {
    defer pangolin.Start(pangolin.MemProfile, pangolin.ProfilePath("./prof"), pangolin.NoShutdownHook).Stop()
    ...
}

Documentation

Index

Constants

View Source
const (
	CPUMODE modeType = iota
	MEMMODE
	BLKMODE
)

Variables

This section is empty.

Functions

func BlockProfile

func BlockProfile(prof profile) profile

func CPUProfile

func CPUProfile(prof profile) profile

profile decorators

func MemProfile

func MemProfile(prof profile) profile

func MemProfileRate

func MemProfileRate(r int) func(profile) profile

func NoInterruptHook

func NoInterruptHook() func(profile) profile

func ProfilePath

func ProfilePath(path string) func(profile) profile

func Start

func Start(decorators ...func(profile) profile) interface {
	Stop()
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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