I am currently profiling my node.js application.I found this blog: http://blog.nodejs.org/2012/04/25/profiling-node-js/ that suggests I should use Dtrace. I installed dtrace on ubuntu 12.04 using steps given here: https://askubuntu.com/questions/60940/how-do-i-install-dtrace

However when I run this command in my terminal while my node application is running:

dtrace -o stacks.out -n 'profile-97/execname == "node" && arg1/{
@[jstack(100, 8000)] = count(); } tick-60s { exit(0); }'

stacks.out remains blank except this: CPU ID FUNCTION:NAME 1 387695 :tick-60s

Any suggestions what might be wrong?

有帮助吗?

解决方案

The Linux DTrace implementations are currently very young and missing a number of important features (and are not in any way ready for production use). Specifically the DTrace implementation you are using (Paul Fox's) has not done much if any work to support userspace tracing. So you will not be able to do this under Linux (right now).

If you want to get this to work you will need to use an operating system with a more complete implementation of DTrace. You're best bet is to use one of the Illumos derivatives (such as OmniOS, SmartOS or OpenIndiana).

You should re-read the 'prerequisites' section of the the article you linked to. It states that you also need to make sure you use 32bit NodeJS with DTrace support turned on at compile time.

(Mac OS X does have a good DTrace implementation, but according to the article it does not support ustack helpers which are needed for this example.)

其他提示

@psanford has a good answer specifically involving your issues with DTrace, but from your opening sentence, it looks like what you want is to be able to trace your Node.js app, and DTrace was just one example on how to do so.

In that case, a combination of node-inspector and v8-profiler would provide you with the desired introspection into your application. I'm not sure if it works with Node 0.6.x, however, since the last time I used it was with 0.4.10.

Oracle announced DTrace availability on Oracle Linux. You can download this distro here.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top