// for debugging, show goroutine trace on receipt of USR1. uninstall by calling // Stop on the returned object func InstallStackTracer() stopper.Stopper { signals := make(chan os.Signal, 1) signal.Notify(signals, traceSignal) stopper := stopper.NewChanStopper() go func() { defer func() { signal.Stop(signals) close(signals) }() for { select { case <-signals: log.Print(instrumentation.GetStackTrace(true)) case <-stopper.Chan: return } } }() return stopper }
func TestGetStackTrace(t *testing.T) { instrumentation.GetStackTrace(false) instrumentation.GetStackTrace(true) }
func GetStackTrace(all bool) string { return instrumentation.GetStackTrace(all) }