Here's the details of the path I've tread so far and the problem I'm facing:
I installed valgrind on my web server (Ubuntu Server 8.04 LTS). I
used this command to get a profiler dump:
sudo valgrind --tool=callgrind --dump-instr=yes --trace-jump=yes -v
/usr/sbin/apache2
I hit the page I am interested in, and get some interresting output
along the lines of "callgrind.out.6667". Opening this up in
KCacheGrind produces some beautiful graphs, but I notice that a lot of
the call information has useless names like it doesn't know what the
functions being called are actually named.
After digging into this for a bit I figure out that the default Ubuntu
packages have their debug symbols stripped out of them. Some googling
turns up a special ubuntu repository containing versions of these
packages with the debug symbols still in place. So I added this to my
apt sources:
deb http://ddebs.ubuntu.com hardy main restricted universe multiverse
Then I installed a ton of dbgsym packages:
sudo aptitude install apache2.2-common-dbgsym
apache2-mpm-prefork-dbgsym libapache2-mod-php5-dbgsym php5-cli-dbgsym
php5-cgi-dbgsym php5-common-dbgsym php5-xapian-dbgsym php5-curl-dbgsym
php5-mysql-dbgsym php5-gd-dbgsym php5-sqlite3-dbgsym
php5-sybase-dbgsym
Generating a new profiler dump resulted in much more readable
information in KCacheGrind. I can see very useful information about
the time Apache is spending starting up, how much time is spend
initializing mod_ssl, and even zend starting up modules and parsing
config files. What I don't see is any information at all about what
php itself is doing. Based on what I've seen at some of Rasmus'
presentations, I was hoping to see information about how much time was
spent in database connections, compiling php code, and so on.
Further googling led me to this page:
http://bugs.php.net/bugs-getting-valgrind-log.php. Based on that, I
now think my problems are:
1) I need an --enable-debug build of PHP.
2) I might need a debug build of apache2. When I call "file
/usr/sbin/apache2" as suggested at the end of the page above, my
apache2 binary reports that it is "stripped" and that page suggests I
need it to say "not stripped".
So this leads to my big question: does anyone know an easy way to get
debug builds of PHP and/or Apache on Ubuntu WITHOUT doing custom
compilation? For stability and ease of setup I would prefer using
prebuilt packages if it's at all feasible... Or am I asking the wrong
questions, and there's something else I need to do?
Thanks to anyone who can help,
David Brewer