aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/trace
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2022-02-03 14:12:08 -0500
committerRuss Cox <rsc@golang.org>2022-04-11 16:34:30 +0000
commit19309779ac5e2f5a2fd3cbb34421dafb2855ac21 (patch)
tree67dfd3e5d96250325e383183f95b6f5fe1968514 /src/cmd/trace
parent017933163ab6a2b254f0310c61b57db65cded92e (diff)
downloadgo-19309779ac5e2f5a2fd3cbb34421dafb2855ac21.tar.xz
all: gofmt main repo
[This CL is part of a sequence implementing the proposal #51082. The design doc is at https://go.dev/s/godocfmt-design.] Run the updated gofmt, which reformats doc comments, on the main repository. Vendored files are excluded. For #51082. Change-Id: I7332f099b60f716295fb34719c98c04eb1a85407 Reviewed-on: https://go-review.googlesource.com/c/go/+/384268 Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/cmd/trace')
-rw-r--r--src/cmd/trace/annotations_test.go6
-rw-r--r--src/cmd/trace/doc.go20
2 files changed, 16 insertions, 10 deletions
diff --git a/src/cmd/trace/annotations_test.go b/src/cmd/trace/annotations_test.go
index 9f1c8e3b3b..ca14d3160b 100644
--- a/src/cmd/trace/annotations_test.go
+++ b/src/cmd/trace/annotations_test.go
@@ -53,9 +53,9 @@ func TestOverlappingDuration(t *testing.T) {
// prog0 starts three goroutines.
//
-// goroutine 1: taskless region
-// goroutine 2: starts task0, do work in task0.region0, starts task1 which ends immediately.
-// goroutine 3: do work in task0.region1 and task0.region2, ends task0
+// goroutine 1: taskless region
+// goroutine 2: starts task0, do work in task0.region0, starts task1 which ends immediately.
+// goroutine 3: do work in task0.region1 and task0.region2, ends task0
func prog0() {
ctx := context.Background()
diff --git a/src/cmd/trace/doc.go b/src/cmd/trace/doc.go
index ed1f930a7b..26a96fac2f 100644
--- a/src/cmd/trace/doc.go
+++ b/src/cmd/trace/doc.go
@@ -6,25 +6,31 @@
Trace is a tool for viewing trace files.
Trace files can be generated with:
- - runtime/trace.Start
- - net/http/pprof package
- - go test -trace
+ - runtime/trace.Start
+ - net/http/pprof package
+ - go test -trace
Example usage:
Generate a trace file with 'go test':
+
go test -trace trace.out pkg
+
View the trace in a web browser:
+
go tool trace trace.out
+
Generate a pprof-like profile from the trace:
+
go tool trace -pprof=TYPE trace.out > TYPE.pprof
Supported profile types are:
- - net: network blocking profile
- - sync: synchronization blocking profile
- - syscall: syscall blocking profile
- - sched: scheduler latency profile
+ - net: network blocking profile
+ - sync: synchronization blocking profile
+ - syscall: syscall blocking profile
+ - sched: scheduler latency profile
Then, you can use the pprof tool to analyze the profile:
+
go tool pprof TYPE.pprof
Note that while the various profiles available when launching