summaryrefslogtreecommitdiff
path: root/golang.go
diff options
context:
space:
mode:
Diffstat (limited to 'golang.go')
-rw-r--r--golang.go46
1 files changed, 23 insertions, 23 deletions
diff --git a/golang.go b/golang.go
index 209f926..af85a28 100644
--- a/golang.go
+++ b/golang.go
@@ -1,16 +1,16 @@
package debugger
import (
- "fmt"
"bytes"
+ "fmt"
// "os"
"runtime"
"runtime/debug"
"runtime/pprof"
- "go.wit.com/log"
"go.wit.com/gui/gui"
- "go.wit.com/gui/gadgets"
+ "go.wit.com/lib/gadgets"
+ "go.wit.com/log"
)
func DebugGolangWindow(p *gui.Node) *gadgets.BasicWindow {
@@ -21,46 +21,46 @@ func DebugGolangWindow(p *gui.Node) *gadgets.BasicWindow {
w.Draw()
g = w.Box().NewGroup("Language Internals").Pad()
- g.NewButton("ReadModuleInfo()", func () {
+ g.NewButton("ReadModuleInfo()", func() {
tmp, _ := debug.ReadBuildInfo()
outputTextbox.SetText(tmp.String())
})
- g.NewButton("runtime.NumGoroutine()", 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 () {
+ 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 () {
+ g.NewButton("debug.PrintStack(current)", func() {
outputTextbox.SetText(string(debug.Stack()))
})
- g.NewButton("pprof.Lookup(goroutine)", func () {
+ 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 () {
+ g.NewButton("pprof.Lookup(block)", func() {
buf := new(bytes.Buffer)
pprof.Lookup("block").WriteTo(buf, 1)
outputTextbox.SetText(buf.String())
})
- g.NewButton("pprof.Lookup threadcreate", func () {
+ g.NewButton("pprof.Lookup threadcreate", func() {
buf := new(bytes.Buffer)
pprof.Lookup("threadcreate").WriteTo(buf, 1)
outputTextbox.SetText(buf.String())
})
- g.NewButton("runtime.ReadMemStats()", func () {
+ g.NewButton("runtime.ReadMemStats()", func() {
outputTextbox.SetText(runtimeReadMemStats())
})
- g.NewButton("debug.FreeOSMemory()", func () {
+ g.NewButton("debug.FreeOSMemory()", func() {
var out string = "Before debug.FreeOSMemory():\n\n"
out += runtimeReadMemStats()
debug.FreeOSMemory()
@@ -69,7 +69,7 @@ func DebugGolangWindow(p *gui.Node) *gadgets.BasicWindow {
outputTextbox.SetText(out)
})
- g.NewButton("debug.ReadGCStats()", func () {
+ g.NewButton("debug.ReadGCStats()", func() {
var tmp debug.GCStats
var out string
debug.ReadGCStats(&tmp)
@@ -83,11 +83,11 @@ func DebugGolangWindow(p *gui.Node) *gadgets.BasicWindow {
outputTextbox.SetText(out)
})
- g.NewButton("debug.SetTraceback('all')", func () {
+ g.NewButton("debug.SetTraceback('all')", func() {
debug.SetTraceback("all")
})
- g.NewButton("panic()", func () {
+ g.NewButton("panic()", func() {
panic("test")
})
@@ -95,36 +95,36 @@ func DebugGolangWindow(p *gui.Node) *gadgets.BasicWindow {
// g.NewLabel("TODO:")
- g.NewButton("runtime.Stack(true)", func () {
+ g.NewButton("runtime.Stack(true)", func() {
// TODO: https://stackoverflow.com/questions/61127053/how-to-list-all-the-running-goroutines-in-a-go-program
// func Stack(buf []byte, all bool) int
})
- g.NewButton("debug.SetMemoryLimit(int)", func () {
+ g.NewButton("debug.SetMemoryLimit(int)", func() {
// TODO:
//debug.SetMemoryLimit(1024 * 1024 * 100)
})
- g.NewButton("debug.SetMaxStack(int bytes)", func () {
+ g.NewButton("debug.SetMaxStack(int bytes)", func() {
// default is apparently 1GB
})
- g.NewButton("debug.SetMaxThreads(int)", func () {
+ g.NewButton("debug.SetMaxThreads(int)", func() {
// default is apparently 10,000
})
- g.NewButton("debug.SetTraceback('all')", func () {
+ g.NewButton("debug.SetTraceback('all')", func() {
debug.SetTraceback("all")
})
// deprecated (probably) by String() implementation within golang
- g.NewButton("dumpModuleInfo() (deprecate)", func () {
+ g.NewButton("dumpModuleInfo() (deprecate)", func() {
outputTextbox.SetText(dumpModuleInfo())
})
og = w.Box().NewGroup("output").Pad()
outputTextbox = og.NewTextbox("outputBox")
- outputTextbox.Custom = func () {
+ outputTextbox.Custom = func() {
log.Log(INFO, "custom TextBox() for golang output a =", outputTextbox.String())
}
@@ -143,7 +143,7 @@ func runtimeReadMemStats() string {
out += fmt.Sprintln("frees:", s.Frees)
out += fmt.Sprintln("heap-alloc:", s.HeapAlloc, "bytes")
out += fmt.Sprintln("heap-sys:", s.HeapSys, "bytes")
- out += fmt.Sprintln("heap-idle:", s.HeapIdle,"bytes")
+ out += fmt.Sprintln("heap-idle:", s.HeapIdle, "bytes")
out += fmt.Sprintln("heap-in-use:", s.HeapInuse, "bytes")
out += fmt.Sprintln("heap-released:", s.HeapReleased, "bytes")
out += fmt.Sprintln("heap-objects:", s.HeapObjects)