Standard library / runtime/pprof
pprof.Profile.Count()
Report the number of tracked stacks, not their aggregate bytes or CPU time. Expected stdout: '2\n'.
Formal Syntax & Structure
go syntaxgo
func (p *Profile) Count() intReturn Value
int
Number of tracked stack records.
Working Example
Example Snippetgo
package main
import ( "fmt" "runtime/pprof")
func main() { p := pprof.NewProfile("bytemind.resource") p.Add(1, 0) p.Add(2, 0) defer p.Remove(1) defer p.Remove(2) fmt.Println(p.Count())}