Skip to content

Profiling CPU usage

angelxuanchang edited this page Jan 13, 2018 · 1 revision

Node.js

Basic steps

  1. Run node --prof app.js to profile your program. It will output a isolate-0xnnnnnnnnnnnn-v8.log file.
  2. Run node --prof-process isolate-0xnnnnnnnnnnnn-v8.log > profile.txt to get a human readable interpretation of the profile log. The resulting profile.txt will have the following sections.
 [Shared libraries]
 [JavaScript]
 [C++]
 [Summary]
 [C++ entry points]
 [Bottom up (heavy) profile]
  1. Go to [Summary] To get an overall breakdown of CPU usage by Javascript/C++/GC/...

    Go to [JavaScript] or [C++] for the top CPU consuming functions

    Go to [Bottom up (heavy) profile] to get trace of callers for top CPU consuming functions

See https://nodejs.org/en/docs/guides/simple-profiling/ for more details.

Clone this wiki locally