Home » Php » php – Xdebug trace GUI?

php – Xdebug trace GUI?

Posted by: admin April 23, 2020 Leave a comment

Questions:

I’m trying to find a GUI to parse and view Xdebug trace files. Although you can make them human readable, the sheer number of lines makes it unusable.

I’m looking for something like KCachegrind but for a trace file. My main goal behind all this is to find what the memory hogs are.

How to&Answers:

I found this to be pretty solid. Maybe it’s serviceable to you, too:

https://github.com/corretge/xdebug-trace-gui

Answer:

I found this one: xdebug trace file parser.

Answer:

I just using started xdebug today came across this problem a few ahours ago too. I’d love a cachegrind style gui for xdebug traces.

A lot of the lower level calls contain uneccesary information like strlen() calls. I found that xdebug starts the trace file has 21 spaces for top level calls to functions, 23 spaces for second-level calls, 25 and so on. So you can do is grep out lines with more than 22 or more spaces to list top level calls, 24 for sencond and higher level calls etc.

cat trace.xt | grep -v '                      '

The web-based trace parser sounds a good idea. It could parse the output into a bunch of nested ul and li elements that could be collapsed. I’m tight for time too, but if you’re up for a collaboration lemme know.

Answer:

I wrote a simple viewer using .NET WinForms:

https://github.com/ron-inbar/xdebug-trace-viewer

You’ll need Visual Studio (2010 or later) to build it.
Feel free to customize the code.

enter image description here

Answer:

You may try Xdebug Trace Explorer. View in Tree-style. I built it after looking around and didn’t find any matching solutions. Still not optimize for large file yet:

https://github.com/tungbi/xdebug-trace-explorer

Answer:

There’s a script for vim at xdebug.org that lets you do ‘code folding’ to make them a little bit easier to dig into, but I’ve never seen anything that can parse that format into any kind of graphical representation.

Answer:

WebGrind provides a nice, simple way to view CacheGrind files via a browser:

But look at XHProf which is open sourced by Facebook, is very easy to setup, captures many important metrics, and even generates call graphs:

Answer:

Shout out to http://derickrethans.nl/xdebug-and-tracing-memory-usage.html. Not a typical GUI, but it does make it easy to view the data.

Answer:

I believe the PDT plugin for Eclipse will import trace logs and I know it can integrate with xdebug and do profiling

Part 1 of 5 on using PDT and xdebug

Answer:

I don’t know if this is exactly what you need, but you can enable profiling in XDebug and then dump a big cachegrind file. On my mac, I then used MacCallGrind to view those dumps in a GUI. I can at least see the whole stack of calls for a given request and how much time each call took. Is that what you mean? I haven’t got that working in Eclipse PDT yet.

http://www.xdebug.org/docs/profiler