perl – 在fork / execs的程序上使用Devel :: NYTProf

前端之家收集整理的这篇文章主要介绍了perl – 在fork / execs的程序上使用Devel :: NYTProf前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
首先,我从命令行导出PERL5OPT = -d:NYTProf,以便子进程继承我的调试选项.然后我启动我的Perl程序联系.它分叉成为一个守护进程,然后fork / execs另一个Perl程序的九个实例table_manager. (exec看起来像exec / path / to / perl / path / to / table_manager.)此时我可以看到10或11个名为nytprof.out.nnnn的新文件;正如预期的那样,现在已经分叉的每个进程都有一个.

客户端连接到contactd fork / execs slave,后者又连接到九个表管理器并接受来自客户端的请求并将它们传递给九个表管理器.

运行典型的客户端连接后,我关闭所有服务器进程.我运行nytprofmerge将各种nytprof.out.nnnn文件合并到nytprof-merged.out中,然后运行nytprofhtml -f nytprof-merged.out –open.

HTML报告打开时,除了联系之外我什么也没看到.顶级子程序主要是BEGIN块,导入,AUTOLOAD ……早期执行的东西.

这让我认为NYTPROF正在跨越一个分支(基于多个nytprof.out文件),但由于某种原因,并没有继续描述exec的Perl程序.

我在MacOSX 10.8.2中运行perl 5.16.1和最新的Devel :: NYTProf.

关于我没做过的任何建议?

解决方法

您可以将fork depth变量设置为-1:

http://search.cpan.org/~timb/Devel-NYTProf-4.25/lib/Devel/NYTProf.pm#forkdepth=N

forkdepth=N

When a perl process that is being profiled executes a fork() the child
process is also profiled. The forkdepth option can be used to control
this. If forkdepth is zero then profiling will be disabled in the
child process.

If forkdepth is greater than zero then profiling will be enabled in
the child process and the forkdepth value in that process is
decremented by one.

If forkdepth is -1 (the default) then there’s no limit on the number
of generations of children that are profiled.

问候,

猜你在找的Perl相关文章