diff options
Diffstat (limited to 'src/pkg/runtime/cpuprof.go')
-rw-r--r-- | src/pkg/runtime/cpuprof.go | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/pkg/runtime/cpuprof.go b/src/pkg/runtime/cpuprof.go index b397eafbe..4325d7e1c 100644 --- a/src/pkg/runtime/cpuprof.go +++ b/src/pkg/runtime/cpuprof.go @@ -239,9 +239,7 @@ Assoc: // Reuse the newly evicted entry. e.depth = uintptr(len(pc)) e.count = 1 - for i := range pc { - e.stack[i] = pc[i] - } + copy(e.stack[:], pc) } // evict copies the given entry's data into the log, so that @@ -266,10 +264,8 @@ func (p *cpuProfile) evict(e *cpuprofEntry) bool { q++ log[q] = d q++ - for i := uintptr(0); i < d; i++ { - log[q] = e.stack[i] - q++ - } + copy(log[q:], e.stack[:d]) + q += d p.nlog = q e.count = 0 return true |