pprof

package
v0.0.0-...-38a9cd2 Latest Latest
Warning

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

Go to latest
Published: May 21, 2022 License: MIT Imports: 3 Imported by: 0

README

pprof

pprof middleware

Example

package main

import (
    "github.com/gostack-labs/bytego"
    "github.com/gostack-labs/bytego/middleware/pprof"
)
func main() {
    app := bytego.New()
    pprof.Register(app, pprof.WithPrefix("/debug/pprof"))
    _ = app.Run(":8080")
}
pprof tools

use the pprof tool to look at the heap profile:

go tool pprof http://localhost:8080/debug/pprof/heap

Or to look at a 30-second CPU profile:

go tool pprof http://localhost:8080/debug/pprof/profile

Or to look at the goroutine blocking profile, after calling runtime.SetBlockProfileRate in your program:

go tool pprof http://localhost:8080/debug/pprof/block

Or to collect a 5-second execution trace:

wget http://localhost:8080/debug/pprof/trace?seconds=5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(app *bytego.App, opts ...Options)

Types

type Options

type Options func(*option)

func WithPrefix

func WithPrefix(prefix string) Options

Jump to

Keyboard shortcuts

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