Git Product home page Git Product logo

flame-chart-observations's Introduction

Chrome's Flame Chart

Chrome has a new debugging tool: a flame chart in the Javascript profiler. Unlike the existing Javascript profiler view in Chrome, the flame chart tells you when a function was running, not just how long it took.

The flame chart produces many numbers, what do they mean?

Sample flame chart

The flame chart is a sample-based profiler:

  • It collects samples from the V8 profiler (through WebKit).
  • Interpolates a stack time-series based on those samples.

These samples are taken approximately once every millisecond. The flame chart interpolates these samples and assumes if the program is in the same place as the last sample then the program was in that place the whole time.

Programs with small, fast function calls may have incomplete charts; but in general the stack charts are fairly accurate.

The Numbers

Hover over any function call to get a pop-up with several key numbers.

Flame chart showing function call numbers

This is the pop-up for the "run100d" call. In this program, the run100a,b,c,d functions are designed to run for exactly 200ms. run100d calls run100, a busy loop polling window.performance.now(), twice.

  • Name: The function name.
  • Self time: The number of samples where run100d was the top frame.
  • Total time: The number of samples where run100d was in the stack.
  • Aggregated self time: The time the program was executing this stack and run100d was the top frame.
  • Aggregated total time: The time the program was executing this stack.

Of the four numbers, "Aggregated total time" is the most useful. In my sample program, run100d is only ever called once, so the "Aggregated total time" is the actual time spent in run100d.

run100d calls run100 twice, the aggregated numbers for run100 will include all calls (two) to run100 from run100d. The aggregated numbers for run100 called from run100c will be different.

The "self time" and total time" are misreported. Although they claim to be milliseconds, they are actually the number of samples observed by the flame chart.

Sampling

The flame chart takes a sample approximately every millisecond. In practice the rate is ~1.05ms

To measure this, I created 10 busy loop functions, one for each 1/10 of a millisecond. The flame chart shows that the sample point drifts by ~ 0.05ms per millisecond.

See sample_rate.html for the test.

Sampling rate drifts

flame-chart-observations's People

Contributors

jbdeboer avatar

Stargazers

jiangplus avatar Waldir Pimenta avatar Larry Zhao avatar Mani Wang avatar Air avatar Sean.J avatar Zhao Lei avatar Pooky avatar rechie avatar  avatar 无止休 avatar Jared Williams avatar April Johnson avatar Pascal Hartig avatar Umar Hansa avatar

Watchers

 avatar James Cloos avatar rechie avatar

Forkers

acelan86 qeegeek

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.