mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/trace: compute pprof-style output per goroutine type
The trace command computes IO, Schedule, Block, and Syscall profiles by following the unblocking links in the execution trace and summing up the duration. This change offers variations of those profiles that include only selected goroutine types. The id parameter takes the goroutine type - i.e. pc of the goroutine. The output is available from the /goroutine view. So, users can see where the goroutines of interest typically block. Also, these profiles are available for download so users can use pprof or other tools to interpret the output. This change adds links for download of global profile in the main page. Change-Id: I35699252056d164e60de282b0406caf96d629c85 Reviewed-on: https://go-review.googlesource.com/75710 Reviewed-by: Sameer Ajmani <sameer@golang.org>
This commit is contained in:
parent
6be1c09e19
commit
5bd66e5e1e
3 changed files with 101 additions and 20 deletions
|
|
@ -79,7 +79,7 @@ func main() {
|
|||
flag.Usage()
|
||||
}
|
||||
|
||||
var pprofFunc func(io.Writer) error
|
||||
var pprofFunc func(io.Writer, string) error
|
||||
switch *pprofFlag {
|
||||
case "net":
|
||||
pprofFunc = pprofIO
|
||||
|
|
@ -91,7 +91,7 @@ func main() {
|
|||
pprofFunc = pprofSched
|
||||
}
|
||||
if pprofFunc != nil {
|
||||
if err := pprofFunc(os.Stdout); err != nil {
|
||||
if err := pprofFunc(os.Stdout, ""); err != nil {
|
||||
dief("failed to generate pprof: %v\n", err)
|
||||
}
|
||||
os.Exit(0)
|
||||
|
|
@ -187,10 +187,10 @@ var templMain = template.Must(template.New("").Parse(`
|
|||
<a href="/trace">View trace</a><br>
|
||||
{{end}}
|
||||
<a href="/goroutines">Goroutine analysis</a><br>
|
||||
<a href="/io">Network blocking profile</a><br>
|
||||
<a href="/block">Synchronization blocking profile</a><br>
|
||||
<a href="/syscall">Syscall blocking profile</a><br>
|
||||
<a href="/sched">Scheduler latency profile</a><br>
|
||||
<a href="/io">Network blocking profile</a> (<a href="/io?raw=1" download="io.profile">⬇</a>)<br>
|
||||
<a href="/block">Synchronization blocking profile</a> (<a href="/block?raw=1" download="block.profile">⬇</a>)<br>
|
||||
<a href="/syscall">Syscall blocking profile</a> (<a href="/syscall?raw=1" download="syscall.profile">⬇</a>)<br>
|
||||
<a href="/sched">Scheduler latency profile</a> (<a href="/sche?raw=1" download="sched.profile">⬇</a>)<br>
|
||||
</body>
|
||||
</html>
|
||||
`))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue