#!/bin/sh # # PHP profiling script # # Copyright Stuart Prescott (c) 2006 # # Released under the GNU GPL v2 or later # http://www.gnu.org/copyleft/gpl.html # # More info: # http://nanonanonano.net/linux/phpprofiling # # Using your web browser, visit your PHP site with profiling # turned on. Then, run this script to find the correct profile, # convert the profile into something that KCacheGrind can use # and then open the call tree in KCacheGrind. # # Note: this script assumes the file structure used by # Debian for the APD profiles. APDDIR=/var/log/php4-apd APDFILE=$(ls -1t $APDDIR/ | head -1) pprof2calltree -f $APDDIR/$APDFILE FILENUM=$(echo $APDFILE | cut -f2 -d.) kcachegrind cachegrind.out.pprof.$FILENUM