Apache::DProf giving empty tmon.out files

Apache::DProf giving empty tmon.out files

am 09.11.2006 21:02:12 von Miles Crawford

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


SetHandler perl-script
PerlResponseHandler Solstice::Handler
...(some irrelevant auth stuff)...


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

am 09.11.2006 21:14:24 von Perrin Harkins

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:


require Apache::DB;
Apache::DB->init;


- Perrin

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

am 09.11.2006 21:29:51 von pgollucci

> 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.
>
> require Apache::DB;
> Apache::DB->init;
>

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

am 09.11.2006 21:42:46 von Perrin Harkins

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

am 09.11.2006 21:45:03 von pgollucci

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

am 09.11.2006 22:51:58 von Miles Crawford

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

My config has this now:

PerlModule Apache::DProf

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


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.
>>
>> require Apache::DB;
>> Apache::DB->init;
>>

> 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

am 09.11.2006 22:53:20 von Perrin Harkins

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

am 09.11.2006 22:54:11 von pgollucci

Miles Crawford wrote:
>
>
> Hmm. Thanks for the hints guys, but it's still not working.
>
> My config has this now:
>
> PerlModule Apache::DProf
>
> use APR::Pool ();
> use Apache::DB ();
> Apache::DB->init();
>

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

am 09.11.2006 22:56:04 von Miles Crawford

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

am 09.11.2006 22:59:12 von Perrin Harkins

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

am 09.11.2006 23:04:20 von Miles Crawford

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

am 13.11.2006 00:35:16 von Frank Wiles

On Thu, 09 Nov 2006 15:42:46 -0500
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?
>
> - 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
http://www.wiles.org
---------------------------------

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

am 14.11.2006 22:23:55 von Miles Crawford

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
>>
>> use APR::Pool ();
>> use Apache::DB ();
>> Apache::DB->init();
>>

> 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

am 21.01.2008 12:36:05 von Alx G

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
#
#
# require Apache::DB;
# Apache::DB->init;
#

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.ou t-files-tp7265235p14995795.html
Sent from the mod_perl - General mailing list archive at Nabble.com.

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

am 21.01.2008 13:17:41 von John ORourke

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
> #
> #
> # require Apache::DB;
> # Apache::DB->init;
> #

> 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:

require Apache::DB;
Apache::DB->init; # required otherwise very few subroutine calls get
captured

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

am 21.01.2008 13:26:45 von Alx G

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
>> #
>> #
>> # require Apache::DB;
>> # Apache::DB->init;
>> #

>> 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:
>
> require Apache::DB;
> Apache::DB->init; # required otherwise very few subroutine calls get
> captured
>

> 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.ou t-files-tp7265235p14996493.html
Sent from the mod_perl - General mailing list archive at Nabble.com.

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

am 21.01.2008 14:16:55 von John ORourke

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

am 21.01.2008 15:14:06 von Geoffrey Young

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

am 21.01.2008 15:19:37 von Alx G

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.ou t-files-tp7265235p14998229.html
Sent from the mod_perl - General mailing list archive at Nabble.com.

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

am 21.01.2008 16:30:15 von Alx G

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.ou t-files-tp7265235p14999845.html
Sent from the mod_perl - General mailing list archive at Nabble.com.

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

am 21.01.2008 17:06:38 von Heiko Jansen

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

am 21.01.2008 17:25:51 von Alx G

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.ou t-files-tp7265235p15000908.html
Sent from the mod_perl - General mailing list archive at Nabble.com.

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

am 21.01.2008 19:00:34 von Perrin Harkins

On Jan 21, 2008 7:26 AM, 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.

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

am 21.01.2008 23:01:11 von Heiko Jansen

>>> Alx G 21.01.08 17.25 Uhr >>>
> 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.

Yep, looks good.
I've no experience with Apache::DB - so apart from one last
excerpt from the docs that I've seen I've nothing more to offer:

I believe you should have sth. like this in your Apache conf for the
location you serve your scripts from:


PerlFixupHandler Apache::DB
SetHandler perl-script
PerlHandler ModPerl::RegistryPrefork
Options +ExecCGI


If I'm wrong I hope someone will correct me...

All the best
heiko

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

am 23.01.2008 11:57:25 von Alx G

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.
>
> ... ...
>
> 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


StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000


Listen 80

.... load various modules ...

LoadModule perl_module modules/mod_perl.so


require Apache::DB;
Apache::DB->init;


PerlModule Apache::DProf

Listen 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



Order allow,deny
Allow from all




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



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.ou t-files-tp7265235p15039276.html
Sent from the mod_perl - General mailing list archive at Nabble.com.

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

am 23.01.2008 16:56:00 von Perrin Harkins

On Jan 23, 2008 5:57 AM, Alx G 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 section, as shown in the docs.

- Perrin

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

am 23.01.2008 17:28:03 von Alx G

Perrin Harkins wrote:
>
> On Jan 23, 2008 5:57 AM, Alx G 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 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.ou t-files-tp7265235p15045577.html
Sent from the mod_perl - General mailing list archive at Nabble.com.

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

am 23.01.2008 18:29:21 von Geoffrey Young

> 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