Documentation ¶
Overview ¶
A couple of simple helper functions to make it easy to get CPU or blocking profile data from your tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProfileBlockings ¶
func ProfileBlockings(file string) func()
To save block profile data (how much time is being spent waiting) from your program, add code like the following to your main() function:
import( "os" "github.com/TyeMcQueen/go-tutl/profile" ) func main() { // ... if path := os.Getenv("BLOCK_PROFILE"); "" != path { go tutl.ShowStackTraceOnInterrupt(false) defer profile.ProfieBlockings(path)() } // ... }
The call to ShowStackOnInterrupt() ensures the blocking profile data will be saved even if you interrupt (SIGINT, Ctrl-C) your test run.
func ProfileCPU ¶
func ProfileCPU(file string) func()
To save CPU profile data from your program, add code like the following to your main() function:
import( "os" "github.com/TyeMcQueen/go-tutl" "github.com/TyeMcQueen/go-tutl/profile" ) func main() { // ... if path := os.Getenv("CPU_PROFILE"); "" != path { go tutl.ShowStackTraceOnInterrupt(false) defer profile.ProfieCPU(path)() } // ... }
The call to ShowStackOnInterrupt() ensures the CPU profile data will be properly flushed even if you interrupt (SIGINT, Ctrl-C) your test run.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.