diff options
| author | czaks <marcin@6irc.net> | 2013-09-01 11:25:19 -0400 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2013-09-01 11:25:19 -0400 |
| commit | 069f1def9bf8c8d769afdc5740e9ff13271065bd (patch) | |
| tree | d60db9e7126ecb0e046b34c3faa3b49ca7bfd32e /inc/template.php | |
| parent | c2400568656e6bb8e629704d312322937d24fb2d (diff) | |
| parent | 22fcca343f8d4e820745a673972286b47a6a17ba (diff) | |
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
Conflicts:
install.php
Diffstat (limited to 'inc/template.php')
| -rw-r--r-- | inc/template.php | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/inc/template.php b/inc/template.php index 6d417631..378f36d0 100644 --- a/inc/template.php +++ b/inc/template.php @@ -45,19 +45,23 @@ function Element($templateFile, array $options) { } if (isset($options['body']) && $config['debug']) { + $_debug = $debug; + if (isset($debug['start'])) { - $debug['time'] = '~' . round((microtime(true) - $debug['start']) * 1000, 2) . 'ms'; - $debug['time (initialization)'] = '~' . round(($debug['start_debug'] - $debug['start']) * 1000, 2) . 'ms'; - unset($debug['start']); - unset($debug['start_debug']); + $_debug['time']['total'] = '~' . round((microtime(true) - $_debug['start']) * 1000, 2) . 'ms'; + $_debug['time']['init'] = '~' . round(($_debug['start_debug'] - $_debug['start']) * 1000, 2) . 'ms'; + unset($_debug['start']); + unset($_debug['start_debug']); } if ($config['try_smarter'] && isset($build_pages) && !empty($build_pages)) - $debug['build_pages'] = $build_pages; - $debug['included'] = get_included_files(); - $debug['memory'] = round(memory_get_usage(true) / (1024 * 1024), 2) . ' MiB'; + $_debug['build_pages'] = $build_pages; + $_debug['included'] = get_included_files(); + $_debug['memory'] = round(memory_get_usage(true) / (1024 * 1024), 2) . ' MiB'; + $_debug['time']['db_queries'] = '~' . round($_debug['time']['db_queries'] * 1000, 2) . 'ms'; + $_debug['time']['exec'] = '~' . round($_debug['time']['exec'] * 1000, 2) . 'ms'; $options['body'] .= '<h3>Debug</h3><pre style="white-space: pre-wrap;font-size: 10px;">' . - str_replace("\n", '<br/>', utf8tohtml(print_r($debug, true))) . + str_replace("\n", '<br/>', utf8tohtml(print_r($_debug, true))) . '</pre>'; } |
