Skip to content

Instantly share code, notes, and snippets.

@seanhagen
Created October 24, 2018 23:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanhagen/7488b058debcc01776a5bff941090358 to your computer and use it in GitHub Desktop.
Save seanhagen/7488b058debcc01776a5bff941090358 to your computer and use it in GitHub Desktop.
Profiling code
// p := profile.Start(profile.CPUProfile, profile.ProfilePath("/tmp/prof"), profile.NoShutdownHook)
p := profile.Start(profile.MemProfile, profile.ProfilePath("/tmp/prof"), profile.NoShutdownHook)
time.AfterFunc(time.Minute, func() {
fmt.Printf("1 minute until profiling stopped\n")
})
time.AfterFunc(time.Minute*2, func() {
fmt.Printf("stopping profiling\n")
p.Stop()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment