本文整理汇总了PHP中Profiler::sqlStart方法的典型用法代码示例。如果您正苦于以下问题:PHP Profiler::sqlStart方法的具体用法?PHP Profiler::sqlStart怎么用?PHP Profiler::sqlStart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profiler
的用法示例。
在下文中一共展示了Profiler::sqlStart方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: usleep
ProfilerRenderer::setIncludeJquery(true);
ProfilerRenderer::setJqueryLocation('https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js');
ProfilerRenderer::setPrettifyLocation("../code-prettify");
$s1 = Profiler::start('Step 1');
//do some important things!
usleep(500000);
// 0.5 sec
$s1->end();
$s2 = Profiler::start('Step 2');
//more important things
usleep(100000);
// 0.1 sec
$s3 = Profiler::start('Step 3');
//some nested things..that are important and stuff.
sleep(1);
$sql = Profiler::sqlStart("SELECT * FROM TABLE WHERE 1");
usleep(1500000);
// 1.5 sec
$sql->end();
$s3->end();
$s2->end();
?>
<!DOCTYPE html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>php-profiler demo</title>
</head>
<body>
<?php
Profiler::render();
示例2: function
// Define used classes.
use lithium\util\collection\Filters;
use lithium\data\Connections;
// Attach to the `Connections` adapters after dispatch.
Filters::apply('\\lithium\\action\\Dispatcher', '_callable', function ($self, $params, $chain) {
/**
* Loop over all defined `Connections` adapters and tack in our
* filter on the `_execute` method.
*/
foreach (Connections::get() as $connection) {
$connection = Connections::get($connection);
$connection->applyFilter('_execute', function ($self, $params, $chain) {
$profiler = \Profiler::sqlStart($params['sql']);
$response = $chain->next($self, $params, $chain);
$profiler->end();
return $response;
});
$connection->applyFilter('read', function ($self, $params, $chain) {
$response = $chain->next($self, $params, $chain);
\Profiler::start($response->model());
$info = $response->result()->resource();
$profiler = \Profiler::sqlStart(json_encode($info->info()));
$profiler->end();
\Profiler::end($response->model());
return $response;
});
}
// Return the controller.
return $chain->next($self, $params, $chain);
});
示例3: sqlStart
public static function sqlStart($query)
{
return Profiler::sqlStart($query);
}