Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

NYTProf doesn't profile through a system or exec call

by danialmagid (Sexton)
on Oct 21, 2013 at 17:54 UTC ( #1059149=perlquestion: print w/ replies, xml ) Need Help??
danialmagid has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

I have been using NYTProf either via the command line, or environment variables.

I have a perl script with the following lines:

@commands = qw( scriptB val1 val2 ); exec(@commands);

I'd like to have the code within scriptB profiled. Are there any arguments I can add, or some lines of code that will generate profile data for scriptB?

Thanks In Advance

Comment on NYTProf doesn't profile through a system or exec call
Download Code
Re: NYTProf doesn't profile through a system or exec call
by kennethk (Monsignor) on Oct 21, 2013 at 19:33 UTC

    Not to be obtuse, but is there a reason you can't just profile scriptB independently? You could do this either by directly invoking it w/ perl -d:NYTProf scriptB, or if it needs internal parameters from the script, like

    @commands = qw( perl -d:NYTProf scriptB val1 val2 ); exec(@commands);
    I'm pretty sure that you'll get erroneous results if you try to profile both simultaneously.

    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

      I'm pretty sure that you'll get erroneous results if you try to profile both simultaneously.

      But there's a simple solution to that: set the environment variable NYTPROF to addpid=1, then the profile for each process is written to a different file.

      Then one can either analyze each file separately with nytprofhtml -f nytprof.out.$PID, or run nytprofmerge -o nytprof.merged nytprof.out.*; nytprofhtml -f nytprof.merged to merge them all into one report.

      And to make sure that all perl processes are profiled, one can set the PERL5OPT environment variable to -d:NYTPProf.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1059149]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2014-12-25 03:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (159 votes), past polls