找到哪个函数(文件)导致服务器重载 [英] find which function(file) causes server overload

查看:146
本文介绍了找到哪个函数(文件)导致服务器重载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已阅读 此主题 ,但是我的主题不重复。

I have read this topic, but my topic is not duplicate.

如果我有一个特定的帮助函数/方法,它将会很好的跟踪所有进一步的功能,在PHP中执行,以确定每个函数的执行时间,如下所示:

It will be excellent, if I had an specific helper function/method, which will track all further functions, which are being executed in PHP, to determine the each function's execution time, like this:

executed URL: /mypage.php
function execution times:
        initialize(): 1.2 seconds
         - cookie_checker(): 0.1 ms
           -- set_cookie():  0.01 ms 
           -- blabla():  0.5 ms
         - start_authorization(): 0.27 ms
        page_output(): 2.4 seconds
         - header_output(): 0.3 ms
           -- XXXXXXXXXXXXX():  0.01 ms 
           -- YYYYYYYYYYYYY():  0.5 ms
         - ZZZZZZZZZZZZZ(): 0.27 ms

所以,我会有日志,找出哪些功能导致se rver / CPU过载。有任何想法如何实现这一点?

so, i will have logs and find out which function causes server/CPU overload. Have you any ideas how to achieve this?

推荐答案

作为一个免费的分析PHP代码的工具,您可以使用XHProf。请参阅 https://github.com/phacility/xhprof

As a free tool for profiling php code you can use XHProf. See https://github.com/phacility/xhprof.

这篇关于找到哪个函数(文件)导致服务器重载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆