[cgiapp] profiling

Rhesa Rozendaal perl at rhesa.com
Thu Nov 4 11:22:49 EDT 2010


On 11/04/2010 04:01 PM, William Bulley wrote:
> According to Rhesa Rozendaal<perl at rhesa.com>  on Thu, 11/04/10 at 10:58:
>>
>> These days you should be using Devel::NYTProf. It has an Apache plugin
>> that makes profiling web requests a breeze.
>
> Thanks!  I believe you refer to Devel::NYTProf::Apache which allows one to
> profile mod_perl applications.  But if I'm not using mod Perl, then what?

Yep, that's the one. Outside of mod_perl, you'd use regular 
Devel::NYTProf. How you'd pass the -d flag to the perl invocation likely 
depends on your web server.

I'd like to point out that profiling CGI::Application apps is pretty 
easy from the command line. Here's an example:

HTTP_HOST=www.example.com HTTP_WHATEVER=whatever perl -d:NYTProf 
your_instance_script.cgi some=cgi variables=here

That should be all on one line, or wrap it in a script, or whatever.

Yet another approach would be doing what ::Apache does: add calls to 
DB::enable_profile() and DB::_finish() at the appropriate place in your 
code.

rhesa




More information about the cgiapp mailing list