📜 ⬆️ ⬇️

Tools for visualizing xdebug profiler logs

Probably many php developers use the xdebug profiler to look for bottlenecks in applications. But just watching the logs is not very convenient, so the tools for their visualization were created. I want to talk briefly about these tools.

Webgrind

Webgrind is a set of php scripts that can be installed on a local or remote web server. Then everything is just to the obscene - upload the log file and look at the statistics.
image
The most obvious advantage of Webgrind is cross-platform and easy installation .
Shows a list of functions that were called, the number of calls (Invocation Count), the total time spent on the call (Total Self Cost) and the total time spent on execution (Total Inclusive Cost).
You can hide php functions. You can go inside the function to see the expanded statistics.

KCachegrind
')
KCachegrind needs the third KDE libraries to work. It will work on most Unix-like OSes (it works for me on Ubuntu and FreeBSD), as well as Windows (via Cygwin) and MacOS X (I have not tested it). This is probably the most functional and convenient tool for visualizing profiles of all available.

image
You can see the function calls, time, and you can also see the call graph (very convenient) and the map (sometimes also conveniently).

WinCacheGrind .

WinCacheGrind is a stripped-down KCachegrind for Windows. You can certainly try to run on a virtual machine under other OS, but I do not see the point. From the functional view of the function calls is available, you can also hide quickly running functions.

image

xdebugtoolkit

If you probably knew about the above tools, then you probably hear xdebugtoolkit for the first time. I only found out about him a few months ago.
xdebugtoolkit allows you to visualize the following columns:

image

image
In general, if oo-o-chen you do not want to pull into the KDE system to install KCachegrind, then you can use xdebugtoolkit in conjunction with Webgrind.

Maccall grind

Visualizer for MacOS X. I did not use it (it almost did not work with MacOS X). Looks like this:

image
Externally looks like WinCacheGrind. Judging by the description, the functionality is similar.

CachegrindVisualizer

About her literally just told me ftr . This is a domestic development of the Habrayuser Develar . Powered by Adobe AIR. The screenshot is very large, here is the link . And an excerpt from the description:
CachegrindVisualizer builds a more informative graph than KCacheGrind - on the edge of the edge there is a label typed in a smaller font - this is the self time spent on the execution of this function, the time it takes to execute this particular call, and not all calls to this function.

Viglaitit impressively. Will need to try to use. If someone has already worked - share your impressions.

Afterword
As I promised the description is short . I worked with most of these applications for a long time. Now I use KCachegrind, as the most convenient and functional tool.

Ps . In order to enable the profiler in xdebug, you need to register “xdebug.profiler_enable = 1” in php.ini.

UPD . On Habré there is a translation of an article about code profiling using xdebug Profiling PHP Applications With xdebug . It describes in more detail the work with WinCacheGrind and KCachegrind.

Source: https://habr.com/ru/post/75166/


All Articles