File tree 2 files changed +7
-4
lines changed 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -371,7 +371,7 @@ func Round4(x int) int {
371
371
// numCtrs uint32
372
372
// pkgid uint32
373
373
// funcid uint32
374
- // counterArray [numBlocks ]uint32
374
+ // counterArray [numCtrs ]uint32
375
375
// }
376
376
//
377
377
// where "numCtrs" is the number of blocks / coverable units within the
Original file line number Diff line number Diff line change @@ -294,19 +294,22 @@ func snapshot() float64 {
294
294
totExec := uint64 (0 )
295
295
for _ , c := range cl {
296
296
sd := unsafe .Slice ((* atomic .Uint32 )(unsafe .Pointer (c .Counters )), c .Len )
297
- tot += uint64 (len (sd ))
298
297
for i := 0 ; i < len (sd ); i ++ {
298
+ nCtrs := sd [i + coverage .NumCtrsOffset ].Load ()
299
+
299
300
// Skip ahead until the next non-zero value.
300
- if sd [ i ]. Load () == 0 {
301
+ if nCtrs == 0 {
301
302
continue
302
303
}
304
+
303
305
// We found a function that was executed.
304
- nCtrs := sd [i + coverage .NumCtrsOffset ].Load ()
305
306
cst := i + coverage .FirstCtrOffset
306
307
307
308
if cst + int (nCtrs ) > len (sd ) {
308
309
break
309
310
}
311
+
312
+ tot += uint64 (nCtrs )
310
313
counters := sd [cst : cst + int (nCtrs )]
311
314
for i := range counters {
312
315
if counters [i ].Load () != 0 {
You can’t perform that action at this time.
0 commit comments