diff options
Diffstat (limited to 'debugGolang.go')
| -rw-r--r-- | debugGolang.go | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/debugGolang.go b/debugGolang.go index 0a6edda..55b1521 100644 --- a/debugGolang.go +++ b/debugGolang.go @@ -9,7 +9,7 @@ import ( "runtime/pprof" ) -func (n *Node) debugGolangWindow(makeWindow bool) { +func (n *Node) DebugGolangWindow(makeWindow bool) { var w, g, og, outputTextbox *Node // Either: @@ -17,8 +17,8 @@ func (n *Node) debugGolangWindow(makeWindow bool) { // make a new tab in the existing window if (makeWindow) { Config.Title = "GO" - Config.Width = 300 - Config.Height = 400 + Config.Width = 1280 + Config.Height = 720 w = NewWindow() w.Custom = w.StandardClose } else { @@ -32,19 +32,26 @@ func (n *Node) debugGolangWindow(makeWindow bool) { tmp, _ := debug.ReadBuildInfo() outputTextbox.SetText(tmp.String()) }) - g.NewButton("debug.PrintStack()", func () { - outputTextbox.SetText(string(debug.Stack())) - }) - g.NewButton("pprof.Lookup(goroutine)", func () { + g.NewButton("runtime.NumGoroutine()", func () { buf := new(bytes.Buffer) pprof.Lookup("goroutine").WriteTo(buf, 1) outputTextbox.SetText(buf.String()) + + outputTextbox.AppendText(fmt.Sprintln("runtime.NumGoroutine() = ", runtime.NumGoroutine())) }) g.NewButton("pprof.Lookup(heap)", func () { buf := new(bytes.Buffer) pprof.Lookup("heap").WriteTo(buf, 1) outputTextbox.SetText(buf.String()) }) + g.NewButton("debug.PrintStack(current)", func () { + outputTextbox.SetText(string(debug.Stack())) + }) + g.NewButton("pprof.Lookup(goroutine)", func () { + buf := new(bytes.Buffer) + pprof.Lookup("goroutine").WriteTo(buf, 1) + outputTextbox.SetText(buf.String()) + }) g.NewButton("pprof.Lookup(block)", func () { buf := new(bytes.Buffer) pprof.Lookup("block").WriteTo(buf, 1) @@ -91,7 +98,9 @@ func (n *Node) debugGolangWindow(makeWindow bool) { panic("test") }) - g.NewLabel("TODO:") + g = w.NewGroup("TODO: finish these") + + // g.NewLabel("TODO:") g.NewButton("runtime.Stack(true)", func () { // TODO: https://stackoverflow.com/questions/61127053/how-to-list-all-the-running-goroutines-in-a-go-program @@ -114,13 +123,6 @@ func (n *Node) debugGolangWindow(makeWindow bool) { g.NewButton("debug.SetTraceback('all')", func () { debug.SetTraceback("all") }) - g.NewButton("runtime.NumGoroutine()", func () { - buf := new(bytes.Buffer) - pprof.Lookup("goroutine").WriteTo(buf, 1) - outputTextbox.SetText(buf.String()) - - outputTextbox.AppendText(fmt.Sprintln("runtime.NumGoroutine() = ", runtime.NumGoroutine())) - }) // deprecated (probably) by String() implementation within golang g.NewButton("dumpModuleInfo() (deprecate)", func () { |
