我有以下nodejs代码
var profiler = require("v8-profiler");
profiler.startProfiling("FooBar");
doSomethingAsync(function() {
profiler.stopProfiling("FooBar");
});
我运行这个:
$ time node --prof --prof_lazy test/performance/performance-test.js
但是我没有得到 v8.log 文件。
我在使用 node-profiler安装与此问题相关的 v8-profiler 软件包时确实遇到了一些问题。我使用 MacPorts,而 g++ 默认为 /opt/local/bin/g++(我也使用 MacPorts 提供的 nodejs 包)我设法通过使用 XCode 附带的 g++ 解决了 -arch 错误
$ CXX="xcrun g++" npm install v8-profiler
这可能是一个红鲱鱼,但值得一提的是,生成的 v8-profiler 二进制对象不适用于我的 nodejs 安装。
$ node --version
v0.10.22
$ npm --version
1.3.15