1
0
mirror of https://github.com/DataDog/go-profiler-notes.git synced 2025-07-12 23:50:13 +02:00
Files
go-profiler-notes/guide/cpu-rate.go
Felix Geisendörfer 6b9adbfc74 Add CPU profiler section
2021-09-09 23:46:41 +02:00

26 lines
267 B
Go

// +build ignore
package main
import (
"os"
"runtime"
"runtime/pprof"
"time"
)
func main() {
runtime.SetCPUProfileRate(800)
pprof.StartCPUProfile(os.Stdout)
defer pprof.StopCPUProfile()
go cpuHog()
time.Sleep(time.Second)
}
func cpuHog() {
for {
}
}