本文整理汇总了PHP中xhprof_enable函数的典型用法代码示例。如果您正苦于以下问题:PHP xhprof_enable函数的具体用法?PHP xhprof_enable怎么用?PHP xhprof_enable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xhprof_enable函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testSearchEvents
public function testSearchEvents()
{
$allUsers = Tinebase_User::getInstance()->getFullUsers('');
xhprof_enable();
$numSearches = 0;
foreach ($allUsers as $user) {
if ($numSearches > 5) {
break;
}
echo "getting month view for {$user->accountDisplayName}\n";
$filterData = array(array('field' => 'container_id', 'operator' => 'in', 'value' => array('/personal/' . $user->getId(), '/shared')), array('field' => 'period', 'operator' => 'within', 'value' => array('from' => '2010-03-01 00:00:00', 'until' => '2010-04-01 00:00:00')));
// $filter = new Calendar_Model_EventFilter($filterData);
// $events = Calendar_Controller_Event::getInstance()->search($filter, NULL, FALSE);
$this->_json->searchEvents($filterData, NULL);
$numSearches += 1;
}
$xhprof_data = xhprof_disable();
//Tinebase_Core::getDbProfiling();
$XHPROF_ROOT = '/opt/local/www/php5-xhprof';
include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_lib.php";
include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_runs.php";
$xhprof_runs = new XHProfRuns_Default();
$run_id = $xhprof_runs->save_run($xhprof_data, "xhprof_tine20");
echo "http://localhost/xhprof_html/index.php?run={$run_id}&source=xhprof_tine20 \n";
print_r(Tinebase_Record_Abstract::$cns);
}
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:26,代码来源:performanceTests.php
示例2: start
/**
* Start XHProf
*/
public static function start()
{
self::$_isStarted = true;
if (self::$_isEnabled && function_exists("xhprof_enable")) {
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
}
}
开发者ID:openbizx,项目名称:openbizx,代码行数:10,代码来源:XHProf.php
示例3: init
/**
* Initialize workflow
*
* @param ModuleManagerInterface $manager
* @return void
*/
public function init(ModuleManagerInterface $manager)
{
$eventManager = $manager->getEventManager();
$eventManager->attach(ProfilerEvent::EVENT_PROFILER_INIT, function () {
xhprof_enable(XHPROF_FLAGS_MEMORY);
});
}
开发者ID:skpd,项目名称:profiler-toolbar,代码行数:13,代码来源:Module.php
示例4: handle
public function handle(EventInterface $event)
{
xhprof_enable();
if ($this->logger) {
$this->logger->debug('Enabled XHProf');
}
}
开发者ID:hex337,项目名称:XhprofBundle,代码行数:7,代码来源:RequestListener.php
示例5: start
/**
* Start xhprof profiler
*/
public function start()
{
if (!extension_loaded('xhprof')) {
throw new \RuntimeException('xhprof extension is not loaded');
}
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
}
开发者ID:itkg,项目名称:profiler,代码行数:10,代码来源:XhprofDataCollector.php
示例6: profileClosure
/**
* Profile the code contained inside the closure, returning
* an array of XHProf profiling information. Optionally
* filtered by a set of regular expressions which the called
* function/class must match for the result to be returned.
*
* Special note: the $flags default value is hardcoded to
* avoid errors when xhprof is not loaded - instead, this
* causes a graceful "test skipped".
*
* @param \Closure $closure A standard Closure that will execute exactly the code that will be profiled, nothing more.
* @param array $methodMatchExpressions An array of PERL regular expressions to filter which methods' results are returned.
* @param integer $flags Standard XHPROF flags for what gets profiled. Default excludes built-in functions and CPU/memory.
* @param array $options Optional further options (second argument for xhprof_enable).
* @return array
*/
protected function profileClosure(\Closure $closure, array $methodMatchExpressions = array(), $flags = 1, $options = array())
{
if (!$this->isProfilingExtensionLoaded()) {
$this->markTestSkipped('XHProf is not installed; test must be skipped');
}
$folder = vfsStream::newDirectory('profiles');
$backup = ini_set('xhprof.output_dir', vfsStream::url('profiles'));
xhprof_enable($flags, $options);
$closure();
$profile = xhprof_disable();
ini_set('xhprof.output_dir', $backup);
if (!empty($methodMatchExpressions)) {
foreach ($profile as $methodIdentifier => $_) {
$keep = FALSE;
foreach ($methodMatchExpressions as $expression) {
if (preg_match($expression, $methodIdentifier)) {
$keep = TRUE;
}
}
if (!$keep) {
unset($profile[$methodIdentifier]);
}
}
}
return $profile;
}
开发者ID:namelesscoder,项目名称:phpunit-xhprof,代码行数:42,代码来源:ProfilingTrait.php
示例7: profileStart
/**
* Start profiling the code
*/
public function profileStart()
{
// don't profile internal php functions
// show memory output
\xhprof_enable(XHPROF_FLAGS_NO_BUILTINS | XHPROF_FLAGS_MEMORY);
$this->xhprof_on = true;
}
开发者ID:hjr3,项目名称:crimson,代码行数:10,代码来源:Profile.php
示例8: start
/**
* Metoda odpowiada za uruchomienie profilowania
*
* @access public
* @static
*/
public static function start() {
$xhp_config = Xhprof_XHProfConfigFile::getInstance();
$xhprof_enabled = $xhp_config->checkXhprofEnabled();
if ($xhprof_enabled) {
xhprof_enable(XHPROF_FLAGS_MEMORY + XHPROF_FLAGS_CPU);
}
}
开发者ID:knatorski,项目名称:SMS,代码行数:13,代码来源:XHProfStartStop.php
示例9: index
public function index()
{
function bar($x)
{
if ($x > 0) {
bar($x - 1);
}
}
function foo()
{
for ($idx = 0; $idx < 5; $idx++) {
bar($idx);
$x = strlen("abc");
}
}
//开启调试
xhprof_enable();
// cpu:XHPROF_FLAGS_CPU 内存:XHPROF_FLAGS_MEMORY
// 如果两个一起:XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
//要测试的php代码
foo();
//停止监测
$xhprof_data = xhprof_disable();
// display raw xhprof data for the profiler run
print_r($xhprof_data);
//包含工具类,在下载的 tgz 包中可以找到
//$XHPROF_ROOT = realpath(dirname(__FILE__) .'/..');
Vendor('Xhprof.autoload');
//Vendor('Xhprof.xhprof_runs');
//include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_lib.php";
//include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_runs.php";
// save raw data for this profiler run using default
// implementation of iXHProfRuns.
}
开发者ID:waqt,项目名称:kdweb,代码行数:35,代码来源:PerformanceController.class.php
示例10: startProfiler
public static function startProfiler()
{
self::includeXHProfLib();
// Note: HPHP's implementation of XHProf currently requires an argument
// to xhprof_enable() -- see Facebook Task #531011.
xhprof_enable(0);
}
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:7,代码来源:DarkConsoleXHProfPluginAPI.php
示例11: profilerStart
/**
* Start to profile with xhprof
*
* @return void
*/
public function profilerStart()
{
if (extension_loaded('xhprof')) {
include_once $this->xhprofLibPath . 'utils/xhprof_lib.php';
include_once $this->xhprofLibPath . 'utils/xhprof_runs.php';
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
}
}
开发者ID:Apen,项目名称:t3devapi,代码行数:13,代码来源:class.tx_t3devapi_profiler.php
示例12: preHandle
/**
* 前置拦截器,在所有Action运行全会进行拦截
* 如果返回true,则拦截通过;如果返回false,则拦截
* @return boolean 返回布尔类型,如果返回false,则截断
*/
public function preHandle()
{
$config = InitPHP::getConfig();
if ($config['is_xhprof']) {
xhprof_enable();
}
return true;
}
开发者ID:pwstrick,项目名称:grape,代码行数:13,代码来源:testInterceptor.php
示例13: start
public function start()
{
if (!$this->getSwitch()) {
return FALSE;
}
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
$this->timeStart = microtime(TRUE);
}
开发者ID:sdgdsffdsfff,项目名称:xhprof_server,代码行数:8,代码来源:SnakeXhprof.class.php
示例14: routerStartup
public function routerStartup(Yaf\Request_Abstract $request, Yaf\Response_Abstract $response)
{
//只能在php.ini中指定
//ini_set('xhprof.output_dir', APPLICATION_PATH . '/data');
// start profiling
// xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
xhprof_enable();
}
开发者ID:loncool,项目名称:yaf-admin,代码行数:8,代码来源:Xhprof.php
示例15: enable
/**
* Start xhprof profiler
*/
public static function enable($flags = 0, $options = [])
{
if (self::isEnabled()) {
throw new Exception('Xhprof profiling is already enabled.');
}
self::$enabled = true;
xhprof_enable($flags, $options);
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:11,代码来源:Xhprof.php
示例16: bootstrap
/**
* Bootstrap method to be called during application bootstrap stage.
* @param Application $app the application currently running
*/
public function bootstrap($app)
{
if ((isset($_GET['_xhprof']) || isset($_COOKIE['_xhprof'])) && function_exists('xhprof_enable')) {
$app->on(Application::EVENT_BEFORE_REQUEST, function () use($app) {
\xhprof_enable(\XHPROF_FLAGS_CPU + \XHPROF_FLAGS_MEMORY);
});
}
}
开发者ID:hassiumsoft,项目名称:hasscms-app-vendor,代码行数:12,代码来源:XhprofPanel.php
示例17: startProfiling
public function startProfiling()
{
$this->profiling = true;
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
if ($this->logger) {
$this->logger->debug('Enabled XHProf');
}
}
开发者ID:nzzdev,项目名称:XhprofBundle,代码行数:8,代码来源:XhprofCollector.php
示例18: xhprof_start
function xhprof_start()
{
// 打开xhprof
global $xhprof_enabled;
if ($xhprof_enabled) {
xhprof_enable();
$GLOBALS['AX_XHPROF_IS_RUN'] = true;
}
}
开发者ID:songliang89,项目名称:auto-xhprof,代码行数:9,代码来源:auto-xhprof.php
示例19: __construct
/**
* Constructor
*
* @param string $sourceId The application identifier
* @param array $options Custom options
* - flags : XHPROF_FLAGS_XXXX constants for xhprof_enable()
* - libPath : Path to xhprof PHP classes (default: xhprof_lib/utils)
* - baseUrl : Base URL for the XHProf viewer (default: /)
* - output : If true will append an html link to the HTML response (default: false)
*/
public function __construct($sourceId, $options = array())
{
$this->_source = $sourceId;
$this->_options = $options;
if (function_exists('xhprof_enable')) {
$flags = isset($options['flags']) ? $options['flags'] : XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY;
xhprof_enable($flags);
}
}
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:19,代码来源:XHProf.php
示例20: start
public function start()
{
if (!function_exists('xhprof_enable')) {
return false;
} else {
xhprof_enable(XHPROF_FLAGS_CPU | XHPROF_FLAGS_MEMORY);
return true;
}
}
开发者ID:thbourlove,项目名称:xhgui-extension,代码行数:9,代码来源:Extension.php
注:本文中的xhprof_enable函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论