diff options
Diffstat (limited to 'ui/commands.go')
-rw-r--r-- | ui/commands.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/ui/commands.go b/ui/commands.go index a8b1faa..a652518 100644 --- a/ui/commands.go +++ b/ui/commands.go @@ -19,6 +19,9 @@ package ui import ( "encoding/json" "fmt" + "os" + "runtime" + "runtime/pprof" "strings" "unicode" @@ -69,6 +72,18 @@ var rainbow = GradientTable{ {colorful.LinearRgb(1, 0, 0.5), 1}, } +func cmdHeapProfile(cmd *Command) { + runtime.GC() + memProfile, err := os.Create("gomuks.prof") + if err != nil { + debug.Print(err) + } + defer memProfile.Close() + if err := pprof.WriteHeapProfile(memProfile); err != nil { + debug.Print(err) + } +} + // TODO this command definitely belongs in a plugin once we have a plugin system. func cmdRainbow(cmd *Command) { text := strings.Join(cmd.Args, " ") |