You've already forked go-profiler-notes
mirror of
https://github.com/DataDog/go-profiler-notes.git
synced 2025-07-12 23:50:13 +02:00
26 lines
267 B
Go
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 {
|
|
}
|
|
}
|