Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
I'm trying to profile a program than forks about 100 times.

Unfortunately when I run the profiler with:

perl -d:DProf my_forking_program.pl

I only see what happened in the parent process - is there a way to profile the child processes as well?

Thanks

Nige

edited: (neophyte) removed pre-tags

Replies are listed 'Best First'.
Re: DProf and forked processes
by Anonymous Monk on Oct 31, 2001 at 19:28 UTC
    I only started using Perl today :-) so if I'm wrong
    I apologise for wasting your time.
    Would putting #!/usr/bin/perl -d:DProf at the top of my_forking_program.pl not help ?
    My Perl install would need to be recompiled with -DDEBUGGING for me to try it out.

    HTH

    Russelleee
Re: DProf and forked processes
by perrin (Chancellor) on Oct 31, 2001 at 21:51 UTC
    mod_perl does this in the Apache::DProf module. Unfortunately, I'm not certain how to do it without using C code. It might be as simple as changing where DProf is writing it's file. Try looking at the setting of PERL_DPROF_OUT_FILE_NAME (perldoc DProf). You might need to actually call some function within DProf to set this mid-stream.