diff options
| author | Michael Foster <savetheinternet@tinyboard.org> | 2013-08-30 08:39:11 +1000 |
|---|---|---|
| committer | Michael Foster <savetheinternet@tinyboard.org> | 2013-08-30 08:39:11 +1000 |
| commit | 343803afb9de3b27ba44d9594b6770f9c84d2e54 (patch) | |
| tree | 95e429f5ab6875f5ce41e54702ff94aa357d5d9b /inc/functions.php | |
| parent | 8921eb9c1a43e13e096fe72850d75dcf2974483f (diff) | |
More $config['debug'] improvements to time-related stuff
Diffstat (limited to 'inc/functions.php')
| -rw-r--r-- | inc/functions.php | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/inc/functions.php b/inc/functions.php index e634b87e..6c18ce3e 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -81,14 +81,6 @@ function loadConfig() { $__version = file_exists('.installed') ? trim(file_get_contents('.installed')) : false; $config['version'] = $__version; - if ($config['debug']) { - if (!isset($debug)) { - $debug = array('sql' => array(), 'exec' => array(), 'purge' => array(), 'cached' => array(), 'write' => array()); - $debug['start'] = $microtime_start; - $debug['start_debug'] = microtime(true);; - } - } - date_default_timezone_set($config['timezone']); if (!isset($config['global_message'])) @@ -199,6 +191,25 @@ function loadConfig() { if ($config['cache']['enabled']) require_once 'inc/cache.php'; event('load-config'); + + if ($config['debug']) { + if (!isset($debug)) { + $debug = array( + 'sql' => array(), + 'exec' => array(), + 'purge' => array(), + 'cached' => array(), + 'write' => array(), + 'time' => array( + 'db_queries' => 0, + 'exec' => 0, + ), + 'start' => $microtime_start, + 'start_debug' => microtime(true) + ); + $debug['start'] = $microtime_start; + } + } } function basic_error_function_because_the_other_isnt_loaded_yet($message, $priority = true) { @@ -2056,12 +2067,13 @@ function shell_exec_error($command, $suppress_stdout = false) { $return = preg_replace('/TB_SUCCESS$/', '', $return); if ($config['debug']) { - $time = round((microtime(true) - $start) * 1000, 2) . 'ms'; + $time = microtime(true) - $start; $debug['exec'][] = array( 'command' => $command, - 'time' => '~' . $time, + 'time' => '~' . round($time * 1000, 2) . 'ms', 'response' => $return ? $return : null ); + $debug['time']['exec'] += $time; } return $return === 'TB_SUCCESS' ? false : $return; |
