Skip to content

Commit a7408b8

Browse files
committed
Fix zero-delta case in overuse detector
1 parent ae2a85f commit a7408b8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/gcc/overuse_detector.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,17 @@ func (d *overuseDetector) onDelayStats(ds DelayStats) {
4949
} else {
5050
d.increasingDuration += delta
5151
}
52+
5253
d.increasingCounter++
53-
if d.increasingDuration > d.overuseTime && d.increasingCounter > 1 {
54+
55+
if (d.overuseTime == 0 && d.increasingCounter > 1) ||
56+
(d.increasingDuration > d.overuseTime && d.increasingCounter > 1) {
5457
if estimate > d.lastEstimate {
5558
use = usageOver
5659
}
5760
}
5861
}
62+
5963
if thresholdUse == usageUnder {
6064
d.increasingCounter = 0
6165
d.increasingDuration = 0
@@ -67,6 +71,7 @@ func (d *overuseDetector) onDelayStats(ds DelayStats) {
6771
d.increasingCounter = 0
6872
use = usageNormal
6973
}
74+
7075
d.lastEstimate = estimate
7176

7277
d.dsWriter(DelayStats{

0 commit comments

Comments
 (0)