aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/trace/main.go
diff options
context:
space:
mode:
authorHana Kim <hakim@google.com>2018-04-04 14:24:02 -0400
committerHyang-Ah Hana Kim <hyangah@gmail.com>2018-04-10 19:40:42 +0000
commit95e6a9fc50bbd2cb5dc643ce93dfef582a2fd07a (patch)
tree7aebef4c3b54e16cd687b54897588da9ef8cbe22 /src/cmd/trace/main.go
parent8bb8eaff626796908938e7f0da102dc51a265237 (diff)
downloadgo-95e6a9fc50bbd2cb5dc643ce93dfef582a2fd07a.tar.xz
cmd/trace: pprof computation for span types
/spanio, /spanblock, /spansched, /spansyscall provide the pprof-style summary of span execution's io, block, scheduling, syscall latency distributions respectively. The computation logic for /io, /block, /sched, /syscall analysis was refactored and extended for reuse in these new types of analysis. Upon the analysis query, we create a map of goroutine id to time intervals based on the query parameter, that represents the interesting time intervals of matching goroutines. Only the events from the matching goroutines that fall into the intervals are considered in the pprof computation. The new endpoints are not yet hooked into other span analysis page (e.g. /userspan) yet. Change-Id: I80c3396e45a2d6631758710de67d132e5832c7ce Reviewed-on: https://go-review.googlesource.com/105822 Reviewed-by: Heschi Kreinick <heschi@google.com> Run-TryBot: Heschi Kreinick <heschi@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/trace/main.go')
-rw-r--r--src/cmd/trace/main.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cmd/trace/main.go b/src/cmd/trace/main.go
index 9e8292df2a..57608067f1 100644
--- a/src/cmd/trace/main.go
+++ b/src/cmd/trace/main.go
@@ -83,19 +83,19 @@ func main() {
flag.Usage()
}
- var pprofFunc func(io.Writer, string) error
+ var pprofFunc func(io.Writer, *http.Request) error
switch *pprofFlag {
case "net":
- pprofFunc = pprofIO
+ pprofFunc = pprofByGoroutine(computePprofIO)
case "sync":
- pprofFunc = pprofBlock
+ pprofFunc = pprofByGoroutine(computePprofBlock)
case "syscall":
- pprofFunc = pprofSyscall
+ pprofFunc = pprofByGoroutine(computePprofSyscall)
case "sched":
- pprofFunc = pprofSched
+ pprofFunc = pprofByGoroutine(computePprofSched)
}
if pprofFunc != nil {
- if err := pprofFunc(os.Stdout, ""); err != nil {
+ if err := pprofFunc(os.Stdout, &http.Request{}); err != nil {
dief("failed to generate pprof: %v\n", err)
}
os.Exit(0)