I was doing some performance tuning the other day, for some fairly complex PHP code, and so finally had a chance to try out xdebug‘s profiling support. It’s pretty cool, but unfortunately tool support for it is fairly limited.
xdebug spits out profiling data in a subset of the Callgrind Format, which is part of the Valgrind project. While the data is textual and human readable, the structure itself is a flat unrolled execution stack that’s not entirely sequential for parsing, and so you need some kind of tool to interpret the data.
A number of shell tools will do the job, but won’t be overly useful for really drilling into the data. The KDE based KCachegrind will read and display the data and everything else besides, but I haven’t run KDE for about 8 years now, so it’s not much use to me. Likewise the small but powerful WinCacheGrind does the job, but it’s Windows, which for me means using my Windows box which is away from my main development set up. It also has a number of annoying little bugs, and while the source is available on sourceforge, it’s not really being updated.
So, I spent a few days writing a Mac OS X profiling tool, MacCallGrind.
It’s a bit rough and ready at the moment, and there’s a number of problems with it, but it reads the xdebug output and displays it with at least a few useful metrics. There’s more to come, because I need it for some other upcoming work, but I won’t be getting back to that for a few weeks, so I figured it’s best to just get it out there for other people use, even though it doesn’t do very much.
Let me know what you think and what you’d like me to add.
Remember, I know it’s only minimal, but what do you expect for two days’ work?!