本文介绍了具有--prof选项的节点可创建多个日志文件,而不是一个v8.log的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用"--prof"选项对我的Node应用程序进行配置文件,但是我看到,不是一个单独的v8.log文件,而是创建了多个文件,这些文件的前缀都带有isolate-0x9582b40-v8.log,isolate-0xa1cab78-v8-6049.log,isolate-0xa7ffb40-v8.log,isolate-0xb5900468-v8.log,isolate-0xb6200468-v8-6049.log.

I am trying to profile my Node app with "--prof" option but I see that instead of one single v8.log file there are multiple files created with prefix like isolate-0x9582b40-v8.log, isolate-0xa1cab78-v8-6049.log, isolate-0xa7ffb40-v8.log, isolate-0xb5900468-v8.log, isolate-0xb6200468-v8-6049.log .

由于我不知道要使用哪个文件进行处理,因此我很难用Linux-tick-processor处理此文件.

I am having difficulty processing this files with Linux-tick-processor as I don't know which file to use for processing.

我在Vm VirtualBox上使用以下配置Ubuntu 12.4 Lts运行.节点版本0.12.0

I am running with following config Ubuntu 12.4 Lts on Vm VirtualBox. Node version 0.12.0

uname -a的输出

Output of uname -a

Linux ubuntu 3.8.0-44-generic#66〜precise1-Ubuntu SMP Tue Jul 15 04:04:23 UTC 2014 i686 i686 i386 GNU/Linux

Linux ubuntu 3.8.0-44-generic #66~precise1-Ubuntu SMP Tue Jul 15 04:04:23 UTC 2014 i686 i686 i386 GNU/Linux

节点-v的输出

v0.12.0

推荐答案

在这个聚会上我来晚了,但是如果您像这样调用事件探查器:

I'm late to the party on this one, but if you invoke the profiler like this:

node --prof --no-logfile-per-isolate example.js

您将获得一个名为 v8.log 的文件.然后,您可以执行以下操作:

You will get a single file called v8.log. Then you can do stuff like this:

node --prof --no-logfile-per-isolate example.js && node --prof-process v8.log > example.v8log.txt

注意:这将产生一个输出文件,因此,如果每个隔离需要一个文件,则可以使用-logfile 选项:

Note: this will result in a single output file, so if you need a file per isolate, you can use the --logfile option:

node --prof --logfile=foo.log example.js

这仍将十六进制隔离标识符放在文件名中,但附加您使用-logfile 选项提供的值,从而导致文件如下所示: isolate-0x103801e00-foo.log isolate-0x104000000-foo.log 等.

This will still put the hexadecimal isolate identifier in the file name, but append the value you provided with the --logfile option, resulting in file that look like this: isolate-0x103801e00-foo.log, isolate-0x104000000-foo.log and so on.

如果您不喜欢 v8.log 文件名,请组合-logfile -no-logfile-per-isolate 选项:

If you don't like the v8.log file name, combine the --logfile and --no-logfile-per-isolate options:

node --prof --logfile=foo.log --no-logfile-per-isolate example.js

这将导致一个名为 foo.log 的文件.

This will result in a single file called foo.log.

HTH.享受吧!

-jsp

这篇关于具有--prof选项的节点可创建多个日志文件,而不是一个v8.log的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 06:58