Skip to content

Commit d82e0ba

Browse files
committed
Don't set didStopEarly after the final invocation.
1 parent a87af0d commit d82e0ba

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/BenchmarkDotNet/Engines/EngineJitStage.cs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,23 +89,30 @@ private IEnumerator<IterationData> EnumerateIterations()
8989
MaybeSleep(JitInfo.TieredDelay);
9090

9191
// Attempt to promote methods to tier1, but don't spend too much time in jit stage.
92+
int tierCount = JitInfo.IsDPGO ? 2 : 1;
93+
++iterationIndex;
94+
9295
StartedClock startedClock = parameters.TargetJob.ResolveValue(InfrastructureMode.ClockCharacteristic, parameters.Resolver).Start();
96+
yield return GetOverheadIterationData();
97+
yield return GetWorkloadIterationData();
9398

94-
int tierCount = JitInfo.IsDPGO ? 2 : 1;
95-
for (int i = 0; i < tierCount; ++i)
99+
int callCount = JitInfo.TieredCallCountThreshold - 1;
100+
for (; tierCount >= 0; --tierCount)
96101
{
97-
for (int j = 0; j < JitInfo.TieredCallCountThreshold; ++j)
102+
for (; callCount >= 0; --callCount)
98103
{
99-
++iterationIndex;
100-
yield return GetOverheadIterationData();
101-
yield return GetWorkloadIterationData();
102-
103104
if (startedClock.GetElapsed().GetTimeValue() >= MaxTieringTime)
104105
{
105106
didStopEarly = true;
106107
yield break;
107108
}
109+
110+
++iterationIndex;
111+
yield return GetOverheadIterationData();
112+
yield return GetWorkloadIterationData();
108113
}
114+
115+
callCount = JitInfo.TieredCallCountThreshold;
109116
}
110117
}
111118

0 commit comments

Comments
 (0)