【发布时间】:2014-04-07 17:06:21
【问题描述】:
我有以下 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 文件。
我在安装与this issue with 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
【问题讨论】: