chore: ignore stack with negative sample

This commit is contained in:
YiniXu9506 2021-11-04 10:34:33 +08:00
parent e37f6fa7c3
commit 77dfa69d91

View File

@ -492,13 +492,10 @@ export class StackListProfileBuilder extends Profile {
}
appendSampleWithWeight(stack: FrameInfo[], weight: number) {
if (weight === 0) {
// Samples with zero weight have no effect, so let's ignore them
if (weight === 0 || weight < 0) {
// Samples with zero or negative weight have no effect, so let's ignore them
return
}
if (weight < 0) {
throw new Error('Samples must have positive weights')
}
this._appendSample(stack, weight, true)
this._appendSample(stack, weight, false)