mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-24 20:13:22 +01:00
[ticket/12704] Improve the load time information in the footer when enabled
PR #2570 has added new constant to display load time information without debug mode is being on (https://tracker.phpbb.com/browse/PHPBB3-12687). This patch expands the total load time info with SQL/PHP load times, while hiding the additional info with <abbr> element. PHPBB3-12704
This commit is contained in:
parent
7642fbbd63
commit
f850d5fa90
@ -5064,10 +5064,10 @@ function phpbb_generate_debug_output(phpbb\db\driver\driver_interface $db, \phpb
|
||||
if (isset($GLOBALS['starttime']))
|
||||
{
|
||||
$totaltime = microtime(true) - $GLOBALS['starttime'];
|
||||
$debug_info[] = sprintf('Time: %.3fs', $totaltime);
|
||||
$debug_info[] = sprintf('<abbr title="SQL time: %.3fs / PHP time: %.3fs">Time: %.3fs</abbr>', $db->sql_time, ($totaltime - $db->sql_time), $totaltime);
|
||||
}
|
||||
|
||||
$debug_info[] = $db->sql_num_queries() . ' Queries (' . $db->sql_num_queries(true) . ' cached)';
|
||||
$debug_info[] = sprintf('<abbr title="Cached: %d">Queries: %d</abbr>', $db->sql_num_queries(true), $db->sql_num_queries());
|
||||
|
||||
$memory_usage = memory_get_peak_usage();
|
||||
if ($memory_usage)
|
||||
|
@ -140,6 +140,10 @@ class firebird extends \phpbb\db\driver\driver
|
||||
{
|
||||
$this->sql_report('start', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
{
|
||||
$this->curtime = microtime(true);
|
||||
}
|
||||
|
||||
$this->last_query_text = $query;
|
||||
$this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false;
|
||||
@ -241,6 +245,10 @@ class firebird extends \phpbb\db\driver\driver
|
||||
{
|
||||
$this->sql_report('stop', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
{
|
||||
$this->sql_time += microtime(true) - $this->curtime;
|
||||
}
|
||||
|
||||
if (!$this->transaction)
|
||||
{
|
||||
|
@ -137,6 +137,10 @@ class mssql extends \phpbb\db\driver\driver
|
||||
{
|
||||
$this->sql_report('start', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
{
|
||||
$this->curtime = microtime(true);
|
||||
}
|
||||
|
||||
$this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false;
|
||||
$this->sql_add_num_queries($this->query_result);
|
||||
@ -152,6 +156,10 @@ class mssql extends \phpbb\db\driver\driver
|
||||
{
|
||||
$this->sql_report('stop', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
{
|
||||
$this->sql_time += microtime(true) - $this->curtime;
|
||||
}
|
||||
|
||||
if ($cache && $cache_ttl)
|
||||
{
|
||||
|
@ -156,6 +156,10 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base
|
||||
{
|
||||
$this->sql_report('start', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
{
|
||||
$this->curtime = microtime(true);
|
||||
}
|
||||
|
||||
$this->last_query_text = $query;
|
||||
$this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false;
|
||||
@ -172,6 +176,10 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base
|
||||
{
|
||||
$this->sql_report('stop', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
{
|
||||
$this->sql_time += microtime(true) - $this->curtime;
|
||||
}
|
||||
|
||||
if ($cache && $cache_ttl)
|
||||
{
|
||||
|
@ -127,6 +127,10 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
|
||||
{
|
||||
$this->sql_report('start', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
{
|
||||
$this->curtime = microtime(true);
|
||||
}
|
||||
|
||||
$this->last_query_text = $query;
|
||||
$this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false;
|
||||
@ -145,6 +149,10 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
|
||||
{
|
||||
$this->sql_report('stop', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
{
|
||||
$this->sql_time += microtime(true) - $this->curtime;
|
||||
}
|
||||
|
||||
if ($cache && $cache_ttl)
|
||||
{
|
||||
|
@ -166,6 +166,10 @@ class mysql extends \phpbb\db\driver\mysql_base
|
||||
{
|
||||
$this->sql_report('start', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
{
|
||||
$this->curtime = microtime(true);
|
||||
}
|
||||
|
||||
$this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false;
|
||||
$this->sql_add_num_queries($this->query_result);
|
||||
@ -181,6 +185,10 @@ class mysql extends \phpbb\db\driver\mysql_base
|
||||
{
|
||||
$this->sql_report('stop', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
{
|
||||
$this->sql_time += microtime(true) - $this->curtime;
|
||||
}
|
||||
|
||||
if ($cache && $cache_ttl)
|
||||
{
|
||||
|
@ -165,6 +165,10 @@ class mysqli extends \phpbb\db\driver\mysql_base
|
||||
{
|
||||
$this->sql_report('start', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
{
|
||||
$this->curtime = microtime(true);
|
||||
}
|
||||
|
||||
$this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false;
|
||||
$this->sql_add_num_queries($this->query_result);
|
||||
@ -180,6 +184,10 @@ class mysqli extends \phpbb\db\driver\mysql_base
|
||||
{
|
||||
$this->sql_report('stop', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
{
|
||||
$this->sql_time += microtime(true) - $this->curtime;
|
||||
}
|
||||
|
||||
if ($cache && $cache_ttl)
|
||||
{
|
||||
|
@ -253,6 +253,10 @@ class oracle extends \phpbb\db\driver\driver
|
||||
{
|
||||
$this->sql_report('start', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
{
|
||||
$this->curtime = microtime(true);
|
||||
}
|
||||
|
||||
$this->last_query_text = $query;
|
||||
$this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false;
|
||||
@ -430,6 +434,10 @@ class oracle extends \phpbb\db\driver\driver
|
||||
{
|
||||
$this->sql_report('stop', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
{
|
||||
$this->sql_time += microtime(true) - $this->curtime;
|
||||
}
|
||||
|
||||
if ($cache && $cache_ttl)
|
||||
{
|
||||
|
@ -179,6 +179,10 @@ class postgres extends \phpbb\db\driver\driver
|
||||
{
|
||||
$this->sql_report('start', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
{
|
||||
$this->curtime = microtime(true);
|
||||
}
|
||||
|
||||
$this->last_query_text = $query;
|
||||
$this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false;
|
||||
@ -195,6 +199,10 @@ class postgres extends \phpbb\db\driver\driver
|
||||
{
|
||||
$this->sql_report('stop', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
{
|
||||
$this->sql_time += microtime(true) - $this->curtime;
|
||||
}
|
||||
|
||||
if ($cache && $cache_ttl)
|
||||
{
|
||||
|
@ -121,6 +121,10 @@ class sqlite extends \phpbb\db\driver\driver
|
||||
{
|
||||
$this->sql_report('start', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
{
|
||||
$this->curtime = microtime(true);
|
||||
}
|
||||
|
||||
$this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false;
|
||||
$this->sql_add_num_queries($this->query_result);
|
||||
@ -136,6 +140,10 @@ class sqlite extends \phpbb\db\driver\driver
|
||||
{
|
||||
$this->sql_report('stop', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
{
|
||||
$this->sql_time += microtime(true) - $this->curtime;
|
||||
}
|
||||
|
||||
if ($cache && $cache_ttl)
|
||||
{
|
||||
|
@ -121,6 +121,10 @@ class sqlite3 extends \phpbb\db\driver\driver
|
||||
{
|
||||
$this->sql_report('start', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
{
|
||||
$this->curtime = microtime(true);
|
||||
}
|
||||
|
||||
$this->last_query_text = $query;
|
||||
$this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false;
|
||||
@ -137,6 +141,10 @@ class sqlite3 extends \phpbb\db\driver\driver
|
||||
{
|
||||
$this->sql_report('stop', $query);
|
||||
}
|
||||
else if (defined('PHPBB_DISPLAY_LOAD_TIME'))
|
||||
{
|
||||
$this->sql_time += microtime(true) - $this->curtime;
|
||||
}
|
||||
|
||||
if ($cache && $cache_ttl)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user