mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 13:54:02 -07:00
fix: Incorrect rounding in execution time counter (#1899)
* fix: Incorrect rounding in execution time counter * Update page_footer.php
This commit is contained in:
parent
14086a0ed6
commit
781b7240c4
5 changed files with 7 additions and 7 deletions
|
@ -39,7 +39,7 @@ foreach ($sql as $i => $query) {
|
|||
echo '</table>';
|
||||
echo '<div align="center"><pre>';
|
||||
|
||||
echo 'gen time: <b>' . sprintf('%.4f', array_sum(explode(' ', microtime())) - TIMESTART) . "</b> sec\n";
|
||||
echo 'gen time: <b>' . sprintf('%.3f', array_sum(explode(' ', microtime())) - TIMESTART) . "</b> sec\n";
|
||||
|
||||
echo '</pre></div>';
|
||||
echo '</body></html>';
|
||||
|
|
|
@ -173,7 +173,7 @@ echo '</table>';
|
|||
echo !$client_full ? '<p style = "text-align:right;">Simple stats for clients are being cached for one hour.</p>' : '';
|
||||
echo '<div align="center"><pre>';
|
||||
|
||||
echo 'gen time: <b>' . sprintf('%.4f', array_sum(explode(' ', microtime())) - TIMESTART) . "</b> sec\n";
|
||||
echo 'gen time: <b>' . sprintf('%.3f', array_sum(explode(' ', microtime())) - TIMESTART) . "</b> sec\n";
|
||||
echo '</pre></div>';
|
||||
echo '</body></html>';
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ if (!$bb_cfg['gzip_compress']) {
|
|||
|
||||
if ($show_dbg_info) {
|
||||
$gen_time = utime() - TIMESTART;
|
||||
$gen_time_txt = sprintf('%.4f', $gen_time);
|
||||
$gen_time_txt = sprintf('%.3f', $gen_time);
|
||||
$gzip_text = UA_GZIP_SUPPORTED ? "{$lang['GZIP_COMPRESSION']}: " : "<s>{$lang['GZIP_COMPRESSION']}:</s> ";
|
||||
$gzip_text .= $bb_cfg['gzip_compress'] ? $lang['ON'] : $lang['OFF'];
|
||||
|
||||
|
@ -43,7 +43,7 @@ if ($show_dbg_info) {
|
|||
|
||||
if (!empty($DBS)) {
|
||||
$sql_t = $DBS->sql_timetotal;
|
||||
$sql_time_txt = ($sql_t) ? sprintf('%.4f ' . $lang['SEC'] . ' (%d%%) · ', $sql_t, round($sql_t * 100 / $gen_time)) : '';
|
||||
$sql_time_txt = ($sql_t) ? sprintf('%.3f ' . $lang['SEC'] . ' (%d%%) · ', $sql_t, round($sql_t * 100 / $gen_time)) : '';
|
||||
$num_q = $DBS->num_queries;
|
||||
$stat .= " | {$DBS->get_db_obj()->engine}: {$sql_time_txt}{$num_q} " . $lang['QUERIES'];
|
||||
}
|
||||
|
|
|
@ -230,7 +230,7 @@ class Dev
|
|||
foreach ($db_obj->dbg as $i => $dbg) {
|
||||
$id = "sql_{$i}_" . random_int(0, mt_getrandmax());
|
||||
$sql = self::shortQuery($dbg['sql'], true);
|
||||
$time = sprintf('%.4f', $dbg['time']);
|
||||
$time = sprintf('%.3f', $dbg['time']);
|
||||
$perc = '[' . round($dbg['time'] * 100 / $db_obj->sql_timetotal) . '%]';
|
||||
$info = !empty($dbg['info']) ? $dbg['info'] . ' [' . $dbg['src'] . ']' : $dbg['src'];
|
||||
|
||||
|
|
|
@ -832,7 +832,7 @@ class SqlDb
|
|||
*/
|
||||
public function log_query($log_file = 'sql_queries')
|
||||
{
|
||||
$q_time = ($this->cur_query_time >= 10) ? round($this->cur_query_time, 0) : sprintf('%.4f', $this->cur_query_time);
|
||||
$q_time = ($this->cur_query_time >= 10) ? round($this->cur_query_time, 0) : sprintf('%.3f', $this->cur_query_time);
|
||||
$msg = [];
|
||||
$msg[] = round($this->sql_starttime);
|
||||
$msg[] = date('m-d H:i:s', (int)$this->sql_starttime);
|
||||
|
@ -943,7 +943,7 @@ class SqlDb
|
|||
$this->explain_out .= '
|
||||
<table width="98%" cellpadding="0" cellspacing="0" class="bodyline row2 bCenter" style="border-bottom: 0;">
|
||||
<tr>
|
||||
<th style="height: 22px;" align="left"> ' . $dbg['src'] . ' [' . sprintf('%.4f', $dbg['time']) . ' s] <i>' . $dbg['info'] . '</i></th>
|
||||
<th style="height: 22px;" align="left"> ' . $dbg['src'] . ' [' . sprintf('%.3f', $dbg['time']) . ' s] <i>' . $dbg['info'] . '</i></th>
|
||||
<th class="copyElement" data-clipboard-target="#' . $htid . '" style="height: 22px;" align="right" title="Copy to clipboard">' . "[$this->engine] $this->db_server.$this->selected_db" . ' :: Query #' . ($this->num_queries + 1) . ' </th>
|
||||
</tr>
|
||||
<tr><td colspan="2">' . $this->explain_hold . '</td></tr>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue