gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 20:47:29 24 4
gpt4 key购买 nike

首先我export PERL5OPT=-d:NYTProf从命令行,以便我的调试选项将由子进程继承。然后我启动我的 Perl 程序 已联系 .它 fork 成为一个守护进程,然后 fork/execs 另一个 Perl 程序的九个实例, table_manager . (exec 看起来像 exec /path/to/perl /path/to/table_manager 。)此时我可以看到 10 或 11 个名为 的新文件。 nytprof.out.nnnn ;正如预期的那样,到目前为止已经 fork 的每个进程都有一个。

客户端连接到 已联系 哪个 fork/execs 奴隶 ,它依次连接到九个表管理器并接受来自客户端的请求并将它们传递给九个表管理器。

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

当 HTML 报告打开时,除了 之外,我没有看到任何其他内容。已联系 .顶层子程序多为BEGIN块,进口 , 自动加载 ...早期执行的东西。

这让我认为 NYTPROF 正在经历一个分支(基于多个 nytprof.out 文件)但由于某种原因没有继续分析 执行 'ed Perl 程序。

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

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

最佳答案

您可以将 fork 深度变量设置为 -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 - 在 fork/execs 的程序上使用 Devel::NYTProf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15059165/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com