一个“具有可视化功能的分析器”对于具有“完整回溯可视化”的 PHP?
目前,我正在使用 xdebug profiler
& KCacheGrind
。但 GallGrind 格式不存储完整的调用跟踪,仅存储父子调用跟踪(查看 Kcachegrind/callgrind 对于调度程序功能来说不准确? 对于我正在谈论的内容。)
是否有可用于 PHP 的具有可视化功能的分析器以及完整的回溯可视化?
我看过
- PHP Quick Profiler:但是,它需要添加太多代码并且没有可视化。
- phpCallGraph:其最新版本已于 2009-08-06 修改(< a href="http://sourceforge.net/projects/phpcallgraph/files/" rel="nofollow noreferrer">参考)。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
几个月前,我必须对之前的项目进行一些主要的 PHP 分析。
我能找到的最好的选择是 facebook 的 xhprof 和 xhprof-ui。
在这里了解如何安装它们:
http://blog.preinheimer.com/index.php?/archives/355-A-GUI-for-XHProf.html
一些优点:
I had to do some major PHP profiling for a previous project a few months ago.
The best option I was able to find was facebook's xhprof with xhprof-ui.
Read about how to install both of them here:
http://blog.preinheimer.com/index.php?/archives/355-A-GUI-for-XHProf.html
Some pros:
如果您只想查看探查器输出,那是一回事。
如果您想优化代码,请不要忘记 这个方法。
我知道你可以在 xdebug 中做到这一点。
它基于一个非常简单的想法。
假设您的程序正在执行超出其需要的操作,因此可以加快速度。
事实上,为了论证起见,假设它执行的操作比需要执行的操作多了 9 倍,所以如果总共需要 1 秒,那么实际上需要 10 秒。
这 9 秒不必要的工作可能会或可能不会彻底混合,就像糖和面粉一样。
好的,在这 10 秒内,您只需按 ^C 即可停止它,然后您仔细观察它当时在做什么。
你发现它在做浪费的事情的概率是多少?
事实上,你不太可能没有发现它在做浪费的事情。
如果您不确定,请重复。
浪费不必那么大。
事实上,如果你继续像这样暂停它,一旦你看到它在不止一次场合做某件事,如果你可以摆脱它,你会得到一个很好的加速,保证。
例如,如果您将其暂停 5 次,并且您发现它在其中 2 次执行了一些实际上不必执行的操作,那么您可以节省多少钱?
您并不确切知道,但是大约会在 40% 左右。它可能小至 20%。它很容易达到 60%。
所以你不知道它会节省多少钱,但你不会因为不确定金块的重量而扔掉它。
最后,探查器可以发现这不会出现的问题。
反之则不然。
If you just want to look at profiler output, that's one thing.
If you're trying to optimize your code, don't forget about this method.
I know you can do it in xdebug.
It's based on a very simple idea.
Suppose your program is doing more than it needs to, so it could be speeded up.
In fact suppose, for argument's sake, it is doing 9 times more than it needs to, so altogether if it was supposed to take 1 second it's actually taking 10.
Those 9 seconds of unnecessary work may or may not be thoroughly mixed in, like sugar and flour.
OK, during those 10 seconds, you just hit ^C to halt it, and then you look carefully to see what it was doing at that moment.
What is the probability that you caught it doing the wasteful thing?
Actually, it's very unlikely you didn't catch it doing the wasteful thing.
If you're not sure, just repeat.
The wastage doesn't have to be as large as that.
In fact, if you keep pausing it like that, as soon as you see it doing something on more than one occasion, if it's something you could get rid of, you'll get a nice speedup, guaranteed.
For example, if you pause it 5 times, and you see it doing something it doesn't really have to do on 2 of those occasions, how much could you save?
You don't exactly know, but it will be somewhere around 40%. It could be as small as 20%. It could just as easily be as large as 60%.
So you don't know how much it will save, but you don't throw away a gold nugget just because you're not sure how much it weighs.
Finally, there is no problem the profiler can find that this won't.
The converse is not true.