Home / File/ FlamegraphChartBuilder.js — react Source File

FlamegraphChartBuilder.js — react Source File

Architecture documentation for FlamegraphChartBuilder.js, a javascript file in the react codebase. 3 imports, 3 dependents.

File javascript BabelCompiler Validation 3 imports 3 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  9d7f3d0b_1959_a3f3_e24e_821787aa2f54["FlamegraphChartBuilder.js"]
  0f941e70_3fdb_aa42_7939_2878d5d4125b["utils.js"]
  9d7f3d0b_1959_a3f3_e24e_821787aa2f54 --> 0f941e70_3fdb_aa42_7939_2878d5d4125b
  98e7cbed_f4b4_9f35_838e_6e7cf3e5edcf["types.js"]
  9d7f3d0b_1959_a3f3_e24e_821787aa2f54 --> 98e7cbed_f4b4_9f35_838e_6e7cf3e5edcf
  a492fbd6_4e1c_c19f_6b2f_72218f3abe3f["ProfilerStore"]
  9d7f3d0b_1959_a3f3_e24e_821787aa2f54 --> a492fbd6_4e1c_c19f_6b2f_72218f3abe3f
  54e7a598_e83a_4b14_3104_1fa62a034c31["CommitFlamegraph.js"]
  54e7a598_e83a_4b14_3104_1fa62a034c31 --> 9d7f3d0b_1959_a3f3_e24e_821787aa2f54
  6d32cfc6_78ff_92b2_0a33_092cde10d395["CommitFlamegraphListItem.js"]
  6d32cfc6_78ff_92b2_0a33_092cde10d395 --> 9d7f3d0b_1959_a3f3_e24e_821787aa2f54
  38d38257_86b3_3154_4c21_7fbaf41be1cb["HoveredFiberInfo.js"]
  38d38257_86b3_3154_4c21_7fbaf41be1cb --> 9d7f3d0b_1959_a3f3_e24e_821787aa2f54
  style 9d7f3d0b_1959_a3f3_e24e_821787aa2f54 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

import {formatDuration} from './utils';
import ProfilerStore from 'react-devtools-shared/src/devtools/ProfilerStore';

import type {CommitTree} from './types';

export type ChartNode = {
  actualDuration: number,
  didRender: boolean,
  id: number,
  label: string,
  name: string,
  offset: number,
  selfDuration: number,
  treeBaseDuration: number,
};

export type ChartData = {
  baseDuration: number,
  depth: number,
  idToDepthMap: Map<number, number>,
  maxSelfDuration: number,
  renderPathNodes: Set<number>,
  rows: Array<Array<ChartNode>>,
};

const cachedChartData: Map<string, ChartData> = new Map();

export function getChartData({
  commitIndex,
  commitTree,
  profilerStore,
  rootID,
}: {
  commitIndex: number,
  commitTree: CommitTree,
  profilerStore: ProfilerStore,
  rootID: number,
}): ChartData {
  const commitDatum = profilerStore.getCommitData(rootID, commitIndex);

  const {fiberActualDurations, fiberSelfDurations} = commitDatum;
  const {nodes} = commitTree;

  const chartDataKey = `${rootID}-${commitIndex}`;
  if (cachedChartData.has(chartDataKey)) {
    return ((cachedChartData.get(chartDataKey): any): ChartData);
  }

  const idToDepthMap: Map<number, number> = new Map();
  const renderPathNodes: Set<number> = new Set();
  const rows: Array<Array<ChartNode>> = [];
// ... (141 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does FlamegraphChartBuilder.js do?
FlamegraphChartBuilder.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in FlamegraphChartBuilder.js?
FlamegraphChartBuilder.js defines 2 function(s): getChartData, invalidateChartData.
What does FlamegraphChartBuilder.js depend on?
FlamegraphChartBuilder.js imports 3 module(s): ProfilerStore, types.js, utils.js.
What files import FlamegraphChartBuilder.js?
FlamegraphChartBuilder.js is imported by 3 file(s): CommitFlamegraph.js, CommitFlamegraphListItem.js, HoveredFiberInfo.js.
Where is FlamegraphChartBuilder.js in the architecture?
FlamegraphChartBuilder.js is located at packages/react-devtools-shared/src/devtools/views/Profiler/FlamegraphChartBuilder.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/devtools/views/Profiler).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free