diff options
| author | Jeff Carr <[email protected]> | 2023-03-01 11:35:36 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2023-03-01 11:35:36 -0600 |
| commit | 8dbf5a09097b7868e9218bf98716c57eac998a10 (patch) | |
| tree | ab3bdfeaf5a59a55de9d2a6661d2d824090491e5 /example_window_golang_debug.go | |
| parent | f3bb68396afa7452ecf1c8d4744c825a9d81057c (diff) | |
lots cleaner code between the pluginv0.6.1
Queue() around SetText is helping userspace crashing
merge forceDump(bool) into Dump()
debugging output configuration is pretty clean
keep cutting down duplicate things
--gui-verbose flag works
make label "standard" code
add debug.FreeOSMemory()
move the GO language internals to display in the GUI
update push to do tags and go to github.com/wit-go/
remove the other license file
it might be confusing golang.org and github
proper WidgetType
added a Quit() button
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'example_window_golang_debug.go')
| -rw-r--r-- | example_window_golang_debug.go | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/example_window_golang_debug.go b/example_window_golang_debug.go deleted file mode 100644 index 466654a..0000000 --- a/example_window_golang_debug.go +++ /dev/null @@ -1,104 +0,0 @@ -package gui - -import ( - "os" - "runtime" - "runtime/debug" - "runtime/pprof" -) - -func GolangDebugWindow() { - var w, t *Node - - Config.Title = "Go Language Debug Window" - Config.Width = 400 - Config.Height = 400 - Config.Exit = StandardClose - w = NewWindow() - - t = w.NewTab("Debug Tab") - log("debugWindow() START") - - - /////////////////////////////// Column DEBUG GOLANG ////////////////////// - g := t.NewGroup("GO Language") - - g.NewButton("runtime.Stack()", func () { - log("\tSTART") - buf := make([]byte, 1<<16) - runtime.Stack(buf, true) - log("\t %s", buf) - log("\tEND") - }) - g.NewButton("dumpModuleInfo()", func () { - log("\tSTART") - dumpModuleInfo() - log("\tEND") - }) - g.NewButton("debug.PrintStack()", func () { - log("\tSTART") - debug.PrintStack() - log("\tEND") - }) - g.NewButton("pprof.Lookup(goroutine)", func () { - log("\tSTART") - pprof.Lookup("goroutine").WriteTo(os.Stdout, 1) - log("\tEND") - }) - g.NewButton("pprof.Lookup(heap)", func () { - log("\tSTART") - pprof.Lookup("heap").WriteTo(os.Stdout, 1) - log("\tEND") - }) - g.NewButton("pprof.Lookup(block)", func () { - log("\tSTART") - pprof.Lookup("block").WriteTo(os.Stdout, 1) - log("\tEND") - }) - g.NewButton("pprof.Lookup threadcreate", func () { - log("\tSTART") - pprof.Lookup("threadcreate").WriteTo(os.Stdout, 1) - log("\tEND") - }) - g.NewButton("runtime.ReadMemStats", func () { - var s runtime.MemStats - runtime.ReadMemStats(&s) - log("alloc: %v bytes\n", s.Alloc) - log("total-alloc: %v bytes\n", s.TotalAlloc) - log("sys: %v bytes\n", s.Sys) - log("lookups: %v\n", s.Lookups) - log("mallocs: %v\n", s.Mallocs) - log("frees: %v\n", s.Frees) - log("heap-alloc: %v bytes\n", s.HeapAlloc) - log("heap-sys: %v bytes\n", s.HeapSys) - log("heap-idle: %v bytes\n", s.HeapIdle) - log("heap-in-use: %v bytes\n", s.HeapInuse) - log("heap-released: %v bytes\n", s.HeapReleased) - log("heap-objects: %v\n", s.HeapObjects) - log("stack-in-use: %v bytes\n", s.StackInuse) - log("stack-sys: %v bytes\n", s.StackSys) - log("next-gc: when heap-alloc >= %v bytes\n", s.NextGC) - log("last-gc: %v ns\n", s.LastGC) - log("gc-pause: %v ns\n", s.PauseTotalNs) - log("num-gc: %v\n", s.NumGC) - log("enable-gc: %v\n", s.EnableGC) - log("debug-gc: %v\n", s.DebugGC) - }) -} - -func dumpModuleInfo() { - tmp, _ := debug.ReadBuildInfo() - if tmp == nil { - log("This wasn't compiled with go module support") - return - } - log("mod.Path = ", tmp.Path) - log("mod.Main.Path = ", tmp.Main.Path) - log("mod.Main.Version = ", tmp.Main.Version) - log("mod.Main.Sum = ", tmp.Main.Sum) - for _, value := range tmp.Deps { - log("\tmod.Path = ", value.Path) - log("\tmod.Version = ", value.Version) - } -} - |
