Last active
July 25, 2017 07:00
-
-
Save Eun/aa7300176fc36a385e468d3c90f222a0 to your computer and use it in GitHub Desktop.
go trace for executable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
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