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) *ProfileParameters & Attributes
| Name | Type | Description |
|---|---|---|
| name | string | Profile 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) }