This commit is contained in:
Yini Xu 2024-03-05 19:10:17 +08:00 committed by GitHub
commit ccff6544e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -494,13 +494,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')
}
const frames = stack.map(fr => Frame.getOrInsert(this.frames, fr))
this._appendSample(frames, weight, true)