Using Devel :: NYTProf in a program that fork / execs

First, I’m export PERL5OPT=-d:NYTProffrom the command line so that my debugging option is inherited by child processes. Then I run my Perl contactd program . It forks to become a daemon process, and then fork / execs nine instances of another Perl program, table_manager . (Exec looks something like this exec /path/to/perl /path/to/table_manager.) At this point, I can see 10 or 11 new files called nytprof.out.nnnn ; one for each process that has been hacked so far, as expected.

Clients connect to the contact , which is fork / execs slave , which, in turn, connects to nine table managers and receives requests from the client and passes them to nine table managers,

After starting a typical client connection, I terminate all server processes. I run nytprofmerge to combine the various nytprof.out.nnnn files into nytprof-merged.out and then run nytprofhtml -f nytprof-merged.out --open.. p>

When an HTML report opens, I see nothing but contactd . The main routines are mainly BEGIN blocks, import , AUTOLOAD ... material of early execution.

This makes me think that NYTPROF is sorting a fork (based on several nytprof.out files), but for some reason does not continue to profile Perl exec programs .

I am running perl 5.16.1 and the last Devel :: NYTProf, on MacOSX 10.8.2.

Any suggestions on what I haven't done yet?

+5
source share
2 answers

You can set the fork depth variable to -1:

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

forkdepth = N

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

forkdepth , forkdepth .

forkdepth -1 ( ), , .

,

+3

AFAIU nytprof.out . addpid = 1, nytprof.out.nnnn .

0

All Articles