Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

dbix::profile(3) [debian man page]

Profile(3)						User Contributed Perl Documentation						Profile(3)

NAME
DBIx::Profile - DBI query profiler Version 1.0 Copyright (c) 1999,2000 Jeff Lathan, Kerry Clendinning. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SYNOPSIS
use DBIx::Profile; or "perl -MDBIx::Profile <program>" use DBI; $dbh->printProfile(); DESCRIPTION
DBIx::Profile is a quick and easy, and mostly transparent, profiler for scripts using DBI. It collects information on the query level, and keeps track of first, failed, normal, and total amounts (count, wall clock, CPU time) for each function on the query. NOTE: DBIx::Profile use Time::HiRes to clock the wall time and the old standby times() to clock the CPU time. The CPU time is pretty coarse. DBIx::Profile can also trace the execution of queries. It will print a timestamp and the query that was called. This is optional, and occurs only when the environment variable DBIXPROFILETRACE is set to 1. (ex: (bash) export DBIXPROFILETRACE=1). Not all DBI methods are profiled at this time. Except for replacing the existing "use" and "connect" statements, DBIx::Profile allows DBI functions to be called as usual on handles. Prints information to STDERR, prefaced with the pid. RECIPE
1) Add "use DBIx::Profile" or execute "perl -MDBIx::Profile <program>" 2) Optional: add $dbh->printProfile (will execute during disconnect otherwise) 3) Run code 4) Data output will happen at printProfile or $dbh->disconnect; METHODS
printProfile $dbh->printProfile(); Will print out the data collected. If this is not called before disconnect, disconnect will call printProfile. setLogFile $dbh->setLogFile("ProfileOutput.txt"); Will save all output to the file. AUTHORS
Jeff Lathan, lathan@pobox.com Kerry Clendinning, kerry@deja.com Aaron Lee, aaron@pointx.org Michael G Schwern, schwern@pobox.com SEE ALSO
L<perl(1)>, L<DBI> perl v5.8.0 2001-12-17 Profile(3)

Check Out this Related Man Page

DBI::ProfileDumper::Apache(3)				User Contributed Perl Documentation			     DBI::ProfileDumper::Apache(3)

NAME
DBI::ProfileDumper::Apache - capture DBI profiling data from Apache/mod_perl SYNOPSIS
Add this line to your httpd.conf: PerlSetEnv DBI_PROFILE DBI::ProfileDumper::Apache 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.* and start again. DESCRIPTION
This module interfaces DBI::ProfileDumper to Apache/mod_perl. Using this module you can collect profiling data from mod_perl applications. It works by creating a DBI::ProfileDumper data file for each Apache process. These files are created in your Apache log directory. You can then use dbiprof to analyze the profile files. USAGE
LOADING THE MODULE The easiest way to use this module is just to set the DBI_PROFILE environment variable in your httpd.conf: PerlSetEnv DBI_PROFILE 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} = "DBI::ProfileDumper::Apache"; See DBI::ProfileDumper for more possibilities. GATHERING PROFILE DATA Once you have the module loaded, use your application as you normally would. Stop the webserver when your tests are complete. Profile data files will be produced when Apache exits and you'll see something like this in your error_log: 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. CLEANING UP Once you've made some code changes, you're ready to start again. First, delete the old profile data files: rm /usr/local/apache/logs/dbi.prof.* Then restart your server and get back to work. MEMORY USAGE
DBI::Profile can use a lot of memory for very active applications. It collects profiling data in memory for each distinct query your application runs. You can avoid this problem with a call like this: $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. AUTHOR
Sam Tregar <sam@tregar.com> COPYRIGHT AND LICENSE
Copyright (C) 2002 Sam Tregar This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself. perl v5.8.0 2002-11-29 DBI::ProfileDumper::Apache(3)
Man Page