Home » Php » profiling – Aggregate PHP XDebug data with KCacheGrind

profiling – Aggregate PHP XDebug data with KCacheGrind

Posted by: admin July 12, 2020 Leave a comment

Questions:

Is there any way to aggregate profile data previously taken by PHP XDebug?

I have managed PHP XDebug to put the data related to one request to single file. When I open that file in kcachegrind, it displays all the requests aggregated in that file. However, each request has its own stack trace (I understand, it may change). Is there any way to see profile data aggregated from all the requests? I don’t care if it’s not 100 % accurate or if some calls are missing, I just need the brief overview over all daily operations.

Disclaimer: kcachegrind is not requirement, I just found it the best tool so far.

How to&Answers:

Combine all files into one:

cat cachegrind.out.* > cachegrind.combined

Open the cachegrind.combined and select “Parts” tab on bottom right of the window. You will see multiple parts of profile listed there. Select them all (CTRL+a or use mouse) and you will see summed data of all these profile files.

Answer:

The report generated is TEXT and can be parsed so it should not be to complicated to build a parser that generates reports.
I use WinCacheGrind for windows and find it very good as besides a detailed tree it also shows a general combined time/function and how many calls it has.

Answer:

I am not sure but see below URL and read it. I think it is very help full to you.

Profiling PHP with Xdebug and Webgrind

http://www.chrisabernethy.com/php-profiling-xdebug-webgrind/

Finding and fixing performance bottlenecks in PHP web applications can be both time-consuming and difficult. Fortunately, free tools like Xdebug and Webgrind allow you to easily find and visualize bottlenecks in your PHP scripts.

Webgrind is an Xdebug profiling web frontend in PHP5. It implements a subset of the features of kcachegrind and installs in seconds and works on all platforms.–Webgrind

Anyone who has ever needed to profile code is probably familiar with KcacheGrind (a profile data visualization tool). KcacheGrind provides a way to visualize the profile data from a program execution, allowing you to quickly and easily see where the program is spending its time. Knowing where the execution bottlenecks are allows you to focus your optimization efforts in the correct places.

For a long time, the Xdebug extension for PHP has been able to (among other things) dump execution profile information to disk in a format that is usable by KcacheGrind, which is great if you are running Linux with KDE.

The webgrind project provides a web-based replacement for KcacheGrind that can be installed on any operating system, allowing you to visualize a portion of the Xdebug profiling data through a browser.

Read more above the Artical

http://www.chrisabernethy.com/php-profiling-xdebug-webgrind/

See also another example and Read it:-

XDEBUG EXTENSION FOR PHP | DOCUMENTATION

http://xdebug.org/docs/profiler

Xdebug’s built-in profiler allows you to find bottlenecks in your script and visualize those with an external tool such as KCacheGrind or WinCacheGrind.
Introduction

Xdebug’s Profiler is a powerful tool that gives you the ability to analyze your PHP code and determine bottlenecks or generally see which parts of your code are slow and could use a speed boost. The profiler in Xdebug 2 outputs profiling information in the form of a cachegrind compatible file. This allows you to use the excellent KCacheGrind tool (Linux/Windows, KDE) to analyse your profiling data. If you are on Linux you can install KCacheGrind with your favourite package manager; if you are on Windows you can get precompiled binaries of KCacheGrind at SourceForge.

Users of Windows can also use WinCacheGrind, the functionality is different from KCacheGrind so the section that documents the use of KCacheGrind on this page doesn’t apply to this program. There is also an alternative profile information presentation tool called xdebugtoolkit, a web based front-end called Webgrind and a Java based tool called XCallGraph.

Read more above the Artical

http://xdebug.org/docs/profiler