Re: Apache gprof profiling

2003-11-07 Thread Jeff Trawick
Chris Knight wrote:

After Jeff graciously pointed out that some gprof changes had occurred 
in 2.1-dev, I decided to give it a try and sure enough I could get a 
gmon.out file. Then, after doing a bunch of diffs, I came to the 
conclusion that the code defguarded by NO_USE_SIGACTION was removed in 
2.1 and I tried defining that, sure enough it works now. Huzzah! (Just 
thought I'd report in so someone else trying to profile 2.0 will not 
stumble across this problem.)
weird...  there was some code in 2.0.48's prefork.c guarded by NO_USE_SIGACTION 
that was moved to mpm_common.c in 2.1-dev... it is supposed to be the same :)

So the way to get profiling in 2.0.48:

% setenv CFLAGS '-pg -DGPROF -g -DNO_USE_SIGACTION'
I would normally assume that I broke it when I moved the signal setup related 
to coredumping signals to mpm_common.c in 2.1-dev.  But I think you're saying 
that the modern sigaction() logic actually works in 2.1-dev, but in 2.0.48 you 
have to avoid the sigaction() via -DNO_USE_SIGACTION because it is broken :) 
Very weird.

The big difference between sigaction flavor and no_use_sigaction flavor in 
2.0.48 when httpd is started with -X option seems to be that the sigaction 
flavor sets up handlers for SIGXCPU and SIGXFSZ, whereas the no_use_sigaction 
flavor does not.




Re: Apache gprof profiling

2003-11-07 Thread Chris Knight
Chris Knight wrote:

Hi all, I found some mention of profiling Apache with gprof via 
google. I tried the following:

% setenv CFLAGS '-pg -DGPROF -g'
% ./configure [my configure flags]
% make; make install; cd $PREFIX
[alter the conf file to set the MaxRequestsPerChild to 1]
% bin/httpd -X
[make a request and close the connection, which should cause httpd to 
terminate normally.]

I should end up with a "gmon.out" file that I can then feed to gprof, 
but I'm not. Is there a step I'm missing and/or is this possible? For 
that matter, is there any official documentation regarding profiling?

(In reality I want to profile a particular module but I thought it 
would be interesting to profile all of Apache's internals as well to 
get a complete picture.)
After Jeff graciously pointed out that some gprof changes had occurred 
in 2.1-dev, I decided to give it a try and sure enough I could get a 
gmon.out file. Then, after doing a bunch of diffs, I came to the 
conclusion that the code defguarded by NO_USE_SIGACTION was removed in 
2.1 and I tried defining that, sure enough it works now. Huzzah! (Just 
thought I'd report in so someone else trying to profile 2.0 will not 
stumble across this problem.)

So the way to get profiling in 2.0.48:

% setenv CFLAGS '-pg -DGPROF -g -DNO_USE_SIGACTION'
% ./configure [my configure flags]
% make; make install; cd $PREFIX
[alter the conf file to set the MaxRequestsPerChild to 1]
% bin/httpd -X
[make a request and close the connection]
I had a suspicion it had something to do with signals (since you don't 
get a gmon.out unless the process dies normally). Anyways, fixed a bug 
in the code along the way. :^)