From 21a86c3216369c5711636f60b0b8396da2b5482a Mon Sep 17 00:00:00 2001 From: Jeremy Latt Date: Fri, 28 Mar 2014 12:35:05 -0700 Subject: [PATCH] fix gcstats debugging command --- irc/server.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/irc/server.go b/irc/server.go index 57f53d13..9701f4f3 100644 --- a/irc/server.go +++ b/irc/server.go @@ -654,9 +654,11 @@ func (msg *DebugCommand) HandleServer(server *Server) { server.Reply(client, "OK") case "GCSTATS": - stats := &debug.GCStats{ + stats := debug.GCStats{ + Pause: make([]time.Duration, 10), PauseQuantiles: make([]time.Duration, 5), } + debug.ReadGCStats(&stats) server.Reply(client, "last GC: %s", stats.LastGC.Format(time.RFC1123)) server.Reply(client, "num GC: %d", stats.NumGC) server.Reply(client, "pause total: %s", stats.PauseTotal) @@ -671,14 +673,15 @@ func (msg *DebugCommand) HandleServer(server *Server) { server.Reply(client, "num goroutines: %d", count) case "PROFILEHEAP": - file, err := os.Create("ergonomadic.heap.prof") + profFile := "ergonomadic-heap.prof" + file, err := os.Create(profFile) if err != nil { log.Printf("error: %s", err) break } defer file.Close() pprof.Lookup("heap").WriteTo(file, 0) - server.Reply(client, "written to ergonomadic-heap.prof") + server.Reply(client, "written to %s", profFile) } }