Example #1
0
 /**
  * Set the location of the prettify library
  *
  * @see ProfilerRenderer::$prettifyLocation
  * @param string $url URL of the prettify library
  */
 public static function setPrettifyLocation($url)
 {
     self::$prettifyLocation = $url;
 }
    echo ProfilerRenderer::getJqueryLocation();
    ?>
" type="text/javascript" charset="utf-8"></script>
<?php 
}
?>

<?php 
if (ProfilerRenderer::includePrettify()) {
    ?>
	<script src="<?php 
    echo ProfilerRenderer::getPrettifyLocation();
    ?>
/prettify.js" type="text/javascript" charset="utf-8"></script>
	<script src="<?php 
    echo ProfilerRenderer::getPrettifyLocation();
    ?>
/lang-sql.js" type="text/javascript" charset="utf-8"></script>
<?php 
}
?>
<script type="text/javascript" charset="utf-8">
(function($)
{
	$('#pofiler-main_timer').click(function(event)
	{
		$(this).toggleClass('profiler-button_selected');
		$('.profiler-result-container').toggleClass('profiler-hidden');
	});
	
	var flagChildrenVisible = false;
Example #3
0
$options['bootstrap'] = false;
Libraries::add('li3_profiler', $options);
\Profiler::enable();
// Set our jQuery options.
if ($options['jquery']) {
    \ProfilerRenderer::setIncludeJquery(true);
    \ProfilerRenderer::setJqueryLocation($options['jquery']);
} else {
    \ProfilerRenderer::setIncludeJquery(false);
}
// Set our prettify options.
if ($options['prettify']) {
    \ProfilerRenderer::setIncludePrettify(true);
    \ProfilerRenderer::setPrettifyLocation($options['prettify']);
} else {
    \ProfilerRenderer::setIncludePrettify(false);
}
/**
 * Due to the way the `Environment` class determines the current configuration
 * we need to wait for the `Dispatcher` to start up before we know where we are.
 */
Filters::apply('lithium\\action\\Dispatcher', '_callable', function ($self, $params, $chain) {
    if (!Environment::is(Libraries::get('li3_profiler', 'environment'))) {
        // Enable the profiler.
        \Profiler::disable();
    } else {
        $controller = $chain->next($self, $params, $chain);
        if (Libraries::get('li3_profiler', 'inject')) {
            /**
             * If we have a `Controller` object we will filter it so that we can
             * inject our rendering HTML.
Example #4
0
<?php

date_default_timezone_set("UTC");
require "../profiler.php";
Profiler::enable();
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>