]> Cypherpunks repositories - gostls13.git/commitdiff
Revert "runtime/pprof: write heap statistics to heap profile always"
authorJosh Bleecher Snyder <josharian@gmail.com>
Fri, 1 May 2015 15:10:24 +0000 (15:10 +0000)
committerJosh Bleecher Snyder <josharian@gmail.com>
Fri, 1 May 2015 15:56:20 +0000 (15:56 +0000)
This reverts commit c26fc88d56ee4f93c98fc8923fe256121e6199cf.

This broke pprof. See the comments at 9491.

Change-Id: Ic99ce026e86040c050a9bf0ea3024a1a42274ad1
Reviewed-on: https://go-review.googlesource.com/9565
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
doc/go1.5.txt
src/runtime/pprof/pprof.go

index 7c4df59b7173f9bb38e14f102e93210e8a99d51d..162832b22fd3ed0b956f2d51d7ac0db1b810511b 100644 (file)
@@ -59,7 +59,6 @@ reflect: add ArrayOf (https://golang.org/cl/4111)
 reflect: add FuncOf (https://golang.org/cl/1996)
 runtime, syscall: use SYSCALL instruction on FreeBSD (Go 1.5 now requires FreeBSD 8-STABLE+) (https://golang.org/cl/3020)
 runtime, syscall: use get_random_bytes syscall for NaCl (Go 1.5 now requires NaCl SDK pepper-39 or above) (https://golang.org/cl/1755)
-runtime/pprof: memory profiles include overall memory statistics by default (https://golang.org/cl/9491)
 strings: add Compare(x, y string) int, for symmetry with bytes.Compare (https://golang.org/cl/2828)
 syscall: Add Foreground and Pgid to SysProcAttr (https://golang.org/cl/5130)
 syscall: add missing Syscall9 for darwin/amd64 (https://golang.org/cl/6555)
index 4290edb7beeaaab3f062b6a98679028268cdb069..b3d0ae9b648b069d5ea9ed4df980b25bf60bf9c4 100644 (file)
@@ -442,33 +442,35 @@ func writeHeap(w io.Writer, debug int) error {
 
        // Print memstats information too.
        // Pprof will ignore, but useful for people
-       s := new(runtime.MemStats)
-       runtime.ReadMemStats(s)
-       fmt.Fprintf(w, "\n# runtime.MemStats\n")
-       fmt.Fprintf(w, "# Alloc = %d\n", s.Alloc)
-       fmt.Fprintf(w, "# TotalAlloc = %d\n", s.TotalAlloc)
-       fmt.Fprintf(w, "# Sys = %d\n", s.Sys)
-       fmt.Fprintf(w, "# Lookups = %d\n", s.Lookups)
-       fmt.Fprintf(w, "# Mallocs = %d\n", s.Mallocs)
-       fmt.Fprintf(w, "# Frees = %d\n", s.Frees)
-
-       fmt.Fprintf(w, "# HeapAlloc = %d\n", s.HeapAlloc)
-       fmt.Fprintf(w, "# HeapSys = %d\n", s.HeapSys)
-       fmt.Fprintf(w, "# HeapIdle = %d\n", s.HeapIdle)
-       fmt.Fprintf(w, "# HeapInuse = %d\n", s.HeapInuse)
-       fmt.Fprintf(w, "# HeapReleased = %d\n", s.HeapReleased)
-       fmt.Fprintf(w, "# HeapObjects = %d\n", s.HeapObjects)
-
-       fmt.Fprintf(w, "# Stack = %d / %d\n", s.StackInuse, s.StackSys)
-       fmt.Fprintf(w, "# MSpan = %d / %d\n", s.MSpanInuse, s.MSpanSys)
-       fmt.Fprintf(w, "# MCache = %d / %d\n", s.MCacheInuse, s.MCacheSys)
-       fmt.Fprintf(w, "# BuckHashSys = %d\n", s.BuckHashSys)
-
-       fmt.Fprintf(w, "# NextGC = %d\n", s.NextGC)
-       fmt.Fprintf(w, "# PauseNs = %d\n", s.PauseNs)
-       fmt.Fprintf(w, "# NumGC = %d\n", s.NumGC)
-       fmt.Fprintf(w, "# EnableGC = %v\n", s.EnableGC)
-       fmt.Fprintf(w, "# DebugGC = %v\n", s.DebugGC)
+       if debug > 0 {
+               s := new(runtime.MemStats)
+               runtime.ReadMemStats(s)
+               fmt.Fprintf(w, "\n# runtime.MemStats\n")
+               fmt.Fprintf(w, "# Alloc = %d\n", s.Alloc)
+               fmt.Fprintf(w, "# TotalAlloc = %d\n", s.TotalAlloc)
+               fmt.Fprintf(w, "# Sys = %d\n", s.Sys)
+               fmt.Fprintf(w, "# Lookups = %d\n", s.Lookups)
+               fmt.Fprintf(w, "# Mallocs = %d\n", s.Mallocs)
+               fmt.Fprintf(w, "# Frees = %d\n", s.Frees)
+
+               fmt.Fprintf(w, "# HeapAlloc = %d\n", s.HeapAlloc)
+               fmt.Fprintf(w, "# HeapSys = %d\n", s.HeapSys)
+               fmt.Fprintf(w, "# HeapIdle = %d\n", s.HeapIdle)
+               fmt.Fprintf(w, "# HeapInuse = %d\n", s.HeapInuse)
+               fmt.Fprintf(w, "# HeapReleased = %d\n", s.HeapReleased)
+               fmt.Fprintf(w, "# HeapObjects = %d\n", s.HeapObjects)
+
+               fmt.Fprintf(w, "# Stack = %d / %d\n", s.StackInuse, s.StackSys)
+               fmt.Fprintf(w, "# MSpan = %d / %d\n", s.MSpanInuse, s.MSpanSys)
+               fmt.Fprintf(w, "# MCache = %d / %d\n", s.MCacheInuse, s.MCacheSys)
+               fmt.Fprintf(w, "# BuckHashSys = %d\n", s.BuckHashSys)
+
+               fmt.Fprintf(w, "# NextGC = %d\n", s.NextGC)
+               fmt.Fprintf(w, "# PauseNs = %d\n", s.PauseNs)
+               fmt.Fprintf(w, "# NumGC = %d\n", s.NumGC)
+               fmt.Fprintf(w, "# EnableGC = %v\n", s.EnableGC)
+               fmt.Fprintf(w, "# DebugGC = %v\n", s.DebugGC)
+       }
 
        if tw != nil {
                tw.Flush()