genFramesFromLineData()

in frontend/src/components/jfr/flame-graph.js [1264:1313]


    genFramesFromLineData() {
      let dataSource = this.$dataSource;

      for (let i = 0; i < this.$$stackTracesCounter(dataSource); i++) {
        const stackTrace = this.$$stackTraceExtractor(dataSource, i);
        if (!this.$$stackTraceFilter(dataSource, stackTrace)) {
          continue;
        }

        const frameCount = this.$$framesCounter(dataSource, stackTrace);

        if (frameCount === 0) {
          return;
        }

        this.$stackTraceMaxDepth = Math.max(this.$stackTraceMaxDepth, frameCount);

        let weights = this.$$weightsExtractor(dataSource, stackTrace);
        let weight, weightOfBaseline1, weightOfBaseline2;
        if (this.$$diff) {
          [weightOfBaseline1, weightOfBaseline2] = weights;
          weight = weightOfBaseline1 + weightOfBaseline2;
          this.$totalWeightOfBaseline1 += weightOfBaseline1;
          this.$totalWeightOfBaseline2 += weightOfBaseline2;
        } else {
          weight = weights;
        }

        this.$totalWeight += weight;
        this.$root.addWeight(weight);

        let current = this.$root;
        let j = this.$$reverse ? frameCount - 1 : 0;
        let end = this.$$reverse ? -1 : frameCount;
        let step = this.$$reverse ? -1 : 1;
        for (; j !== end; j += step) {
          const frame = this.$$frameExtractor(dataSource, stackTrace, j);
          const child = current.findOrAddChild(frame);
          child.addWeight(weight);
          if (this.$$diff) {
            child.addWeightOfBaselines(weightOfBaseline1, weightOfBaseline2);
          }
          current = child;
        }
        current.addSelfWeight(weight);
        if (this.$$diff) {
          current.addSelfWeightOfBaselines(weightOfBaseline1, weightOfBaseline2);
        }
      }
    }