Screenshot of what qcachegrind produces.

View xdebug cachegrind files on Mac OS

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

qcachegrind cachegrind.out.26620

You will get something that looks like this :

Screenshot of what qcachegrind produces.
Screenshot of what qcachegrind produces.

Optimize away!

PS: For live debugging via xdebug, I use codebugapp.com.

3 thoughts on “View xdebug cachegrind files on Mac OS”

  1. Pingback: crash test dev

Have a question? Like what you read? Leave a Reply!