从 ng start 启用 v8 profiler 的启动节点
Starting node with v8 profiler enabled from ng start
在开发模式下启动我的应用程序时,我看到 CPU 的 50% 被 node 可执行文件使用。我想知道这是否与我的代码有关或与 node 的工作方式有关。
我在这里找到了对类似问题的很好的回答:
how to debug node.js causing 100% cpu usage?
但是我无法按照指示的步骤进行操作,因为我正在使用 angular 进行开发,并且 angular 是由 运行 ng serve
启动的。
ng serve
的文档在这里:https://angular.io/cli/serve 但我看不到任何可以向 node 发送附加参数的内容。更重要的是,如果我尝试执行 ng serve --prof
则会生成错误。
为了分析 node.js 的执行情况,我还能做什么?
感谢您的宝贵时间
使用 ng
脚本的路径作为 node
二进制文件的参数,如下所示:
node --prof ./node_modules/@angular/cli/bin/ng serve
在开发模式下启动我的应用程序时,我看到 CPU 的 50% 被 node 可执行文件使用。我想知道这是否与我的代码有关或与 node 的工作方式有关。
我在这里找到了对类似问题的很好的回答: how to debug node.js causing 100% cpu usage?
但是我无法按照指示的步骤进行操作,因为我正在使用 angular 进行开发,并且 angular 是由 运行 ng serve
启动的。
ng serve
的文档在这里:https://angular.io/cli/serve 但我看不到任何可以向 node 发送附加参数的内容。更重要的是,如果我尝试执行 ng serve --prof
则会生成错误。
为了分析 node.js 的执行情况,我还能做什么?
感谢您的宝贵时间
使用 ng
脚本的路径作为 node
二进制文件的参数,如下所示:
node --prof ./node_modules/@angular/cli/bin/ng serve