diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-05-04 15:46:02 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-05-23 11:04:16 +0200 |
commit | fd089e27d7260cee1c7ca449c41cdd0341ebc6cb (patch) | |
tree | 3f3f9f49b86ecec97b875de7f407e7d0f2427975 /src/pkg/http/pprof/pprof.go | |
parent | 1f2ed67937cacb19b0b7e54ea3f5866ca34842a0 (diff) | |
download | golang-fd089e27d7260cee1c7ca449c41cdd0341ebc6cb.tar.gz |
Imported Upstream version 2011.04.27
Diffstat (limited to 'src/pkg/http/pprof/pprof.go')
-rw-r--r-- | src/pkg/http/pprof/pprof.go | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/pkg/http/pprof/pprof.go b/src/pkg/http/pprof/pprof.go index 917c7f877..bc79e2183 100644 --- a/src/pkg/http/pprof/pprof.go +++ b/src/pkg/http/pprof/pprof.go @@ -26,7 +26,6 @@ package pprof import ( "bufio" - "bytes" "fmt" "http" "os" @@ -89,14 +88,10 @@ func Profile(w http.ResponseWriter, r *http.Request) { func Symbol(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/plain; charset=utf-8") - // We have to read the whole POST body before - // writing any output. Buffer the output here. - var buf bytes.Buffer - // We don't know how many symbols we have, but we // do have symbol information. Pprof only cares whether // this number is 0 (no symbols available) or > 0. - fmt.Fprintf(&buf, "num_symbols: 1\n") + fmt.Fprintf(w, "num_symbols: 1\n") var b *bufio.Reader if r.Method == "POST" { @@ -114,19 +109,14 @@ func Symbol(w http.ResponseWriter, r *http.Request) { if pc != 0 { f := runtime.FuncForPC(uintptr(pc)) if f != nil { - fmt.Fprintf(&buf, "%#x %s\n", pc, f.Name()) + fmt.Fprintf(w, "%#x %s\n", pc, f.Name()) } } // Wait until here to check for err; the last // symbol will have an err because it doesn't end in +. if err != nil { - if err != os.EOF { - fmt.Fprintf(&buf, "reading request: %v\n", err) - } break } } - - w.Write(buf.Bytes()) } |