Xdebug trace GUI? [closed]

2020-02-07 19:42发布

问题:


Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 4 years ago.

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.

回答1:

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

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



回答2:

I found this one: xdebug trace file parser.



回答3:

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.



回答4:

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.



回答5:

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.



回答6:

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

  • https://github.com/jokkedk/webgrind

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

  • http://pecl.php.net/package/xhprof
  • http://mirror.facebook.net/facebook/xhprof/doc.html


回答7:

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



回答8:

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.



回答9:

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



回答10:

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