@@ -167,6 +167,14 @@ func (b *B) StartTimer() {
167
167
// while performing steps that you don't want to measure.
168
168
func (b * B ) StopTimer () {
169
169
if b .timerOn {
170
+ b .duration += highPrecisionTimeSince (b .start )
171
+ // runtime.ReadMemStats(&memStats)
172
+ // b.netAllocs += memStats.Mallocs - b.startAllocs
173
+ // b.netBytes += memStats.TotalAlloc - b.startBytes
174
+ b .timerOn = false
175
+ // If we hit B.Loop with the timer stopped, fail.
176
+ // b.loop.i |= loopPoisonTimer
177
+
170
178
endTimestamp := capi .CurrentTimestamp ()
171
179
b .codspeed .instrument_hooks .AddBenchmarkTimestamps (b .codspeed .startTimestamp , endTimestamp )
172
180
@@ -176,13 +184,6 @@ func (b *B) StopTimer() {
176
184
// the number of iterations for this round.
177
185
b .codspeedItersPerRound = append (b .codspeedItersPerRound , max (int64 (b .N ), 1 ))
178
186
b .codspeedTimePerRoundNs = append (b .codspeedTimePerRoundNs , highPrecisionTimeSince (b .start ))
179
- b .duration += highPrecisionTimeSince (b .start )
180
- // runtime.ReadMemStats(&memStats)
181
- // b.netAllocs += memStats.Mallocs - b.startAllocs
182
- // b.netBytes += memStats.TotalAlloc - b.startBytes
183
- b .timerOn = false
184
- // If we hit B.Loop with the timer stopped, fail.
185
- // b.loop.i |= loopPoisonTimer
186
187
}
187
188
}
188
189
0 commit comments