heyday/silverstripe-xhprof 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

heyday/silverstripe-xhprof

最新稳定版本:0.0.1

Composer 安装命令:

composer require heyday/silverstripe-xhprof

包简介

README 文档

README

#Heyday xhprof

This module provides a SilverStripe-centric wrapper for the pecl package xhprof and the xhprof gui.

For a version compatible with SilverStripe 2.4 see the 1.0 branch.

##License

This project is licensed under an MIT license which can be found at silverstripe-xhprof/LICENSE

##Requirements

You will require xhprof installed in php to use silverstripe-xhprof. In order to create call graphs through the xhprof gui you will also need Graphviz.

##Installation

To install drop the silverstripe-xhprof directory into your SilverStripe root and run /dev/build?flush=1.

##How to use

You can use silverstripe-xhprof in two ways. As a global profiler or as a profiler of specific segments of code. Please note, you can't do both global profiling and local profiling in the same request.

###Global Profiling

####With Sake

Enable:

./sake xhprof/enable

Disable:

./sake xhprof/disable

####Without sake (you need to have ADMIN privedges)

Enable:

http://localhost/xhprof/enable

Disable:

http://localhost/xhprof/disable

Enabling global profiling edits your .htaccess file by adding two lines of code to the beginning, but silverstripe-xhprof makes a backup of your .htaccess which can be found in silverstripe-xhprof/code/GlobalProfile/backup/.

When you disable global profiling your .htaccess file will be restored from the backup.

###Local Profiling

To profile a specific segment of code you need to first ensure global profiling is disabled, and then you need to set up the requisite HeydayXhprof::start() and HeydayXhprof::end() calls.

<?php
HeydayXhprof::start('Potentially Troublesome Code');

//Code to profile

HeydayXhprof::end();

##Viewing saved profiles

For each profile made, there is a corresponding database record (HeydayXhprofRun) created. These database records store information about the request (url, query string etc) that the profiling occured on, and also the identifier to the profile.

To view profiles saved go to:

http://localhost/admin/xhprof/

All global profiles are saved under the App name of Global.

##Configuation

There are a couple of configuation options available when profiling. Global config options can be set in a php file located at:

./mysite/_config_xhprof.php

When global profiling is enabled, this file (if it exists) is included before any SilverStripe code is included.

###Limiting global profiling by probability

To limit requests profiled you can use a probability. This useful for profiling on live server under load.

<?php
HeydayXhprof::setProbability(2/3);

This example would make the probability of a profile being made 2 in 3

<?php
HeydayXhprof::setProbability(1/1000);

This example would make the probability of a profile being made 1 in 1000

###Limiting local profiling by probability

<?php
if (HeydayXhprof::testProbability(1/100)) {

	HeydayXhprof::start('Potentially Troublesome Code');

}

//Code to profile

if (HeydayXhprof::isStarted()) {

	HeydayXhprof::end();

}

###Excluding urls by partial matching (specifically strpos)

To exclude certain urls:

<?php
HeydayXhprof::addExclusions(array(
	'/admin/xhprof/',
	'/Security/ping'
));

##Unit Testing

If you have phpunit installed you can run silverstripe-xhprof's unit tests to see if everything is functioning correctly.

###Running the unit tests

From the command line:

./sake dev/tests/module/silverstripe-xhprof

From your browser:

http://localhost/dev/tests/module/silverstripe-xhprof

##Contributing

###Code guidelines

This project follows the standards defined in:

统计信息

  • 总下载量: 117
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 25
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2014-11-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固