Reputation: 52957
test.js
function test(){
for(var i=0; i<2000000000; ++i);
};
test();
Commands used to profile it:
node --prof test.js
nprof
Output:
line 249: unknown code state: undefined
line 252: unknown code state: undefined
line 253: unknown code state: undefined
line 256: unknown code state: undefined
line 258: unknown code state: undefined
line 259: unknown code state: undefined
line 260: unknown code state: undefined
line 261: unknown code state: undefined
line 262: unknown code state: undefined
line 263: unknown code state: undefined
line 264: unknown code state: undefined
line 265: unknown code state: undefined
line 266: unknown code state: undefined
(This repeats around 1000 times. I'm removing it from this paste...)
[Unknown]:
ticks total nonlib name
34 79.1%
[Shared libraries]:
ticks total nonlib name
8 18.6% 0.0% /usr/local/bin/node
1 2.3% 0.0% /usr/lib/system/libsystem_kernel.dylib
[JavaScript]:
ticks total nonlib name
[C++]:
ticks total nonlib name
[GC]:
ticks total nonlib name
0 0.0%
[Bottom up (heavy) profile]:
Note: percentage shows a share of a particular caller in the total
amount of its parent calls.
Callers occupying less than 2.0% are not shown.
ticks parent name
8 18.6% /usr/local/bin/node
1 2.3% /usr/lib/system/libsystem_kernel.dylib
I was expecting it to show the "test" function on the [JavaScript] part. Why it's not there?
Upvotes: 2
Views: 1672
Reputation: 25456
nprof uses tick processor for v8.log format different from what you have
I'm having the same issue in node-tick ( which is currently compatible with node 0.8.2 afaik ).
Possible solutions:
npm install [email protected]
)or you can try to rebuild nprof with scripts from your node version:
git clone https://github.com/bnoordhuis/node-profile
git clone https://github.com/joyent/node
cd node
git checkout v0.8.7-release # can't see tag for 0.8.2
cp deps/v8/tools/*.js ../node-profile/tools/v8
cd ../node-profile
sh tools/build-nprof
Upvotes: 2