I have installed Node.js on an Ubuntu 64bit server using a standard apt-get and would like to profile scripts through the "--prof" flag. Web searching shows there should be a tool to process the v8.log output located in "deps/v8/tools/linux-tick-processor" but I don't seem to have any of those directories. Do they come with the native install? should they be installed separately? if so how? Thank you
You need to download the source package with sudo apt-get source nodejs
.The path you mentioned is in there.
You'll need to scons prof=on d8
in deps/v8 to build the debugger first, which might have some trouble on a 64-bit machine (v8 is 32-bit only), see here for more info.
Here's how I did it for Node.js 0.10.25 and 0.10.26:
I downloaded the source for Node.js that corresponds to the binaries I'm using. (I'm on Debian testing, which is a bit behind the releases from the Node.js web site.)
I checked the version of v8 bundled in the node sources. (Look at deps/v8/ChangeLog
. It was 3.14.5 for Node.js 0.10.25 and 0.10.26.)
I downloaded this exact version of v8 from the v8 site.
Why? I tried running make native
in Node.js deps/v8
directory but the Makefile
was complaining about a missing test directory. From this we can infer that the Node developers are not including the entire v8 distribution. Once upon a time, with an earlier version of Node (0.8.something) I did build v8 from what was available in deps/v8
but this time I decided to use a different approach.
As explained in v8's build/README.txt
, in the top level of the source tree for v8, I did:
$ svn co http://gyp.googlecode.com/svn/trunk build/gyp
(Linking my installed gyp
to build/gyp
as suggested in OrangeDog's answer did not work. That's why I did the above.)
I ran:
$ CXX=g++-4.7 make native
Why the CXX
setting? I ran into a compilation problem right away when I tried with the default gcc. I checked the version. It was 4.8 and I remembered a story on Slashdot about how 4.8 was giving people trouble. So I installed 4.7. Worked fine.
I linked out/native/d8
to a location which is in my PATH
. This is because the linux-tick-processor
script does a poor job at finding d8
. The simplest solution was to make it available in my PATH
. Your mileage may vary.
After all this, linux-tick-processor
can be used with the v8.log
files that Node produces.
Either install the source package - sudo apt-get source nodejs
, or switch to the official source as the ubuntu packages are very out of date.
To build d8, go to the deps/v8
directory.
build/gyp
to the directory where gyp
can be found (e.g. /usr/bin
).make native
.out/native/d8
to somewhere on your PATH.