Skip to content
Tutorials Center
My learning

Topics

Lesson 20 of 36 ยท Performance Panel

Recording and Reading the Flame Chart

Record a trace, zoom into the Main track, and learn to read a flame chart: call stacks, self time versus total time, Bottom-Up and the Call Tree.

A recording is only useful if you can read it. The heart of every trace is the flame chart in the Main track. It looks intimidating the first time (a skyline of colored bars), but it follows two simple rules that you can learn in ten minutes.

In this lesson you will record a trace properly, move around it efficiently, and learn to tell the difference between a function that is slow because of its own code and one that is slow because of the functions it calls.

Recording step by step

  1. Open the page in an Incognito window and open DevTools on the Performance tab.
  2. Set CPU: 4x slowdown if you target mobile users.
  3. Click Record (or press Ctrl+E).
  4. Do exactly one thing: click the slow button, scroll the long list, or open the menu.
  5. Wait a moment for the work to finish, then click Stop.

For load performance use Record and reload (Ctrl+Shift+E) instead. DevTools starts recording, reloads the page and stops a few seconds after load.

Navigation helpers worth memorizing: scroll the mouse wheel over the track to zoom (hold Ctrl on some setups), use W/A/S/D to zoom and pan, drag in the overview to select a time window, and click any bar to see its details in the summary drawer.

How a flame chart works

The Main track draws every function call as a horizontal bar.

  • The x axis is time. A wide bar is a long call.
  • The y axis is the call stack. The bar on top of another bar was called by it. The bottom bar of each stack is the task the browser started, such as "Event: click" or "Run Microtasks".

So you read it from the bottom up: the click handler called render(), which called buildRows(), which called Array.sort. A wide, flat top edge, with lots of short calls on top of each other, usually indicates many small calls. A single wide bar at the top of a tall tower is a function doing heavy work itself.

Tasks that take more than 50 ms get a red triangle in the corner and a red hatched bar. These are the long tasks you will hunt in lesson 4 of this chapter.

Self time and total time

Two numbers describe every function:

  • Total time: the entire width of its bar, including everything it called.
  • Self time: the part of the width not covered by calls on top of it, that is, time spent in the function's own code.

If you want to speed something up, self time tells you where the work happens. A function with huge total time but tiny self time is only a messenger; the real cost is in its children. The Bottom-Up tab sorts by self time, which is why it points straight at the hot spot, while the Call Tree sorts by total time starting from the root, which tells you which user-visible action is responsible.

Here is a stand-in that takes a list of trace events (start, duration, depth, name) and computes both numbers.

JS Stand-in: self time and total time from nested calls

Press Run (or Ctrl + Enter) to see the console output here.

No output.

You should see that onClick has a total time of 100 ms but a self time of only 10 ms, because its direct children buildRows (70 ms) and updateDom (20 ms) cover the rest. The big self-time winner is sort, at 40 ms. That is the function worth improving.

Printing the chart as text

A flame chart is easier to understand when you build one yourself. The next stand-in draws a text version from the same events: each depth is a row, and the bar length is the duration.

JS Stand-in: draw a tiny flame chart in text

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Run it and compare with what DevTools shows: the top row holds the leaf calls, the bottom row holds the entry point. That upside-down feeling, with the call stack growing upward, is the same in the browser.

Using the summary tabs

Select a range, such as one 200 ms task, then use the tabs below:

  • Summary shows how the range splits into Scripting, Rendering, Painting. A task that is mostly purple is a style or layout problem, not a JavaScript problem.
  • Bottom-Up: functions ranked by self time; expand a row to see who called it. Group by "Activity", "Domain" or "Third Party" to find out which script or vendor costs the most.
  • Call Tree: top-down from the task, ranked by total time. Good for "which feature is slow?".
  • Event Log: every event in time order with durations; useful for exact start times.

Click a function in any tab and DevTools shows the source location, and in many cases a link to open it in the Sources panel, where you can set breakpoints.

Practical habits

  • Search for your own bundle: the track shows function names; with source maps loaded, you see your original names.
  • Look first for long red-marked tasks, then for forced reflow warnings (a purple Layout event inside a yellow script block), then for repeated work.
  • Save traces with the download arrow (they are JSON files) to share with colleagues or compare before and after a fix.
  • Change one thing, record again, and compare numbers. Performance work without measurements is guessing.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. In the Main track flame chart, what does the y axis show?

    Bars higher up were called by the bars below them. The y axis is the call stack.
  2. 2. What is self time?

    Self time excludes time spent in callees. Total time includes it.
  3. 3. Which tab ranks functions by self time, pointing at the hot spot?

    Bottom-Up sorts by self time. The Call Tree sorts by total time from the root.
  4. 4. A task is drawn with a red triangle. What does that mean?

    Red marks flag long tasks, which block the main thread long enough to hurt responsiveness.

Summary

  • Record one focused action; use Record and reload for page load.
  • In the flame chart, width is time and height is call depth; read from the bottom up.
  • Self time shows where work really happens, total time shows who is responsible.
  • Bottom-Up finds hot functions, Call Tree finds slow features, Summary classifies the kind of work.
  • Save and compare traces before and after each change.

Next: Core Web Vitals in DevTools