Esempio n. 1
0
 /**
  * Если
  */
 public function hookPreload()
 {
     if (!config('cache.guests')) {
         return;
     }
     $uri = $this->router->getUri();
     $uri or $uri = 'index';
     if (empty($_POST) && empty($_GET) && NULL == session('uid') && ($response = cache('pagecache/' . $uri))) {
         bench('done');
         $bench = bench();
         $data = humanize_bench($bench['done']);
         exit($response . '<!-- ' . round($data['time'], 3) . ' ' . $data['memory'] . '-->');
     }
 }
Esempio n. 2
0
<?php

$points = bench();
// Специально задаем нулевой элемент, потому что счёт ведется от единицы
$db_bench = array();
$total_time = 0;
$memory = 0;
foreach ($points as $key => $point) {
    if (0 === strpos($key, 'db.query')) {
        $memory += $point['memory'];
        $point = humanize_bench($point);
        $db_bench[] = $point;
        $total_time += $point['time'];
    }
}
echo t('<b>База данных:</b> %d <i class="icon icon-time"></i> %.3f<i class="icon icon-leaf"></i>%s', sizeof($queries), $total_time, File::fromBytes($memory));
?>
 <?php 
if ($queries) {
    ?>
<a id="db-trace-queries-handler" class="btn btn-mini"><i class="icon icon-eye-open"></i></a>
<div id="db-trace-queries" class="well" style="display:none;">
    <?php 
    foreach ($queries as $key => $query) {
        ?>
        <?php 
        echo icon('time') . ' ' . round($db_bench[$key]['time'], 4) . ' ' . icon('leaf') . ' ' . $db_bench[$key]['memory'];
        ?>
        <?php 
        echo '<code class="prettyprint lang-sql">' . $query . '</code>';
        ?>
Esempio n. 3
0
<div class="well">
    <?php 
event('dev.trace');
?>
    <?php 
$bench = bench();
$data = humanize_bench($bench['done']);
?>
    <p>
    <?php 
echo t('<b>Система:</b> ') . icon('time') . ' ' . round($data['time'], 3) . ' ' . icon('leaf') . $data['memory'];
?>
</div>