本文整理汇总了PHP中Profiler::app_total方法的典型用法代码示例。如果您正苦于以下问题:PHP Profiler::app_total方法的具体用法?PHP Profiler::app_total怎么用?PHP Profiler::app_total使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profiler
的用法示例。
在下文中一共展示了Profiler::app_total方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: class_alias
// Load in the Fuel autoloader
require COREPATH . 'classes' . DIRECTORY_SEPARATOR . 'autoloader.php';
class_alias('Fuel\\Core\\Autoloader', 'Autoloader');
// Boot the app
require APPPATH . 'bootstrap.php';
// Generate the request, execute it and send the output.
try {
$response = Request::forge()->execute()->response();
} catch (HttpNotFoundException $e) {
\Request::reset_request(true);
$route = array_key_exists('_404_', Router::$routes) ? Router::$routes['_404_']->translation : Config::get('routes._404_');
if ($route instanceof Closure) {
$response = $route();
if (!$response instanceof Response) {
$response = Response::forge($response);
}
} elseif ($route) {
$response = Request::forge($route, false)->execute()->response();
} else {
throw $e;
}
}
// Render the output
$response->body((string) $response);
// This will add the execution time and memory usage to the output.
// Comment this out if you don't use it.
if (strpos($response->body(), '{exec_time}') !== false or strpos($response->body(), '{mem_usage}') !== false) {
$bm = Profiler::app_total();
$response->body(str_replace(array('{exec_time}', '{mem_usage}'), array(round($bm[0], 4), round($bm[1] / pow(1024, 2), 3)), $response->body()));
}
$response->send(true);
示例2: finish
/**
* Cleans up Fuel execution, ends the output buffering, and outputs the
* buffer contents.
*
* @access public
* @return void
*/
public static function finish()
{
if (static::$caching && static::$paths_changed === true) {
static::cache('Fuel::path_cache', static::$path_cache);
}
// Grab the output buffer
$output = ob_get_clean();
if (static::$profiling) {
\Profiler::mark('End of Fuel Execution');
if (preg_match("|</body>.*?</html>|is", $output)) {
$output = preg_replace("|</body>.*?</html>|is", '', $output);
$output .= \Profiler::output();
$output .= '</body></html>';
} else {
$output .= \Profiler::output();
}
}
$bm = \Profiler::app_total();
// TODO: There is probably a better way of doing this, but this works for now.
$output = \str_replace(array('{exec_time}', '{mem_usage}'), array(round($bm[0], 4), round($bm[1] / pow(1024, 2), 3)), $output);
// Send the buffer to the browser.
echo $output;
}