Standard library / runtime/pprof

pprof.Lookup()

Find a registered profile by name; returns nil for an unknown name. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func Lookup(name string) *Profile

Parameters & Attributes

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

Return Value

*Profile

Matching profile, or nil if no such name exists.

Working Example

Example Snippetgo
package main
import (  "fmt"  "runtime/pprof")
func main() { fmt.Println(pprof.Lookup("heap") != nil && pprof.Lookup("bytemind.missing") == nil) }
Go Reference