Devel::NYTProf::Apache - Profile mod_perl applications with Devel::NYTProf
# in your Apache config file with mod_perl installed PerlPassEnv NYTPROF PerlModule Devel::NYTProf::Apache
This module allows mod_perl applications to be profiled using Devel::NYTProf.
Devel::NYTProf
If the NYTPROF environment variable isn't set at the time Devel::NYTProf::Apache is loaded then Devel::NYTProf::Apache will issue a warning and default it to:
file=/tmp/nytprof.$$.out
See "ENVIRONMENT VARIABLES" in Devel::NYTProf for more details on the settings effected by this environment variable.
Try using PerlPassEnv so you can set the NYTPROF environment variable externally.
PerlPassEnv
Each profiled mod_perl process will need to have terminated before you can successfully read the profile data file. The simplest approach is to start the httpd, make some requests (e.g., 100 of the same request), then stop it and process the profile data.
Alternatively you could send a TERM signal to the httpd worker process to terminate that one process. The parent httpd process will start up another one for you ready for more profiling.
It's often a good idea to use just one child process when profiling, which you can do by setting the MaxClients to 1 in httpd.conf.
MaxClients
Using an IfDefine blocks lets you leave the profile configuration in place and enable it whenever it's needed by adding -D NYTPROF to the httpd startup command line.
IfDefine
-D NYTPROF
<IfDefine NYTPROF> MaxClients 1 PerlModule Devel::NYTProf::Apache </IfDefine>
Profiling mod_perl on Windows is not supported because NYTProf currently doesn't support threads.
Adam Kaplan, <akaplan at nytimes.com> Tim Bunce, http://www.tim.bunce.name and http://blog.timbunce.org Steve Peters, <steve at fisharerojo.org>
<akaplan at nytimes.com>
<steve at fisharerojo.org>
Copyright (C) 2008 by Adam Kaplan and The New York Times Company. Copyright (C) 2008 by Steve Peters. Copyright (C) 2008 by Tim Bunce.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
To install Devel::NYTProf, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Devel::NYTProf
CPAN shell
perl -MCPAN -e shell install Devel::NYTProf
For more information on module installation, please visit the detailed CPAN module installation guide.