[*] FO : Code cleaning, optimizations, new callstack available in the profiling tools

This commit is contained in:
Damien Metzger
2013-11-29 14:21:22 +01:00
parent 5c3f43141b
commit 9dc075ca39
5 changed files with 63 additions and 76 deletions
+11 -11
View File
@@ -95,24 +95,24 @@ abstract class Db extends DbCore
// Execute query
$start = microtime(true);
}
$result = parent::query($sql);
if (!$explain)
{
$end = microtime(true);
// Save details
$timeSpent = $end - $start;
$trace = debug_backtrace(false);
while (preg_match('@[/\\\\]classes[/\\\\]db[/\\\\]@i', $trace[0]['file']))
array_shift($trace);
$stack = debug_backtrace(false);
while (preg_match('@[/\\\\]classes[/\\\\]db[/\\\\]@i', $stack[0]['file']))
array_shift($stack);
$stack_light = array();
foreach ($stack as $call)
$stack_light[] = array('file' => $call['file'], 'line' => $call['line']);
$this->queries[] = array(
'query' => $sql,
'time' => $timeSpent,
'file' => $trace[0]['file'],
'line' => $trace[0]['line'],
'time' => $end - $start,
'stack' => $stack_light
);
}