profiler

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

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

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 15 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