You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Miles Crawford <mc...@u.washington.edu> on 2006/11/09 21:02:12 UTC

Apache::DProf giving empty tmon.out files

Heya,

I'm using Apache::DProf in an attempt to profile my application.  This has 
worked great for me in the past under Apache 1.3, but this is a new 
installation with Apache 2.  At first, I thought it was working great under 
apache2 as well - the dprof dir was created, the $$/tmon.out files were there. 
But then, I was saddened!

The trouble is the tmon files all contain nothing but:

#fOrTyTwO
$hz=100;
$XS_VERSION='DProf 20050603.00';
# All values are given in HZ
$over_utime=3; $over_stime=2; $over_rtime=6;
$over_tests=10000;


PART2

It's not actually profiling any code.  The Apache config looks like:

PerlModule Apache::DProf
PerlSwitches -I/home/mcrawfor/solstice/lib
PerlModule Solstice::Handler

<Location /tools/>
   SetHandler perl-script
   PerlResponseHandler Solstice::Handler
   ...(some irrelevant auth stuff)...
</Location>

So, I am loading DProf before my handlers...  any ideas?

Apache::DProf Version .08
Apache/2.0.55
mod_perl/2.0.2

Thanks,
-Miles


Re: Apache::DProf giving empty tmon.out files

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Perrin Harkins wrote:
> On Thu, 2006-11-09 at 12:29 -0800, Philip M. Gollucci wrote:
>> In 2.x its this:
>> http://search.cpan.org/~fwiles/Apache-DB-0.13/DB.pm
>>
>> use APR::Pool ();
>> use Apache::DB ();
>> Apache::DB->init();
> 
> Thanks Philip.  Any reason why it can't use APR::Pool for you in Apache
> 2?
You'd have to ask Stas/Frank -- I don't remember the reason but I remember their being one.


-- 
------------------------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

When I call your name, Girl, it starts to flame
Burning in my heart, Tearing it all apart..
No matter how I try My love I cannot hide....

Re: Apache::DProf giving empty tmon.out files

Posted by Frank Wiles <fr...@wiles.org>.
On Thu, 09 Nov 2006 15:42:46 -0500
Perrin Harkins <pe...@elem.com> wrote:

> On Thu, 2006-11-09 at 12:29 -0800, Philip M. Gollucci wrote:
> > In 2.x its this:
> > http://search.cpan.org/~fwiles/Apache-DB-0.13/DB.pm
> > 
> > use APR::Pool ();
> > use Apache::DB ();
> > Apache::DB->init();
> 
> Thanks Philip.  Any reason why it can't use APR::Pool for you in
> Apache 2?
> 
> - Perrin

   Actually it does now use APR::Pool for you in the code, I'm not sure
   if that is a docs mistake on my part or if there is some weirdness
   going on as to why you need to preload that. 

 ---------------------------------
   Frank Wiles <fr...@wiles.org>
   http://www.wiles.org
 ---------------------------------


Re: Apache::DProf giving empty tmon.out files

Posted by Perrin Harkins <pe...@elem.com>.
On Thu, 2006-11-09 at 12:29 -0800, Philip M. Gollucci wrote:
> In 2.x its this:
> http://search.cpan.org/~fwiles/Apache-DB-0.13/DB.pm
> 
> use APR::Pool ();
> use Apache::DB ();
> Apache::DB->init();

Thanks Philip.  Any reason why it can't use APR::Pool for you in Apache
2?

- Perrin


Re: Apache::DProf giving empty tmon.out files

Posted by Miles Crawford <mc...@u.washington.edu>.
Interesting idea - I seem to be able to write to them as the apache user 
though ;(  I'd never thought they were written half before and half after the 
permission drop.

-miles



On Thu, 9 Nov 2006, Perrin Harkins wrote:

> On Thu, 2006-11-09 at 13:56 -0800, Miles Crawford wrote:
>> It *is* writing to the directory - it writes little empty stub files that look
>> like this
>
> Sure, but maybe it writes those as root before forking.
>
> - Perrin
>
>

Re: Apache::DProf giving empty tmon.out files

Posted by Perrin Harkins <pe...@elem.com>.
On Thu, 2006-11-09 at 13:56 -0800, Miles Crawford wrote:
> It *is* writing to the directory - it writes little empty stub files that look 
> like this

Sure, but maybe it writes those as root before forking.

- Perrin


Re: Apache::DProf giving empty tmon.out files

Posted by Miles Crawford <mc...@u.washington.edu>.
It *is* writing to the directory - it writes little empty stub files that look 
like this:

#fOrTyTwO
$hz=100;
$XS_VERSION='DProf 20050603.00';
# All values are given in HZ
$over_utime=4; $over_stime=0; $over_rtime=3;
$over_tests=10000;
$rrun_utime=100; $rrun_stime=13; $rrun_rtime=3148;
$total_marks=2

PART2
& 2 APR::Pool DESTROY
+ 2
- 2
@ 100 13 3148


They just don't have any useful content.  Actually that APR::Pool DESTROY is 
new since I followed the advice from Phillip about the Apache::DB init call ;)

-miles



On Thu, 9 Nov 2006, Perrin Harkins wrote:

> On Thu, 2006-11-09 at 13:51 -0800, Miles Crawford wrote:
>> Any other ideas or things I could check that might help?
>
> Make sure that the user your server runs as (nobody?) can write to that
> directory.
>
> - Perrin
>
>

Re: Apache::DProf giving empty tmon.out files

Posted by Perrin Harkins <pe...@elem.com>.
On Thu, 2006-11-09 at 13:51 -0800, Miles Crawford wrote:
> Any other ideas or things I could check that might help?

Make sure that the user your server runs as (nobody?) can write to that
directory.

- Perrin


Re: Apache::DProf giving empty tmon.out files

Posted by Miles Crawford <mc...@u.washington.edu>.
Just to add closure to this thread, Philip was right on about the threading - 
the default mpm appears to be "worker" in the Ubuntu apache package.

As soon as I ran "apt-get apache2-mpm-prefork" it swapped out the mpm and my 
profiles were being filled out just as I had desired! ;)

So, it seems that threading confounds Apache::DProf, at least in my tests.

Thanks guys,
-Miles


On Thu, 9 Nov 2006, Philip M. Gollucci wrote:

> Miles Crawford wrote:
>> 
>> 
>> Hmm. Thanks for the hints guys, but it's still not working.
>> 
>> My config has this now:
>> 
>> PerlModule Apache::DProf
>> <Perl>
>>   use APR::Pool ();
>>   use Apache::DB ();
>>   Apache::DB->init();
>> </Perl>
> Are you using prefork or a threaded mpm(worker,event) ?
>
> I don't think I've tried it with threaded.
>
>
> -- 
> ------------------------------------------------------------------------
> Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
> Consultant / http://p6m7g8.net/Resume/resume.shtml
> Senior Software Engineer - TicketMaster - http://ticketmaster.com
> 1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F
>
> When I call your name, Girl, it starts to flame
> Burning in my heart, Tearing it all apart..
> No matter how I try My love I cannot hide....
>

Re: Apache::DProf giving empty tmon.out files

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Miles Crawford wrote:
> 
> 
> Hmm. Thanks for the hints guys, but it's still not working.
> 
> My config has this now:
> 
> PerlModule Apache::DProf
> <Perl>
>   use APR::Pool ();
>   use Apache::DB ();
>   Apache::DB->init();
> </Perl>
Are you using prefork or a threaded mpm(worker,event) ?

I don't think I've tried it with threaded.


-- 
------------------------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

When I call your name, Girl, it starts to flame
Burning in my heart, Tearing it all apart..
No matter how I try My love I cannot hide....

Re: Apache::DProf giving empty tmon.out files

Posted by Miles Crawford <mc...@u.washington.edu>.

Hmm. Thanks for the hints guys, but it's still not working.

My config has this now:

PerlModule Apache::DProf
<Perl>
   use APR::Pool ();
   use Apache::DB ();
   Apache::DB->init();
</Perl>

As you recommend, but the files are still totally empty.  I'm not checking 
them until I issue an "apache2ctl stop" and the threads are gone, either.

Any other ideas or things I could check that might help?

-Miles



On Thu, 9 Nov 2006, Philip M. Gollucci wrote:

>> I think it doesn't write these out until the child process shuts down.
>> Did you shut down your server?
> No it writes as you go -- just doesn't flush completely until child shutdown.
>> <Perl>
>>         require Apache::DB;
>>         Apache::DB->init;
>> </Perl>
> In 2.x its this:
> http://search.cpan.org/~fwiles/Apache-DB-0.13/DB.pm
>
> use APR::Pool ();
> use Apache::DB ();
> Apache::DB->init();
>
>
> -- 
> ------------------------------------------------------------------------
> Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
> Consultant / http://p6m7g8.net/Resume/resume.shtml
> Senior Software Engineer - TicketMaster - http://ticketmaster.com
> 1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F
>
> When I call your name, Girl, it starts to flame
> Burning in my heart, Tearing it all apart..
> No matter how I try My love I cannot hide....
>

Re: Apache::DProf giving empty tmon.out files

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
> I think it doesn't write these out until the child process shuts down.
> Did you shut down your server?
No it writes as you go -- just doesn't flush completely until child shutdown.
> <Perl>
>         require Apache::DB;
>         Apache::DB->init;
> </Perl>
In 2.x its this:
http://search.cpan.org/~fwiles/Apache-DB-0.13/DB.pm

use APR::Pool ();
use Apache::DB ();
Apache::DB->init();


-- 
------------------------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

When I call your name, Girl, it starts to flame
Burning in my heart, Tearing it all apart..
No matter how I try My love I cannot hide....

Re: Apache::DProf giving empty tmon.out files

Posted by Perrin Harkins <pe...@elem.com>.
On Thu, 2006-11-09 at 12:02 -0800, Miles Crawford wrote:
> The trouble is the tmon files all contain nothing but:
> 
> #fOrTyTwO
> $hz=100;
> $XS_VERSION='DProf 20050603.00';
> # All values are given in HZ
> $over_utime=3; $over_stime=2; $over_rtime=6;
> $over_tests=10000;

I think it doesn't write these out until the child process shuts down.
Did you shut down your server?

> It's not actually profiling any code.  The Apache config looks like:
> 
> PerlModule Apache::DProf
> PerlSwitches -I/home/mcrawfor/solstice/lib
> PerlModule Solstice::Handler

You'll need to init the debugger if you want it to profile things that
are loaded during startup.  Try adding this right after Apache::DProf:

<Perl>
        require Apache::DB;
        Apache::DB->init;
</Perl>

- Perrin


Re: Apache::DProf giving empty tmon.out files

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> Ok, just tried putting it in there, didn't seem to make any difference to
> the tmon output (naturally, checking after stopping the server). I had
> noticed a reference to APR::Pool in the tmon files before so I would have
> thought it was loading it in any case.

if you want to (again) try Devel::Profiler it's really as simple as adding

   use Devel::Profiler::Apache;

to your startup.pl.  see the t/conf/ files in the D::P (svn) 
distribution for a working example (assuming it passes the tests :)

you also need to start in single server mode or, alternatively, setting 
these

   MinSpareServers      1
   MaxSpareServers      1
   StartServers         1
   MaxClients           1
   MaxRequestsPerChild  0

at the bottom of your httpd.conf.  note also that you can set the output 
directory via

   Devel::Profiler::Apache->import(output_dir => $odir);

in your startup.pl.  see also

   http://use.perl.org/~geoff/journal/34562

for a list of packages to avoid.

lastly, it's been noted already, but in case you missed it, please note 
that you won't get any data until the child process exits (or httpd is 
shut down), so try killing off the child.

fwiw, I submitted a proposal for OSCon on profiling, specifically how we 
profile "a large mod_perl application" :)  hopefully the selection folks 
find it a worthy topic.

--Geoff

Re: Apache::DProf giving empty tmon.out files

Posted by Alx G <gl...@yahoo.co.uk>.

Perrin Harkins wrote:
> 
> On Jan 23, 2008 5:57 AM, Alx G <gl...@yahoo.co.uk> wrote:
>> #      PerlFixupHandler Apache::DB # tried this, just filled up my error
>> log
>> with very low-level mod_perl calls, page didn't load, nothing in tmon.out
>> (pages work fine without it)
> 
> That's how you run your code in the debugger.  You have to do it in
> non-forking mode and start httpd directly from a terminal.  Anyway,
> it's not a profiling tool.
> 
> 

Yeah I thought as much, but at that stage I was ready to try anything : )


Perrin Harkins wrote:
> 
> 
> I don't see you loading APR::Pool in your <Perl> section, as shown in the
> docs.
> 
> 

Ok, just tried putting it in there, didn't seem to make any difference to
the tmon output (naturally, checking after stopping the server). I had
noticed a reference to APR::Pool in the tmon files before so I would have
thought it was loading it in any case.

Worth a shot though.
-- 
View this message in context: http://www.nabble.com/Apache%3A%3ADProf-giving-empty-tmon.out-files-tp7265235p15045577.html
Sent from the mod_perl - General mailing list archive at Nabble.com.


Re: Apache::DProf giving empty tmon.out files

Posted by Perrin Harkins <pe...@elem.com>.
On Jan 23, 2008 5:57 AM, Alx G <gl...@yahoo.co.uk> wrote:
> #      PerlFixupHandler Apache::DB # tried this, just filled up my error log
> with very low-level mod_perl calls, page didn't load, nothing in tmon.out
> (pages work fine without it)

That's how you run your code in the debugger.  You have to do it in
non-forking mode and start httpd directly from a terminal.  Anyway,
it's not a profiling tool.

I don't see you loading APR::Pool in your <Perl> section, as shown in the docs.

- Perrin

Re: Apache::DProf giving empty tmon.out files

Posted by Alx G <gl...@yahoo.co.uk>.

Alx G wrote:
> 
> 
> I'm trying to use Apache::DProf with my Perl web app. I can't work out
> what I'm doing wrong - it should be working but it isn't (how many times
> have we all said that to ourselves eh?).
> 
> I've run out of options to try now, I hope someone can help me please.
> 
> ... <snip> ...
> 
> I tried with and without the commented stuff - as was suggested in this
> thread.
> 
> Apache is running in prefork, *not* worker mode (which was also pointed to
> as a possible culprit)
> 
> /usr/sbin/httpd -V :
> Server MPM:     Prefork
>     threaded:     no
>         forked:     yes (variable process count)
> 
> The tmon.out files *are*being created, by the apache user, but they don't
> contain any useful info. I've also tried running apache using the -X
> command to spawn no child processes.
> 
> I then hit a few different scripts in the browser and the most I ever see
> in those files, when shutting down apache is a reference to APR::Pool
> DESTROY and the usual stuff at the top, *but no other subroutine calls at
> all*.
> 
> 


Sincere thanks to everyone who has offered advice and suggestions, I've
still not quite managed to get it working - I feel like there's probably
something really obvious staring me in the face. 

As a last ditch effort I thought I'd post an abridged version of my current
apache config in the hope that someone spots something crazy.

---
ServerTokens OS
ServerRoot "/etc/httpd"
PidFile run/httpd.pid
Timeout 120
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 15

<IfModule prefork.c>
StartServers       8
MinSpareServers    5
MaxSpareServers   20
ServerLimit      256
MaxClients       256
MaxRequestsPerChild  4000
</IfModule>

Listen 80

... load various modules ...

LoadModule perl_module modules/mod_perl.so

<Perl>
    require Apache::DB;
    Apache::DB->init;
</Perl>

PerlModule Apache::DProf

Listen 8001
<VirtualHost "*:8001">
        DocumentRoot "/usr/local/myapp/htdocs"
        ErrorDocument 404 /cgi-bin/404handler.pl
        ErrorLog logs/myapp_error_log
        CustomLog logs/myapp_access_log combined
        PerlOptions +Parent
        PerlSwitches -I/usr/local/myapp/lib
</VirtualHost>

<Directory "/usr/local/myapp/htdocs">
        Order allow,deny
        Allow from all
</Directory>

<Directory /usr/local/myapp/htdocs/cgi-bin>
   <FilesMatch "\.pl$">
      SetEnv SYBASE /usr
      SetHandler perl-script
      PerlHandler ModPerl::PerlRun
#      PerlHandler ModPerl::RegistryPrefork # tried this also, no change
#      PerlFixupHandler Apache::DB # tried this, just filled up my error log
with very low-level mod_perl calls, page didn't load, nothing in tmon.out
(pages work fine without it)
      PerlOptions +ParseHeaders
      Options +ExecCGI
   </FilesMatch>
</Directory>

PerlModule Apache2::Reload
PerlInitHandler Apache2::Reload

... more misc config stuff ...
---

And this is the most I ever see in tmon.out:

---
#fOrTyTwO
$hz=100;
$XS_VERSION='DProf 20050603.00';
# All values are given in HZ
$over_utime=5; $over_stime=2; $over_rtime=17;
$over_tests=10000;
$rrun_utime=86; $rrun_stime=111; $rrun_rtime=2971;
$total_marks=2


PART2
@ 0 0 1
& 2 APR::Pool DESTROY
+ 2
- 2
@ 86 111 2970
---

Thanks again for your time.
-- 
View this message in context: http://www.nabble.com/Apache%3A%3ADProf-giving-empty-tmon.out-files-tp7265235p15039276.html
Sent from the mod_perl - General mailing list archive at Nabble.com.


Re: Apache::DProf giving empty tmon.out files

Posted by Perrin Harkins <pe...@elem.com>.
On Jan 21, 2008 7:26 AM, Alx G <gl...@yahoo.co.uk> wrote:
> Thanks for the tips John, however as I mentioned in my previous post, I did
> in fact try it with the DB->init call and it made no difference.

It will make a big difference, but it sounds like you have another
problem preventing you from getting to that point.

> Also, the
> tmon.out files *are* being created by the apache process so that's not an
> issue either.

This is worth double-checking.  Try becoming the user specified in
your httpd.conf and touch'ing these files.  Also, make sure you
actually shut down apache before you look at the files.  They may not
be written until you shut down.

- Perrin

Re: Apache::DProf giving empty tmon.out files

Posted by Alx G <gl...@yahoo.co.uk>.

Heiko Jansen wrote:
> 
> 
> Am Montag, den 21.01.2008, 06:19 -0800 schrieb Alx G:
> 
> ...
> 
>>  The code I'm running is just a collection of cgi scripts that hook
>> into the back-end libraries of the system, so the code is definitely
>> loaded
>> and run after the the DB->init and Dprof module.
> 
> But surely they're not run as plain old cgi?
> Sorry, just had to ask - sometimes I found out that it was the most
> obvious thing that I somehow forgot about...
> 
> Heiko
> 
> 

Sure, I appreciate your input Heiko. If I output the value of
$ENV{'mod_perl'} it shows mod_perl/2.0.2 (or something like that), so I
believe that shows it's not running as plain cgi.
-- 
View this message in context: http://www.nabble.com/Apache%3A%3ADProf-giving-empty-tmon.out-files-tp7265235p15000908.html
Sent from the mod_perl - General mailing list archive at Nabble.com.


Re: Apache::DProf giving empty tmon.out files

Posted by Heiko Jansen <ja...@hbz-nrw.de>.
Am Montag, den 21.01.2008, 06:19 -0800 schrieb Alx G:

> No worries. For the record, I just tried putting the DB->init before
> everything else (after loading mod_perl obviously) in the conf - no joy
> though.

The Apache::DB POD mentions using "use APR::Pool ();" right before "use
Apache::DB ();"

But I don't think that's the point, since there is at least some output
in the files.

>  The code I'm running is just a collection of cgi scripts that hook
> into the back-end libraries of the system, so the code is definitely loaded
> and run after the the DB->init and Dprof module.

But surely they're not run as plain old cgi?
Sorry, just had to ask - sometimes I found out that it was the most
obvious thing that I somehow forgot about...

Heiko



Re: Apache::DProf giving empty tmon.out files

Posted by Alx G <gl...@yahoo.co.uk>.

John ORourke wrote:
> 
> Alx G wrote:
>> Thanks for the tips John, however as I mentioned in my previous post, I
>> did
>> in fact try it with the DB->init call and it made no difference. Also,
>> the
>> tmon.out files *are* being created by the apache process so that's not an
>> issue either.
>>   
> 
> I misunderstood, sorry.  If you're getting just a few subroutine calls 
> recorded, then it seems like some perl modules are being loaded before 
> you run Apache::DB->init.  That was my problem anyway - I was loading my 
> code with a PerlModule directive before doing Apache::DB->init
> 
> cheers
> John
> 
> 
> 

No worries. For the record, I just tried putting the DB->init before
everything else (after loading mod_perl obviously) in the conf - no joy
though. The code I'm running is just a collection of cgi scripts that hook
into the back-end libraries of the system, so the code is definitely loaded
and run after the the DB->init and Dprof module.

-- 
View this message in context: http://www.nabble.com/Apache%3A%3ADProf-giving-empty-tmon.out-files-tp7265235p14998229.html
Sent from the mod_perl - General mailing list archive at Nabble.com.


Re: Apache::DProf giving empty tmon.out files

Posted by John ORourke <jo...@o-rourke.org>.
Alx G wrote:
> Thanks for the tips John, however as I mentioned in my previous post, I did
> in fact try it with the DB->init call and it made no difference. Also, the
> tmon.out files *are* being created by the apache process so that's not an
> issue either.
>   

I misunderstood, sorry.  If you're getting just a few subroutine calls 
recorded, then it seems like some perl modules are being loaded before 
you run Apache::DB->init.  That was my problem anyway - I was loading my 
code with a PerlModule directive before doing Apache::DB->init

cheers
John


Re: Apache::DProf giving empty tmon.out files

Posted by Alx G <gl...@yahoo.co.uk>.


John ORourke wrote:
> 
> Alx G wrote:
>> I'm running Apache 2.2.3, the conf has the following in it:
>>
>> --
>> ...
>> LoadModule perl_module modules/mod_perl.so
>>
>> # Perl profiler
>> #
>> #<Perl>
>> #    require Apache::DB;
>> #    Apache::DB->init;
>> #</Perl>
>> PerlModule Apache::DProf
>> ...
>> --
>>
>> I tried with and without the commented stuff - as was suggested in this
>> thread.
>>   
> 
> I'm running prefork and have used DProf many times.  I even wrote a 
> script to merge multiple tmon.out files, so you can see how your app is 
> doing in its normal environment.
> 
> The lack of recording happens when you don't do Apache::DB->init, and 
> you also need to explicitly create the 'dprof' directory in your apache 
> log directory, and make the apache user own it.
> 
> ----------------------- perl config include:
> <Perl>
>     require Apache::DB;
>     Apache::DB->init; # required otherwise very few subroutine calls get 
> captured
> </Perl>
> PerlModule Apache::DProf
> 
> ----------------------- files:
> (replace /var/log/httpd with your main log file path)
> 
> /var/log/httpd/dprof/   ********** you have to explicitly create this, 
> and make it owned by the apache user
> 
> /var/log/httpd/dprof/PID/tmon.out   <----- output from a particular 
> process (where PID is the pid)
> 
> -----------------
> Once you've let it run and made a few requests (make lots of requests so 
> any heavy startup code doesn't overshadow the real results, and so each 
> process gets a go), merge the tmon.out files using this script:
> 
> http://www.versatilia.com/downloads/merge-tmon-out.pl
> 
> (see top of file for usage)
> 
> hope that helps,
> John
> 
> 

Thanks for the tips John, however as I mentioned in my previous post, I did
in fact try it with the DB->init call and it made no difference. Also, the
tmon.out files *are* being created by the apache process so that's not an
issue either.

-- 
View this message in context: http://www.nabble.com/Apache%3A%3ADProf-giving-empty-tmon.out-files-tp7265235p14996493.html
Sent from the mod_perl - General mailing list archive at Nabble.com.


Re: Apache::DProf giving empty tmon.out files

Posted by John ORourke <jo...@o-rourke.org>.
Alx G wrote:
> I'm running Apache 2.2.3, the conf has the following in it:
>
> --
> ...
> LoadModule perl_module modules/mod_perl.so
>
> # Perl profiler
> #
> #<Perl>
> #    require Apache::DB;
> #    Apache::DB->init;
> #</Perl>
> PerlModule Apache::DProf
> ...
> --
>
> I tried with and without the commented stuff - as was suggested in this
> thread.
>   

I'm running prefork and have used DProf many times.  I even wrote a 
script to merge multiple tmon.out files, so you can see how your app is 
doing in its normal environment.

The lack of recording happens when you don't do Apache::DB->init, and 
you also need to explicitly create the 'dprof' directory in your apache 
log directory, and make the apache user own it.

----------------------- perl config include:
<Perl>
    require Apache::DB;
    Apache::DB->init; # required otherwise very few subroutine calls get 
captured
</Perl>
PerlModule Apache::DProf

----------------------- files:
(replace /var/log/httpd with your main log file path)

/var/log/httpd/dprof/   ********** you have to explicitly create this, 
and make it owned by the apache user

/var/log/httpd/dprof/PID/tmon.out   <----- output from a particular 
process (where PID is the pid)

-----------------
Once you've let it run and made a few requests (make lots of requests so 
any heavy startup code doesn't overshadow the real results, and so each 
process gets a go), merge the tmon.out files using this script:

http://www.versatilia.com/downloads/merge-tmon-out.pl

(see top of file for usage)

hope that helps,
John


Re: Apache::DProf giving empty tmon.out files

Posted by Alx G <gl...@yahoo.co.uk>.

Geoffrey Young wrote:
> 
> 
> 
> Alx G wrote:
>> Hi,
>> 
>> I'm trying to use Apache::DProf with my Perl web app. I can't work out
>> what
>> I'm doing wrong - it should be working but it isn't (how many times have
>> we
>> all said that to ourselves eh?).
>> 
>> I've run out of options to try now, I hope someone can help me please.
> 
> try Devel::Profiler:
> 
>    http://search.cpan.org/dist/Devel-Profiler/
> 
> you might want to try the svn sources, since it's been a while since 
> there has been a release
> 
>    http://sourceforge.net/projects/devel-profiler/
> 
> --Geoff
> 
> 

Thanks Geoff, I gave Devel::Profiler and Devel::Profiler::Apache a go -
neither of those seemed to want to generate any kind of output at all (the
'profiler' directory is in the right place and writable). I ran apache in
the normal prefork mode and the -X (no children) option. I stopped the
server after testing the scripts to check for the tmon.out files.

I also tried Dprof and Devel both before and after loading mod_perl in the
conf, with and without DB->init, same result in each case, i.e. it didn't
work.

To recap, so far I have Dprof that runs and generates some tmon.out files
with no application calls in them. I also have Devel, which generates
nothing at all.

-- 
View this message in context: http://www.nabble.com/Apache%3A%3ADProf-giving-empty-tmon.out-files-tp7265235p14999845.html
Sent from the mod_perl - General mailing list archive at Nabble.com.


Re: Apache::DProf giving empty tmon.out files

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Alx G wrote:
> Hi,
> 
> I'm trying to use Apache::DProf with my Perl web app. I can't work out what
> I'm doing wrong - it should be working but it isn't (how many times have we
> all said that to ourselves eh?).
> 
> I've run out of options to try now, I hope someone can help me please.

try Devel::Profiler:

   http://search.cpan.org/dist/Devel-Profiler/

you might want to try the svn sources, since it's been a while since 
there has been a release

   http://sourceforge.net/projects/devel-profiler/

--Geoff

Re: Apache::DProf giving empty tmon.out files

Posted by Alx G <gl...@yahoo.co.uk>.
Hi,

I'm trying to use Apache::DProf with my Perl web app. I can't work out what
I'm doing wrong - it should be working but it isn't (how many times have we
all said that to ourselves eh?).

I've run out of options to try now, I hope someone can help me please.

I'm running Apache 2.2.3, the conf has the following in it:

--
...
LoadModule perl_module modules/mod_perl.so

# Perl profiler
#
#<Perl>
#    require Apache::DB;
#    Apache::DB->init;
#</Perl>
PerlModule Apache::DProf
...
--

I tried with and without the commented stuff - as was suggested in this
thread.

Apache is running in prefork, *not* worker mode (which was also pointed to
as a possible culprit)

/usr/sbin/httpd -V :
Server MPM:     Prefork
    threaded:     no
        forked:     yes (variable process count)

The tmon.out files *are*being created, by the apache user, but they don't
contain any useful info. I've also tried running apache using the -X command
to spawn no child processes.

I then hit a few different scripts in the browser and the most I ever see in
those files, when shutting down apache is a reference to APR::Pool DESTROY
and the usual stuff at the top, *but no other subroutine calls at all*.

What now?

Many thanks!
-- 
View this message in context: http://www.nabble.com/Apache%3A%3ADProf-giving-empty-tmon.out-files-tp7265235p14995795.html
Sent from the mod_perl - General mailing list archive at Nabble.com.