Skip to content

Instantly share code, notes, and snippets.

@Eun
Last active July 25, 2017 07:00
Show Gist options
  • Save Eun/aa7300176fc36a385e468d3c90f222a0 to your computer and use it in GitHub Desktop.
Save Eun/aa7300176fc36a385e468d3c90f222a0 to your computer and use it in GitHub Desktop.
go trace for executable
{
f, err := os.Create("trace.out")
if err != nil {
panic(err)
}
err = trace.Start(f)
if err != nil {
panic(err)
}
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
go func() {
<-c
trace.Stop()
f.Close()
os.Exit(1)
}()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment