Merge branch 'master' into tests

This commit is contained in:
Anton Terekhov
2011-10-20 12:44:36 +04:00
15 changed files with 109 additions and 153 deletions

View File

@ -101,4 +101,20 @@ class Profiler
}
FB::table('Queries: ' . count($this->queries) . ' [' . round($queriesTime * 1000, 2) . ' ms]', $table);
}
public function getCli()
{
$this->end = microtime(true);
$queriesTime = 0;
$temp = str_pad(PHP_EOL, 60, '-', STR_PAD_LEFT);
foreach ($this->queries as $query) {
$temp .= sprintf('%-25s[% 10sms] %s', '(' . $query->getType() .')', round($query->getElapsed() * 1000, 2), $query->getCommand()) . PHP_EOL;
$queriesTime += $query->getElapsed();
}
$html = str_pad(PHP_EOL, 60, '-', STR_PAD_LEFT);
$html .= 'Elapsed time: ' . round(($this->end - $this->start) * 1000, 2) . 'ms.' . PHP_EOL
. 'Queries: ' . count($this->queries) . ' [' . round($queriesTime * 1000, 2) . ' ms] ' . PHP_EOL;
$html .= $temp;
return $html;
}
}