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.

1 comment:

ruxkor said...

if running on a 64 bit machine, the building of the d8 shell should be run with 'arch=x84':

`scons -j4 d8 prof=on arch=x64`

(source: http://code.google.com/p/v8/issues/attachmentText?id=1532&aid=15320000000&name=0001-linux-tick-processor-detect-arch-before-building-d8.patch )