2013-06-29 5 views
2

test.js node.js 프로필 출력 해석?

function test(){ 
    for(var i=0; i<2000000000; ++i); 
}; 
test(); 

명령은 프로파일하곤

node --prof test.js 
nprof 

출력 :

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 

내가 [스크립트]의 "시험"기능을 표시하는 것이 기대되었다 부품. 왜 거기에 없습니까?

+0

노드의 버전은 무엇입니까? 0.8.2를 사용하면 (예를 들어) 프로그램을 사용하여 예상 한 결과를 얻을 수 있으며 게시물에 표시되는 내용과 다를 수도 있습니다. 내 결과는 다음과 같습니다. http://pastebin.com/embed_js.php?i=mztwZLfd – Joe

+0

@Joe, 0.8.2. OSX에서 작성한 것입니다. 기묘한. – MaiaVictor

답변

2

nprof은 내가 (노드 0.8.2 AFAIK와 현재 호환) node-tick에서 같은 issue가 있어요

을 가지고있는 다른 v8.log 형식에 대한 틱 프로세서를 사용합니다.

가능한 해결책 :

또는 당신은 당신의 노드 버전에서 스크립트 nprof 다시 시도 할 수 있습니다 :

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