设为首页 加入收藏

TOP

PHP程序运行性能分析
2019-08-23 00:35:31 】 浏览:14
Tags:PHP 程序 运行 性能 分析

php在使用了xdebug后,可以配置xdebug相关的配置,生成运行的日志。

在php.ini中配置:

  1. xdebug.profiler_enable = 1
  2. xdebug.profiler_enable_trigger = 1
  3. xdebug.profiler_output_name = cachegrind.out.%t.%p
  4. xdebug.profiler_output_dir ="d:/xdebug/"

这样,日志文件就行生成到d:/xdebug/目录下:

clip_image002

每执行一次php后,就会生成一个对应的日志文件。以前有一款工具叫 WinCacheGrind可以用来分析这种日志,但是WinCacheGrind在2015年的时候就已经不再维护了,最新版本是1.0.0.14,只支持xdebug2,打开日志文件,会报错:“Cannot find target”。

其实,强大的phpstorm自带了性能日志分析的功能,打开Tools->Analyze Xdebug Profiler Snapshot..

clip_image004

再选择D:\xdebug下的日志文件,打开后就可以看到函数调用的树形关系,以及每个函数执行的时间

clip_image006

这样,就能找出哪一个函数执行比较耗时。

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇mac php项目除了首页全飘not found 下一篇[PHP] foreach循环的引用赋值可能..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目