Standard library / runtime/pprof

pprof.NewProfile()

Register a custom named profile. Duplicate names panic. Use custom profiles for resources whose ownership you track explicitly. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func NewProfile(name string) *Profile

Parameters & Attributes

NameTypeDescription
namestringProfile name; use a unique package-qualified name for custom profiles.

Return Value

*Profile

Newly registered custom profile.

Working Example

Example Snippetgo
package main
import (  "fmt"  "runtime/pprof")
func main() { p := pprof.NewProfile("bytemind.resource"); fmt.Println(pprof.Lookup(p.Name()) == p) }
Go Reference