Add Profiler support report message with turn on PROFILER_DETAILS (if use to show queries). Modified tests MongoStatementTest, MySQLiStatementTest. Adding new tests to ProfilerTest.
This commit is contained in:
@ -80,8 +80,12 @@ class Profiler
|
||||
$queriesTime += $query->getElapsed();
|
||||
}
|
||||
$html = '<div style="clear:both; font:12px monospace; margin: 5px; white-space: pre;">'
|
||||
. 'Elapsed time: ' . round(($this->end - $this->start) * 1000, 2) . 'ms.<br/>'
|
||||
. 'Queries: ' . count($this->queries) . ' [' . round($queriesTime * 1000, 2) . ' ms]<br/>';
|
||||
. 'Elapsed time: ' . round(($this->end - $this->start) * 1000, 2) . 'ms.<br/>';
|
||||
if (count($this->queries) == 0 && !Config::get('PROFILER_DETAILS')) {
|
||||
$html .= 'Queries not counted. Turn PROFILER_DETAILS on true, if you want to profile queries.<br>';
|
||||
} else {
|
||||
$html .= 'Queries: ' . count($this->queries) . ' [' . round($queriesTime * 1000, 2) . ' ms]<br/>';
|
||||
}
|
||||
$html .= $temp;
|
||||
$html .= '</div>';
|
||||
return $html;
|
||||
@ -99,7 +103,11 @@ class Profiler
|
||||
$table[] = array($query->getType(), round($query->getElapsed() * 1000, 2), $query->getCommand());
|
||||
$queriesTime += $query->getElapsed();
|
||||
}
|
||||
FB::table('Queries: ' . count($this->queries) . ' [' . round($queriesTime * 1000, 2) . ' ms]', $table);
|
||||
if (count($this->queries) == 0 && !Config::get('PROFILER_DETAILS')) {
|
||||
FB::table('Queries not counted. Turn PROFILER_DETAILS on true, if you want to profile queries.', $table);
|
||||
} else {
|
||||
FB::table('Queries: ' . count($this->queries) . ' [' . round($queriesTime * 1000, 2) . ' ms]', $table);
|
||||
}
|
||||
}
|
||||
|
||||
public function getCli()
|
||||
@ -112,8 +120,12 @@ class Profiler
|
||||
$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 .= 'Elapsed time: ' . round(($this->end - $this->start) * 1000, 2) . 'ms.' . PHP_EOL;
|
||||
if (count($this->queries) == 0 && !Config::get('PROFILER_DETAILS')) {
|
||||
$html .= 'Queries not counted. Turn PROFILER_DETAILS on true, if you want to profile queries.' . PHP_EOL;
|
||||
} else {
|
||||
$html .= 'Queries: ' . count($this->queries) . ' [' . round($queriesTime * 1000, 2) . ' ms] ' . PHP_EOL;
|
||||
}
|
||||
$html .= $temp;
|
||||
return $html;
|
||||
}
|
||||
|
Reference in New Issue
Block a user