加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

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

发布时间:2020-12-15 21:44:04 所属栏目:大数据 来源:网络整理
导读:首先,我从命令行导出PERL5OPT = -d:NYTProf,以便子进程继承我的调试选项.然后我启动我的Perl程序联系.它分叉成为一个守护进程,然后fork / execs另一个Perl程序的九个实例table_manager. (exec看起来像exec / path / to / perl / path / to / table_manager.
首先,我从命令行导出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.

问候,

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读