15 $this->_logsEnabled =
true;
16 $this->_logsLevels = CLogger::LEVEL_PROFILE;
27 return $this->
render(dirname(__FILE__) .
'/../views/panels/profiling_bar.php', array(
28 'time' => number_format($this->data[
'time'] * 1000) .
' ms',
29 'memory' => sprintf(
'%.1f MB', $this->data[
'memory'] / 1048576),
35 $messages = $this->data[
'messages'];
38 foreach ($messages as
$i => $log) {
39 list($token, , $category, $timestamp) = $log;
41 if (strpos($token,
'begin:') === 0) {
42 $log[0] = $token = substr($token, 6);
44 } elseif (strpos($token,
'end:') === 0) {
45 $log[0] = $token = substr($token, 4);
46 if (($last = array_pop($stack)) !== null && $last[0] === $token) {
47 $timings[$last[4]] = array(count($stack), $token, $category, $timestamp - $last[3]);
51 $now = microtime(
true);
52 while (($last = array_pop($stack)) !== null) {
53 $delta = $now - $last[3];
54 $timings[$last[4]] = array(count($stack), $last[0], $last[2], $delta);
58 foreach ($timings as $timing) {
60 'indent' => $timing[0],
61 'procedure' => $timing[1],
62 'category' => $timing[2],
63 'time' => sprintf(
'%.1f ms', $timing[3] * 1000),
66 return $this->
render(dirname(__FILE__) .
'/../views/panels/profiling.php', array(
68 'time' => number_format($this->data[
'time'] * 1000) .
' ms',
69 'memory' => sprintf(
'%.1f MB', $this->data[
'memory'] / 1048576),
76 'memory' => memory_get_peak_usage(),
77 'time' => microtime(
true) - YII_BEGIN_TIME,