Commit 89ccd579 authored by Russ Cox's avatar Russ Cox

cmd/pprof: use correct default handler for Go programs

The original go tool pprof (written in Perl) got this right.
The Go rewrite never has, but should.

Change-Id: Ie1fc571214c61b1b5654a0bc90e15eb889adf059
Reviewed-on: https://go-review.googlesource.com/32617
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 8eb9fdaa
...@@ -28,6 +28,9 @@ import ( ...@@ -28,6 +28,9 @@ import (
"internal/pprof/profile" "internal/pprof/profile"
) )
// cpuProfileHandler is the Go pprof CPU profile handler URL.
const cpuProfileHandler = "/debug/pprof/profile"
// PProf acquires a profile, and symbolizes it using a profile // PProf acquires a profile, and symbolizes it using a profile
// manager. Then it generates a report formatted according to the // manager. Then it generates a report formatted according to the
// options selected through the flags package. // options selected through the flags package.
...@@ -160,10 +163,10 @@ func adjustURL(source string, sec int, ui plugin.UI) (adjusted, host string, dur ...@@ -160,10 +163,10 @@ func adjustURL(source string, sec int, ui plugin.UI) (adjusted, host string, dur
switch strings.ToLower(url.Path) { switch strings.ToLower(url.Path) {
case "", "/": case "", "/":
// Apply default /profilez. // Apply default /profilez.
url.Path = "/profilez" url.Path = cpuProfileHandler
case "/protoz": case "/protoz":
// Rewrite to /profilez?type=proto // Rewrite to /profilez?type=proto
url.Path = "/profilez" url.Path = cpuProfileHandler
values.Set("type", "proto") values.Set("type", "proto")
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment