PHP frontend for Xdebug profiling?

By | | PHP

Has anyone put together a PHP front-end for viewing Xdebug 2.x’s profiling output yet?

Xdebug 1.x had this nice xdebug_dump_function_profile() function which planted a HTML table containing the profiling stats in your output – nice an easy to use, ignoring the minor issue that doing this “in band” with the code you are profiling slants the results. With Xdebug 2.x it was dropped and you now need a tool like kcachegrind or wincachegrind, an output file generated by Xdebug acting as the middle man.

The format of the profile output file is fairly straightforward (in fact the wincachegrind developer provides a nice short summary with the install README). Perhaps the trickier issue is how to deal with large files. And this could be a valid reason to use some AJAX… In fact it’s tempting to take a shot using wxpython (the book is out BTW – and it’s good) and put together a cross platform front end, but that’s another story.

Or do I need to do it myself ? ;)

Side note: the definitive Xdebug tutorial – http://derickrethans.nl/files/phparch-xdebug-qa.pdf

Written By:

Harry Fuecks

Harry has been working in corporate IT since 1994, with everything from start-ups to Fortune 100 companies. Outside of office hours he runs phpPatterns: a site dedicated to software design with PHP that aims to raise standards of PHP development. He also maintains Dynamically Typed: SitePoint's PHP blog.

 

{ 12 comments }

Mike Smullin December 2, 2007 at 7:44 am

I’d love to see a KCachegrind or WinCachegrind plugin for Eclipse PDT. Combined with XDebug, that would allow me to debug and profile my PHP code all within the same IDE.

mariuszn3 April 22, 2006 at 10:46 am

I’ve made myself php frontend but for Xdebug tracing. This gives times of execution but of course not the way the kcachegrind does. It’s just nice readable output of xdebug xt trace file – more usefull for debugging than profiling. It’s XHTML strict with some ajax functionality (to hide/show parts of trace)
I’m planing to publish it on my site but first I want to clear out some design/functionality issues that I’ve noticed in current version. If there’s interests in that, drop me a note maybe it will motivate me to push it forward :)

jayboots April 21, 2006 at 5:21 pm

Thanks for the answer.

Think HTML (or XML / XSLT?) will make a better display in the end, plus it’s easier to customize.

If you said XUL I might be tempted to agree :)

lmpmbernardo April 21, 2006 at 3:22 pm

I wrote a 10 line php script that does the same as the ct_annotate perl script. It’s not the same as having a kcachegrind view but I find it almost as useful.

Bob April 21, 2006 at 8:24 am

I’m on OSX as well, and was recently surprised to find no solution for “grinding” cachegrind files natively. Even if the output was text on the command line – similar to the output of APD’s pprofp – I’d be in heaven. Graphs are for sucks anyways ;)

Please Harry – go forth and conquer.

svanpoeck April 21, 2006 at 8:19 am

Just looking for a quick answer –seems like a lot of experts are loose here ;) — does WinCacheGrind have any features Zend Studio Profiler has not ?

Just curious…

koto April 21, 2006 at 7:54 am

- Occasionally Wincachegrind “explodes” for no apparent reason. Not that I know my way around Delphi but without the source, it’s not promising.

Just for the record – the new release of
wincachegrind 1.0.0.12
has source files included.

HarryF April 21, 2006 at 6:54 am

Why bother? kcachegrind and wincachegrind both do a good job and are very fast. I’m interested to know what brings you to wonder about a webified version. Are there particular features that are missing that you are interested in?

There isn’t really a good reason but a there are a bunch of bad reasons which, put together, start to make a good reason like;

- It’s a different tool on different platforms (and sounds like tough luck of the OS X people). Personally my desktop is about 50/50 Windows / Ubuntu these days (plus it’s nice to keep Ubuntu K-free) so I’d like to use the same thing on both

- Occasionally Wincachegrind “explodes” for no apparent reason. Not that I know my way around Delphi but without the source, it’s not promising.

- Think HTML (or XML / XSLT?) will make a better display in the end, plus it’s easier to customize

You’re just looking for an excuse to write it ;-P

…and there’s that ;)

Eric.Coleman April 21, 2006 at 12:30 am

Pain in the ass to get either of those working on OS X, unless im missing the point ;)

Then again, I can just fire up parallels and use wincachegrind.

Maarten Manders April 20, 2006 at 11:34 pm

I didn’t use XDebug2 at all because of the missing output features. WinCacheGrind enables a much finer grained analysis though. IMHO, the only thing that’s missing is remote file access over FTP.

jayboots April 20, 2006 at 11:33 pm

Why bother? kcachegrind and wincachegrind both do a good job and are very fast. I’m interested to know what brings you to wonder about a webified version. Are there particular features that are missing that you are interested in?

z0s0 April 20, 2006 at 11:20 pm

You’re just looking for an excuse to write it ;-P

Comments on this entry are closed.

{ 1 trackback }