Saturday, January 21, 2012

Profiling node.js on linux

According to "Understanding V8" by Vyacheslav Egorov, you profile node applications like this:

% node --prof parser.js
806 ms
711.4267990074442 bytes/ms
% deps/v8/tools/mac-tick-processor

[GC]:
ticks total nonlib name
576 79.0%

However, I couldn't get the linux-tick-processor (in the same folder) to work:

% ~/Documents/node/deps/v8/tools/linux-tick-processor v8.log
d8 shell not found in .
To build, execute 'scons d8' from the V8 directory

I ran scons as instructed, but the command still wouldn't work. What I finally realized is that I need to run the command from the v8 folder:

% pwd
/home/iggames/Documents/node/deps/v8
% tools/linux-tick-processor ~/code/nodetest/v8.log


Lame, but it works.