Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Mr. Muskrat (4572)

Mr. Muskrat
  reversethis-{moc ... ta} {tarksum.rm}

I'm married with 2 girls. I work as a full time Perl programmer for a Land Mobile Radio company in the Dallas/Fort Worth area.

I am enrolled at the Art Institute of Pittsburgh - Online working towards a Bachelor of Science in photography.

My other blog [blogspot.com]

Journal of Mr. Muskrat (4572)

Friday August 08, 2008
02:25 PM

Profiling CGI Scripts with Devel::NYTProf

[ #37134 ]

If you have not seen Devel::NYTProf yet then you must be living under a rock. I installed it on one of our development servers at work today (after watching the OSCON presentation. I have not had a chance to use it much but I am already deeply in love!

So I was reading through the docs and thinking "it works with mod_perl but what about normal CGI scripts?" Nothing that I have read indicated that it could not be done so I edited my Apache config to add the following (and restarted Apache of course):

SetEnv PERL5OPT -d:NYTProf
SetEnv NYTPROF=file=/tmp/nytprof.out

I then accessed one of our CGI scripts and went to /tmp to create the HTML. However nytprof.out was not there. In its place was nytprof.out=!

So I changed the second line to be (and restarted Apache):

SetEnv NYTPROF=file=/tmp/nytprof.out:

Yep, that second line really ends with a colon.

I hit the same CGI script and looked in /tmp. Yep, nytprof.out was there. Yay! (But I get "Unknown option:" in my error log.)

I think that I need to file a bug report (but have not yet because I do not know if it is an Apache bug, a Devel::NYTProf bug or simply user error). What do you think?

My next step was to run nytprofhtml.

[mmusgrove@somebox tmp]$ nytprofhtml
Generating report...
Unable to open '/long/path/to/cgi-bin/security/Parser.yp' for reading: No such file or directory. Try running /opt/misc/bin/nytprofhtml in the same directory as you ran Devel::NYTProf, or ensure @INC is correct.

I look in /long/path/to/cgi-bin/security and sure enough there is not a Parser.yp file. The good news is that (most of) the HTML files were generated. *drool* They are absolutely gorgeous!

I pull up the index.html file in Firefox and scroll down a bit. What do I see but:

230    0.00431    0.00002    line . block . sub    /long/path/to/cgi-bin/security/Parser.yp

I click on "line" and everything shown is from Template::Grammar.

28    1    1    0.00033    0.00033    Template::Grammar::    __ANON__[Parser.yp:72]

I do not particularly care that I cannot drop down into the guts of Parser.yp. Yet I still cannot help but wonder if it is a bug in Devel::NYTProf or simply a by-product of how I got the profiling done... Anyone have any ideas?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.