moar profile viewer - help

The moar profile viewer, available at https://moar-things.github.io/moar-profile-viewer , can be used to view v8 CPU profiles generated for Node.js applications.

For more information and background on v8 CPU profiles, see the article Speed Up JavaScript Execution .

generating a cpu profile file

The following tools can be used to generate a v8 CPU profile for Node.js:

Most tools generate CPU profile files with a file extension of .cpuprofile . Once you have a CPU profile file, you can view it by visiting https://moar-things.github.io/moar-profile-viewer . You can either drag the file onto the web page, or load it from an input button on the page.

There are a few .cpuprofile files available in the moar-profile-viewer repository in the test/fixtures directory . You probably want to try the "real life" on of a run of npm update, which you can download via this link: npm-update.moar.cpuprofile .

anatomy of moar profile viewer

Below is the web page with a profile loaded.

The page is split into three panes:

When you click on a function in any of the three panes, the top pane will scroll to that function, and highlight it in purple to indicate that it's the currently selected function. Other functions in the top pane will be colored green or yellow if the selected function is called by the function (green) or calls the function (yellow).

The bottom panes will be updated to show relevant information for the selected function. Functions which are called by, or that call the selected function, will be shown in the top pane with a yellow highlight.

The source code in the bottom right pane is annotated with blue and red lines and bubbles. The blue lines and bubbles indicate functions which are listed in the top pane. The red lines and bubbles are lines within a function which the profile recorded statistics for.

To load a CPU profile from within this page, click the file upload button shown at A, which will prompt you for a file to load. Or you can drag and drop a file onto the web page.

You can "zoom" into a pane (hiding the other panes) by clicking the "zoom buttons" shown at B.

Information about your Node.js process is shown on the line at C. This information is only available with profiles generated with moar-profiler.

Functions in the top pane can be sorted by total time or self time, by clicking the respective buttons at D.

By default, only functions shown in "user" code is displayed. "User" code is code not shipped with the Node.js runtime; eg, the built-in modules fs, path, etc, are not "user" code. You can change to show all code, or back to just "user" code, by clicking the respective buttons at E.

The "link" image beside package names, shown at F, will open that package's page at npmjs.org, when clicked.

Where functions are shown in the bottom panes, they can be clicked to change the page to show information about that function. Examples are shown at G.

frequently asked questions

need moar help?

If you are having problems using the moar-profiler tool or the moar profile viewer web page, consider opening an issue at GitHub on the respective repository: