@@ -215,6 +215,8 @@ export class ActivityGraphFillComputer {
215215 interval,
216216 enableCPUUsage,
217217 sampleIndexOffset,
218+ rangeStart,
219+ sampleSelectedStates,
218220 } = this . renderedComponentSettings ;
219221
220222 if ( samples . length === 0 ) {
@@ -246,15 +248,19 @@ export class ActivityGraphFillComputer {
246248 afterSampleCpuRatio = threadCPURatio [ i + 1 ] ;
247249 }
248250
249- // Mutate the percentage buffers.
250- this . _accumulateInCategory (
251- category ,
252- i ,
251+ const percentageBuffers = this . mutablePercentageBuffers [ category ] ;
252+ const selectedState = sampleSelectedStates [ i ] ;
253+ const percentageBuffer = percentageBuffers [ selectedState ] ;
254+
255+ _accumulateInBuffer (
256+ percentageBuffer ,
257+ this . renderedComponentSettings ,
253258 prevSampleTime ,
254259 sampleTime ,
255260 nextSampleTime ,
256261 beforeSampleCpuRatio ,
257- afterSampleCpuRatio
262+ afterSampleCpuRatio ,
263+ rangeStart
258264 ) ;
259265
260266 prevSampleTime = sampleTime ;
@@ -285,33 +291,10 @@ export class ActivityGraphFillComputer {
285291 }
286292 }
287293
288- this . _accumulateInCategory (
289- lastSampleCategory ,
290- samples . length - 1 ,
291- prevSampleTime ,
292- sampleTime ,
293- sampleTime + interval ,
294- beforeSampleCpuRatio ,
295- afterSampleCpuRatio
296- ) ;
297- }
294+ const nextSampleTime = sampleTime + interval ;
295+ const percentageBuffers = this . mutablePercentageBuffers [ lastSampleCategory ] ;
298296
299- /**
300- * Mutate the percentage buffers, by taking this category, and accumulating its
301- * percentage into the buffer.
302- */
303- _accumulateInCategory (
304- category : IndexIntoCategoryList ,
305- sampleIndex : IndexIntoSamplesTable ,
306- prevSampleTime : Milliseconds ,
307- sampleTime : Milliseconds ,
308- nextSampleTime : Milliseconds ,
309- beforeSampleCpuRatio : number ,
310- afterSampleCpuRatio : number
311- ) {
312- const { rangeStart, sampleSelectedStates } = this . renderedComponentSettings ;
313- const percentageBuffers = this . mutablePercentageBuffers [ category ] ;
314- const selectedState = sampleSelectedStates [ sampleIndex ] ;
297+ const selectedState = sampleSelectedStates [ lastIdx ] ;
315298 const percentageBuffer = percentageBuffers [ selectedState ] ;
316299
317300 _accumulateInBuffer (
0 commit comments