aboutsummaryrefslogtreecommitdiff
path: root/src/internal/trace
diff options
context:
space:
mode:
Diffstat (limited to 'src/internal/trace')
-rw-r--r--src/internal/trace/order.go2
-rw-r--r--src/internal/trace/parser.go2
-rw-r--r--src/internal/trace/traceviewer/mmu.go2
3 files changed, 3 insertions, 3 deletions
diff --git a/src/internal/trace/order.go b/src/internal/trace/order.go
index 07a6e13ffe..5c6e78b285 100644
--- a/src/internal/trace/order.go
+++ b/src/internal/trace/order.go
@@ -58,7 +58,7 @@ func order1007(m map[int][]*Event) (events []*Event, err error) {
// off of the profBuf queue. Re-sort them by the timestamp we captured
// inside the signal handler.
sort.Stable(eventList(m[ProfileP]))
- var batches []*eventBatch
+ batches := make([]*eventBatch, 0, len(m))
for _, v := range m {
pending += len(v)
batches = append(batches, &eventBatch{v, false})
diff --git a/src/internal/trace/parser.go b/src/internal/trace/parser.go
index 3bbfbebab4..a263421792 100644
--- a/src/internal/trace/parser.go
+++ b/src/internal/trace/parser.go
@@ -914,7 +914,7 @@ func symbolize(events []*Event, bin string) error {
// Write all pcs to addr2line.
// Need to copy pcs to an array, because map iteration order is non-deterministic.
- var pcArray []uint64
+ pcArray := make([]uint64, 0, len(pcs))
for pc := range pcs {
pcArray = append(pcArray, pc)
_, err := fmt.Fprintf(in, "0x%x\n", pc-1)
diff --git a/src/internal/trace/traceviewer/mmu.go b/src/internal/trace/traceviewer/mmu.go
index 0bc1233b44..fe21bfe2d8 100644
--- a/src/internal/trace/traceviewer/mmu.go
+++ b/src/internal/trace/traceviewer/mmu.go
@@ -385,7 +385,7 @@ func (m *mmu) HandleDetails(w http.ResponseWriter, r *http.Request) {
worst := mmuCurve.Examples(time.Duration(window), 10)
// Construct a link for each window.
- var links []linkedUtilWindow
+ links := make([]linkedUtilWindow, 0, len(worst))
for _, ui := range worst {
links = append(links, m.newLinkedUtilWindow(ui, time.Duration(window)))
}