1DBI::ProfileDumper::ApaUcsheer(3C)ontributed Perl DocumeDnBtIa:t:iPornofileDumper::Apache(3)
2
3
4

NAME

6       DBI::ProfileDumper::Apache - capture DBI profiling data from
7       Apache/mod_perl
8

SYNOPSIS

10       Add this line to your httpd.conf:
11
12         PerlSetEnv DBI_PROFILE 2/DBI::ProfileDumper::Apache
13
14       Under mod_perl2 RC5+ you'll need to also add:
15
16         PerlSetEnv DBI_PROFILE_APACHE_LOG_DIR /server_root/logs
17
18       OR add
19
20         PerlOptions +GlobalRequest
21
22       to the gobal config section you're about test with DBI::Profile‐
23       Dumper::Apache.  If you don't do this, you'll see messages in your
24       error_log similar to:
25
26         DBI::ProfileDumper::Apache on_destroy failed: Global $r object is not available. Set:
27           PerlOptions +GlobalRequest in httpd.conf at ..../DBI/ProfileDumper/Apache.pm line 144
28
29       Then restart your server.  Access the code you wish to test using a web
30       browser, then shutdown your server.  This will create a set of
31       dbi.prof.* files in your Apache log directory.  Get a profiling report
32       with dbiprof:
33
34         dbiprof /usr/local/apache/logs/dbi.prof.*
35
36       When you're ready to perform another profiling run, delete the old
37       files
38
39         rm /usr/local/apache/logs/dbi.prof.*
40
41       and start again.
42

DESCRIPTION

44       This module interfaces DBI::ProfileDumper to Apache/mod_perl.  Using
45       this module you can collect profiling data from mod_perl applications.
46       It works by creating a DBI::ProfileDumper data file for each Apache
47       process.  These files are created in your Apache log directory.  You
48       can then use dbiprof to analyze the profile files.
49

USAGE

51       LOADING THE MODULE
52
53       The easiest way to use this module is just to set the DBI_PROFILE envi‐
54       ronment variable in your httpd.conf:
55
56         PerlSetEnv DBI_PROFILE 2/DBI::ProfileDumper::Apache
57
58       If you want to use one of DBI::Profile's other Path settings, you can
59       use a string like:
60
61         PerlSetEnv DBI_PROFILE 2/DBI::ProfileDumper::Apache
62
63       It's also possible to use this module by setting the Profile attribute
64       of any DBI handle:
65
66         $dbh->{Profile} = "2/DBI::ProfileDumper::Apache";
67
68       See DBI::ProfileDumper for more possibilities.
69
70       GATHERING PROFILE DATA
71
72       Once you have the module loaded, use your application as you normally
73       would.  Stop the webserver when your tests are complete.  Profile data
74       files will be produced when Apache exits and you'll see something like
75       this in your error_log:
76
77         DBI::ProfileDumper::Apache writing to /usr/local/apache/logs/dbi.prof.2619
78
79       Now you can use dbiprof to examine the data:
80
81         dbiprof /usr/local/apache/logs/dbi.prof.*
82
83       By passing dbiprof a list of all generated files, dbiprof will automat‐
84       ically merge them into one result set.  You can also pass dbiprof sort‐
85       ing and querying options, see dbiprof for details.
86
87       CLEANING UP
88
89       Once you've made some code changes, you're ready to start again.
90       First, delete the old profile data files:
91
92         rm /usr/local/apache/logs/dbi.prof.*
93
94       Then restart your server and get back to work.
95

MEMORY USAGE

97       DBI::Profile can use a lot of memory for very active applications.  It
98       collects profiling data in memory for each distinct query your applica‐
99       tion runs.  You can avoid this problem with a call like this:
100
101         $dbh->{Profile}->flush_to_disk() if $dbh->{Profile};
102
103       Calling "flush_to_disk()" will clear out the profile data and write it
104       to disk.  Put this someplace where it will run on every request, like a
105       CleanupHandler, and your memory troubles should go away.  Well, at
106       least the ones caused by DBI::Profile anyway.
107

AUTHOR

109       Sam Tregar <sam@tregar.com>
110
112       Copyright (C) 2002 Sam Tregar
113
114       This program is free software; you can redistribute it and/or modify it
115       under the same terms as Perl 5 itself.
116
117
118
119perl v5.8.8                       2006-02-07     DBI::ProfileDumper::Apache(3)
Impressum