DBI::ProfileDumper::Apache - capture DBI profiling data from Apache/mod_perl
PerlSetEnv DBI_PROFILE 2/DBI::ProfileDumper::Apache
Under mod_perl2 RC5+ you'll need to also add:
PerlSetEnv DBI_PROFILE_APACHE_LOG_DIR /server_root/logs
OR add
PerlOptions +GlobalRequest
to the gobal config section you're about test with DBI::ProfileDumper::Apache. If you don't do this, you'll see messages in your error_log similar to:
DBI::ProfileDumper::Apache on_destroy failed: Global $r object is not available. Set: PerlOptions +GlobalRequest in httpd.conf at ..../DBI/ProfileDumper/Apache.pm line 144
Then restart your server. Access the code you wish to test using a web browser, then shutdown your server. This will create a set of dbi.prof.* files in your Apache log directory. Get a profiling report with dbiprof:
dbiprof /usr/local/apache/logs/dbi.prof.*
When you're ready to perform another profiling run, delete the old files
rm /usr/local/apache/logs/dbi.prof.*
PerlSetEnv DBI_PROFILE 2/DBI::ProfileDumper::Apache
If you want to use one of DBI::Profile's other Path settings, you can use a string like:
PerlSetEnv DBI_PROFILE 2/DBI::ProfileDumper::Apache
It's also possible to use this module by setting the Profile attribute of any DBI handle:
$dbh->{Profile} = "2/DBI::ProfileDumper::Apache";
See DBI::ProfileDumper for more possibilities.
DBI::ProfileDumper::Apache writing to /usr/local/apache/logs/dbi.prof.2619
Now you can use dbiprof to examine the data:
dbiprof /usr/local/apache/logs/dbi.prof.*
By passing dbiprof a list of all generated files, dbiprof will automatically merge them into one result set. You can also pass dbiprof sorting and querying options, see dbiprof for details.
rm /usr/local/apache/logs/dbi.prof.*
Then restart your server and get back to work.
$dbh->{Profile}->flush_to_disk() if $dbh->{Profile};
Calling "flush_to_disk()" will clear out the profile data and write it to disk. Put this someplace where it will run on every request, like a CleanupHandler, and your memory troubles should go away. Well, at least the ones caused by DBI::Profile anyway.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |