From: Dmitriy Vyukov Date: Wed, 7 May 2014 14:48:14 +0000 (+0400) Subject: runtime: fix bug in cpu profiler X-Git-Tag: go1.3beta2~133 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=c0bf96e6b10976274bf5ee7813845dc0eb590816;p=gostls13.git runtime: fix bug in cpu profiler Number of lost samples was overcounted (never reset). Also remove unused variable (it's trivial to restore it for debugging if needed). LGTM=iant R=golang-codereviews, iant CC=golang-codereviews, rsc https://golang.org/cl/96060043 --- diff --git a/src/pkg/runtime/cpuprof.goc b/src/pkg/runtime/cpuprof.goc index 9653e4a68d..faaea29435 100644 --- a/src/pkg/runtime/cpuprof.goc +++ b/src/pkg/runtime/cpuprof.goc @@ -81,7 +81,6 @@ struct Profile { uintptr count; // tick count uintptr evicts; // eviction count uintptr lost; // lost ticks that need to be logged - uintptr totallost; // total lost ticks // Active recent stack traces. Bucket hash[HashSize]; @@ -244,7 +243,6 @@ add(Profile *p, uintptr *pc, int32 n) if(!evict(p, e)) { // Could not evict entry. Record lost stack. p->lost++; - p->totallost++; return; } p->evicts++; @@ -308,6 +306,7 @@ flushlog(Profile *p) *q++ = p->lost; *q++ = 1; *q++ = (uintptr)LostProfileData; + p->lost = 0; } p->nlog = q - log; return true;