Commit c0bf96e6 authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

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
parent 8bc1bfb6
...@@ -81,7 +81,6 @@ struct Profile { ...@@ -81,7 +81,6 @@ struct Profile {
uintptr count; // tick count uintptr count; // tick count
uintptr evicts; // eviction count uintptr evicts; // eviction count
uintptr lost; // lost ticks that need to be logged uintptr lost; // lost ticks that need to be logged
uintptr totallost; // total lost ticks
// Active recent stack traces. // Active recent stack traces.
Bucket hash[HashSize]; Bucket hash[HashSize];
...@@ -244,7 +243,6 @@ add(Profile *p, uintptr *pc, int32 n) ...@@ -244,7 +243,6 @@ add(Profile *p, uintptr *pc, int32 n)
if(!evict(p, e)) { if(!evict(p, e)) {
// Could not evict entry. Record lost stack. // Could not evict entry. Record lost stack.
p->lost++; p->lost++;
p->totallost++;
return; return;
} }
p->evicts++; p->evicts++;
...@@ -308,6 +306,7 @@ flushlog(Profile *p) ...@@ -308,6 +306,7 @@ flushlog(Profile *p)
*q++ = p->lost; *q++ = p->lost;
*q++ = 1; *q++ = 1;
*q++ = (uintptr)LostProfileData; *q++ = (uintptr)LostProfileData;
p->lost = 0;
} }
p->nlog = q - log; p->nlog = q - log;
return true; return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment