2012-12-25 88 views
0

我通過nvm安裝了node.js(0.9.4),它根據changelog具有systemtap支持。systemtap分析gc node.js

我在我的Fedora linux發行版上安裝了systemtap。

$ sudo yum install systemtap 

我使用了Ben Noordhuis的gist

$ stap -l 'process("node")' 

什麼都沒產生。

$ sudo stap gc.stp -c 'node test.js' 
semantic error: while resolving probe point: identifier 'process' at gc.stp:7:7 
     source: probe process("node").mark("gc__start") 
        ^

semantic error: no match 
semantic error: while resolving probe point: identifier 'process' at :12:7 
     source: probe process("node").mark("gc__done") 

我對systemtap沒有任何經驗,但喜歡玩它嗎?它有什麼可能?我可以看到代碼佔用了多少內存(http://stackoverflow.com/questions/13126808/whats-the-node-js-memory-breakdown)?


更新回答評論。

$ readelf -n node 

readelf: Error: 'node': No such file 

$ which node 
~/nvm/v0.9.4/bin/node 

$ readelf -n ~/nvm/v0.9.4/bin/node 

Notes at offset 0x0000021c with length 0x00000020: 
    Owner     Data size Description 
    GNU     0x00000010 NT_GNU_ABI_TAG (ABI version tag) 
    OS: Linux, ABI: 2.6.32 

Notes at offset 0x0000023c with length 0x00000024: 
    Owner     Data size Description 
    GNU     0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) 
    Build ID: 294da933883eaeaf7e848073dc3db6bff6762fb4 

$ uname -a 
[[email protected] gc-stap]$ uname -a 
Linux alfred81-AMILO-Pi-2515.lan 3.6.3-1.fc17.x86_64 #1 SMP Mon Oct 22 15:32:35 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux 

$ stap -V 
Systemtap translator/driver (version 2.0/0.154, rpm 2.0-1.fc17) 
Copyright (C) 2005-2012 Red Hat, Inc. and others 
This is free software; see the source for copying conditions. 
enabled features: AVAHI LIBRPM LIBSQLITE3 NSS TR1_UNORDERED_MAP NLS 
+0

嘗試'stap -l'進程(「節點」)。標記(「*」)'爲第一個查詢 - 或'readelf -n節點'。有可能是node.js的nvm副本是在沒有sys/sdt.h探針的情況下編譯的。 – fche

+0

此外,你可以識別內核和systemtap版本? – fche

+0

感謝您的幫助。查看最新信息的答案! – Alfred

回答

1

您的節點副本顯示爲編譯時沒有sys/sdt.h標記。如果他們在,readelf -n彙編會顯示類似...

stapsdt    0x00000040 NT_STAPSDT (SystemTap probe descriptors) 
    Provider: stap 
    Name: stap_system__spawn 
    Location: 0x000000000012e1b0, Base: 0x00000000001cb886, Semaphore: 0x0000000000000000 
    Arguments: [email protected]%ebx [email protected]%eax 

或許它配置了--without-的DTrace。