From 77dfa69d912f2267b34fd0bc080ce31f3745073b Mon Sep 17 00:00:00 2001 From: YiniXu9506 Date: Thu, 4 Nov 2021 10:34:33 +0800 Subject: [PATCH] chore: ignore stack with negative sample --- src/lib/profile.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/lib/profile.ts b/src/lib/profile.ts index f900bc04d..82b4f46e3 100644 --- a/src/lib/profile.ts +++ b/src/lib/profile.ts @@ -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)