INNER CODE UNIT · Go
ticker
daptin/daptin · main.go:477
ticker := time.NewTicker(time.Duration(*profileDumpPeriod) * time.Minute)
defer ticker.Stop()
for {
select {
case <-processCtx.Done():
return
case <-ticker.C:
}
profileDumpCount += 1
pprof.StopCPUProfile()
hostname, _ := os.Hostname()
cpuprofile := fmt.Sprintf("%sdaptin_%s_profile_cpu.%v", *profileDumpPath, hostname, profileDumpCount)
heapprofile := fmt.Sprintf("%sdaptin_%s_profile_heap.%v", *profileDumpPath, hostname, profileDumpCount)
log.Infof("Dumping cpu and heap profile at %s, %s", cpuprofile, heapprofile)
cpuFile, err := os.Create(cpuprofile)
heapFile, err := os.Create(heapprofile)