Xdebug is key when it comes to optimizing PHP code. Today, I heard my colleague boot up a Windows machine just to run an application that could interpret a cachegrind file generated by our development server… surely there must be a Mac equivalent! The following instructions will let you interpret cachegrind files locally on your Mac. You’ll still have to download the cachegrind file locally from your server.
Note that I’m doing this on Mavericks 10.9.2. I will not explain how to install Xdebug on your server or how to create the cachegrind file.
First, install Homebrew on your machine. From your terminal, run :
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then, run :
brew install qcachegrind brew install graphviz</code>
Then, download your cachegrind file locally to your machine and, to view the output, simply execute
You will get something that looks like this :
PS: For live debugging via xdebug, I use codebugapp.com.