profiler

package
v0.0.0-...-4be1d82 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServlet

func NewServlet() srvutil.Servlet

NewServlet returns a Servlet which can serve pprof requests

/debug/pprof/ is the homepage /debug/pprof/ui/ is the same homepage, but where all links point to a UI instead of raw downloads /debug/pprof/*/ are the raw handlers /debug/pprof/ui/*/ are the same handlers, but with a rendered UI

Types

type Profiler

type Profiler interface {
	Start() error
	End() error
}

func NewProfiler

func NewProfiler(cpuFile string, memoryFile string) Profiler
Example
package main

import (
	"github.com/Shopify/goose/profiler"
)

func main() {
	cpuFile := "cpu.prof"
	memoryFile := "memory.prof"

	p := profiler.NewProfiler(cpuFile, memoryFile)
	if err := p.Start(); err != nil {
		panic(err)
	}

	// Do stuff

	if err := p.End(); err != nil {
		panic(err)
	}
}
Output:

Jump to

Keyboard shortcuts

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