epwt/xhprof

EPWT XHProf Symfony 性能分析器集成

v1.0.0 2015-04-20 11:13 UTC

This package is auto-updated.

Last update: 2024-09-17 17:48:20 UTC


README

Latest Stable Version Latest Unstable Version Total Downloads Analytics

EPWTXhprofBundle 为 Symfony 性能分析器提供了 XHProf 集成,并在项目中任何地方为 XHProf 提供包装器以方便简单使用。

Toolbar

Samples List Sample Runs Sample Run Full Sample Run

需求

  • Symfony >= 2.3
  • PHP >= 5.4
  • Facebook XHProf 扩展

通过 Composer 安装

composer require --dev epwt/xhprof "~1.0"

设置

在 AppKernel.php 文件中注册 EPWTXhprofBundle。建议只在开发或测试环境中使用。

AppKernel.php

public function registerBundles()
{
	if (in_array($this->getEnvironment(), array('dev', 'test'))) {
		$bundles[] = new EPWT\XhprofBundle\EPWTXhprofBundle();
	}
}

用法

要在项目中任何地方使用 XHProf,只需使用全局函数启动性能分析即可。

xhprofStart('Name of sample');

要结束性能分析,使用

xhprofEnd();

示例用法

for($a = 0; $a < 20; $a++) {
    xhprofStart('Hello world');
    for ($i = 0; $i < 20; $i ++) {
        sleep(0.1);
    }
    xhprofEnd();
}

许可证

此包采用 MIT 许可证。请参阅包中的完整许可证。

Resources/meta/LICENSE

关于

EPWTXhprofBundle 由 Aurimas Niekis 提供。

报告问题或功能请求

问题和功能请求在 Github 问题跟踪器 中跟踪。

在报告错误时,最好在基本项目中重现它,该项目使用 Symfony Standard Edition 构建,以便包的开发者通过简单地克隆它并遵循一些步骤来重现问题。