aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/trace
diff options
context:
space:
mode:
authorcuiweixie <cuiweixie@gmail.com>2022-09-04 20:14:47 +0800
committerGopher Robot <gobot@golang.org>2022-09-08 14:33:45 +0000
commite5ed2212a3838b1e64dc7bb6538f6be32b939cf3 (patch)
tree07a8d7ec1e03d7f68aff1a9bd2d20e23606db2df /src/cmd/trace
parentc263fa07b1b10bd7e5847fe9104467908df81114 (diff)
downloadgo-e5ed2212a3838b1e64dc7bb6538f6be32b939cf3.tar.xz
cmd/trace: use strings.Builder
Change-Id: I690dc517c08be4cd66439baad8b91f16622ff0d2 Reviewed-on: https://go-review.googlesource.com/c/go/+/428292 Reviewed-by: Michael Pratt <mpratt@google.com> Run-TryBot: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/trace')
-rw-r--r--src/cmd/trace/annotations.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/trace/annotations.go b/src/cmd/trace/annotations.go
index 1c0dad56d8..a276d7b642 100644
--- a/src/cmd/trace/annotations.go
+++ b/src/cmd/trace/annotations.go
@@ -370,7 +370,7 @@ func (task *taskDesc) String() string {
if task == nil {
return "task <nil>"
}
- wb := new(bytes.Buffer)
+ wb := new(strings.Builder)
fmt.Fprintf(wb, "task %d:\t%s\n", task.id, task.name)
fmt.Fprintf(wb, "\tstart: %v end: %v complete: %t\n", task.firstTimestamp(), task.endTimestamp(), task.complete())
fmt.Fprintf(wb, "\t%d goroutines\n", len(task.goroutines))
@@ -872,7 +872,7 @@ func (h *durationHistogram) ToHTML(urlmaker func(min, max time.Duration) string)
}
}
- w := new(bytes.Buffer)
+ w := new(strings.Builder)
fmt.Fprintf(w, `<table>`)
for i := h.MinBucket; i <= h.MaxBucket; i++ {
// Tick label.
@@ -914,7 +914,7 @@ func (h *durationHistogram) String() string {
}
}
- w := new(bytes.Buffer)
+ w := new(strings.Builder)
for i := h.MinBucket; i <= h.MaxBucket; i++ {
count := h.Buckets[i]
bar := count * barWidth / maxCount