KCachegrind Redux
KCachegrind- or in this case QCachegrind- has a great visulaization of the call graph.
There are a number of tools that are quite wonderful for investigating PHP's call stack. I am rather fond of KCachegrind (which I suppose makes me a bit nostaglic). Having regretfully followed Apple's upgrade path I have found myself without KCachegrind. The instructions that I wrote previously for installing KCachegrind on OSX no longer work because Fink's KDE packages are unfortunately not ready for 10.7+.
Happily there is a fairly painless way to work around this. This post is where I started from. Basically it eshews using KDE and instead just installs the QT libraries to run KCachegrind. This makes the process much less time consuming and seemingly less prone to dependency issues. I had to change a few things so I've repeated the steps here, however credit goes to Paul Kehrer for the direction.
- Download QT and install it. I used 5.0 beta version and seems to work fine.
- Install Graphviz. I used fink -b install graphviz
- Download KCachegrind from: http://kcachegrind.sourceforge.net/html/Download.html
- Unpack KCachegrind and navigate into the directory and into qcachegrind. I used qmake-4.8 -spec macx-g++; make
- open qcachegrind.app should open up the application. You can move it to your Applications directory if you want.
- I modified my xdebug settings in php.ini to use: xdebug.profiler_output_name = callgrind.%R.%t This lets KCachegrind open the grind files without having to select the "All Files (*)" option. There is a patch metioned here: https://gist.github.com/1029580 that lets KCachegrind open any file type though I think this has actually been applied to current releases. Plus, if you change the output file name I think this is somewhat moot.
Categories: DrupalPlanet Drupal