aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/pprof/pprof.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/http/pprof/pprof.go')
-rw-r--r--src/net/http/pprof/pprof.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/net/http/pprof/pprof.go b/src/net/http/pprof/pprof.go
index 2357d8ed1e..cb4086b963 100644
--- a/src/net/http/pprof/pprof.go
+++ b/src/net/http/pprof/pprof.go
@@ -30,7 +30,8 @@
//
// go tool pprof http://localhost:6060/debug/pprof/profile
//
-// Or to look at the goroutine blocking profile:
+// Or to look at the goroutine blocking profile, after calling
+// runtime.SetBlockProfileRate in your program:
//
// go tool pprof http://localhost:6060/debug/pprof/block
//
@@ -119,8 +120,8 @@ func Profile(w http.ResponseWriter, r *http.Request) {
// Tracing lasts for duration specified in seconds GET parameter, or for 1 second if not specified.
// The package initialization registers it as /debug/pprof/trace.
func Trace(w http.ResponseWriter, r *http.Request) {
- sec, _ := strconv.ParseInt(r.FormValue("seconds"), 10, 64)
- if sec == 0 {
+ sec, err := strconv.ParseFloat(r.FormValue("seconds"), 64)
+ if sec <= 0 || err != nil {
sec = 1
}
@@ -135,7 +136,7 @@ func Trace(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Could not enable tracing: %s\n", err)
return
}
- sleep(w, time.Duration(sec)*time.Second)
+ sleep(w, time.Duration(sec*float64(time.Second)))
trace.Stop()
}