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-utilization.go
Felix Geisendörfer d315e34e2e Write to file
2021-09-10 10:19:11 +02:00

26 lines
281 B
Go

// +build ignore
package main
import (
"os"
"runtime/pprof"
"time"
)
func main() {
file, _ := os.Create("./cpu-utilization.pprof")
pprof.StartCPUProfile(file)
defer pprof.StopCPUProfile()
go cpuHog()
go cpuHog()
time.Sleep(time.Second)
}
func cpuHog() {
for {
}
}