简体   繁体   English

使用KCacheGrind聚合PHP XDebug数据

[英]Aggregate PHP XDebug data with KCacheGrind

Is there any way to aggregate profile data previously taken by PHP XDebug? 有没有办法聚合以前PHP XDebug采用的配置文件数据?

I have managed PHP XDebug to put the data related to one request to single file. 我已经管理PHP XDebug将与一个请求相关的数据放到单个文件中。 When I open that file in kcachegrind, it displays all the requests aggregated in that file. 当我在kcachegrind中打开该文件时,它会显示该文件中聚合的所有请求。 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. 我不在乎它是不是100%准确,或者如果缺少一些电话,我只需要对所有日常操作进行简要概述。

Disclaimer: kcachegrind is not requirement, I just found it the best tool so far. 免责声明:kcachegrind不是必需的,我发现它是目前为止最好的工具。

Combine all files into one: 将所有文件合并为一个:

cat cachegrind.out.* > cachegrind.combined

Open the cachegrind.combined and select "Parts" tab on bottom right of the window. 打开cachegrind.combined并选择窗口右下角的“部件”选项卡。 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. 全部选择它们(CTRL + a或使用鼠标),您将看到所有这些配置文件的总和数据。

The report generated is TEXT and can be parsed so it should not be to complicated to build a parser that generates reports. 生成的报告是TEXT并且可以解析,因此构建生成报告的解析器不应该变得复杂。 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. 我使用WinCacheGrind for windows并发现它非常好,除了详细的树之外,它还显示了一般的组合时间/功能以及它有多少个调用。

I am not sure but see below URL and read it. 我不确定,但请看下面的URL并阅读它。 I think it is very help full to you. 我觉得这对你很有帮助。

Profiling PHP with Xdebug and Webgrind 使用Xdebug和Webgrind分析PHP

http://www.chrisabernethy.com/php-profiling-xdebug-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. 在PHP Web应用程序中查找和修复性能瓶颈既费时又困难。 Fortunately, free tools like Xdebug and Webgrind allow you to easily find and visualize bottlenecks in your PHP scripts. 幸运的是,像Xdebug和Webgrind这样的免费工具允许您轻松查找和可视化PHP脚本中的瓶颈。

Webgrind is an Xdebug profiling web frontend in PHP5. Webgrind是PHP5中的Xdebug profiling web前端。 It implements a subset of the features of kcachegrind and installs in seconds and works on all platforms.–Webgrind 它实现了kcachegrind功能的一个子集,并在几秒钟内安装并可在所有平台上运行。-Webgrind

Anyone who has ever needed to profile code is probably familiar with KcacheGrind (a profile data visualization tool). 任何需要分析代码的人都可能熟悉KcacheGrind(一个配置文件数据可视化工具)。 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. KcacheGrind提供了一种从程序执行中可视化配置文件数据的方法,使您可以快速轻松地查看程序花​​费时间的位置。 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. 很长一段时间,PHP的Xdebug扩展能够(除其他外)以KcacheGrind可以使用的格式将执行配置文件信息转储到磁盘,如果您使用KDE运行Linux,这很好。

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. webgrind项目为KcacheGrind提供基于Web的替代,可以安装在任何操作系统上,允许您通过浏览器可视化部分Xdebug分析数据。

Read more above the Artical 阅读更多关于Artical的内容

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

See also another example and Read it:- 另见另一个例子并阅读: -

XDEBUG EXTENSION FOR PHP | PHP的XDEBUG EXTENSION | DOCUMENTATION 文档

http://xdebug.org/docs/profiler 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. Xdebug的内置分析器允许您在脚本中找到瓶颈,并使用外部工具(如KCacheGrind或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. Xdebug的Profiler是一个功能强大的工具,它使您能够分析PHP代码并确定瓶颈,或者通常可以看到代码的哪些部分很慢并且可以使用速度提升。 The profiler in Xdebug 2 outputs profiling information in the form of a cachegrind compatible file. Xdebug 2中的探查器以cachegrind兼容文件的形式输出分析信息。 This allows you to use the excellent KCacheGrind tool (Linux/Windows, KDE) to analyse your profiling data. 这允许您使用优秀的KCacheGrind工具(Linux / Windows,KDE)来分析您的分析数据。 If you are on Linux you can install KCacheGrind with your favourite package manager; 如果您使用的是Linux,可以使用自己喜欢的软件包管理器安装KCacheGrind; if you are on Windows you can get precompiled binaries of KCacheGrind at SourceForge. 如果你在Windows上,你可以在SourceForge上获得KCacheGrind的预编译二进制文件。

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. Windows的用户也可以使用WinCacheGrind,其功能与KCacheGrind不同,因此在此页面上记录使用KCacheGrind的部分不适用于此程序。 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. 还有一个名为xdebugtoolkit的替代配置文件信息呈现工具,一个名为Webgrind的基于Web的前端和一个名为XCallGraph的基于Java的工具。

Read more above the Artical 阅读更多关于Artical的内容

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM