mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-04-30 11:19:22 +02:00
Added correct page render time in the default layout.
Added a function elapsedTime() that can be called anywhere to see how long the page has taken to render thus far. query debugging shows current render time to help detect performance issues.
This commit is contained in:
parent
2a38590b96
commit
3036d61926
@ -271,7 +271,7 @@ function mysql_select_single($query) {
|
||||
$aacQueries++;
|
||||
|
||||
global $accQueriesData;
|
||||
$accQueriesData[] = $query;
|
||||
$accQueriesData[] = "[" . elapsedTime() . "] " . $query;
|
||||
$result = mysqli_query($connect,$query) or die(var_dump($query)."<br>(query - <font color='red'>SQL error</font>) <br>Type: <b>select_single</b> (select single row from database)<br><br>".mysqli_error($connect));
|
||||
$row = mysqli_fetch_assoc($result);
|
||||
return !empty($row) ? $row : false;
|
||||
@ -283,7 +283,7 @@ function mysql_select_multi($query){
|
||||
global $aacQueries;
|
||||
$aacQueries++;
|
||||
global $accQueriesData;
|
||||
$accQueriesData[] = $query;
|
||||
$accQueriesData[] = "[" . elapsedTime() . "] " . $query;
|
||||
$array = array();
|
||||
$results = mysqli_query($connect,$query) or die(var_dump($query)."<br>(query - <font color='red'>SQL error</font>) <br>Type: <b>select_multi</b> (select multiple rows from database)<br><br>".mysqli_error($connect));
|
||||
while($row = mysqli_fetch_assoc($results)) {
|
||||
@ -307,7 +307,7 @@ function voidQuery($query) {
|
||||
global $aacQueries;
|
||||
$aacQueries++;
|
||||
global $accQueriesData;
|
||||
$accQueriesData[] = $query;
|
||||
$accQueriesData[] = "[" . elapsedTime() . "] " . $query;
|
||||
mysqli_query($connect,$query) or die(var_dump($query)."<br>(query - <font color='red'>SQL error</font>) <br>Type: <b>voidQuery</b> (voidQuery is used for update, insert or delete from database)<br><br>".mysqli_error($connect));
|
||||
}
|
||||
?>
|
@ -5,6 +5,15 @@ $l_time = explode(' ', $l_time);
|
||||
$l_time = $l_time[1] + $l_time[0];
|
||||
$l_start = $l_time;
|
||||
|
||||
function elapsedTime($l_start = false, $l_time = false) {
|
||||
if ($l_start === false) global $l_start;
|
||||
if ($l_time === false) global $l_time;
|
||||
|
||||
$l_time = explode(' ', microtime());
|
||||
$l_finish = $l_time[1] + $l_time[0];
|
||||
return round(($l_finish - $l_start), 4);
|
||||
}
|
||||
|
||||
$time = time();
|
||||
$version = '1.5_SVN';
|
||||
|
||||
|
@ -4,12 +4,7 @@
|
||||
<footer>
|
||||
<p>© <?php echo $config['site_title'];?>.
|
||||
<?php
|
||||
$time = microtime();
|
||||
$time = explode(' ', $time);
|
||||
$time = $time[1] + $time[0];
|
||||
$finish = $time;
|
||||
$total_time = round(($finish - $start), 4);
|
||||
echo 'Server date and clock is: '. getClock(false, true) .' Page generated in '. $total_time .' seconds. Q: '.$aacQueries;
|
||||
echo 'Server date and clock is: '. getClock(false, true) .' Page generated in '. elapsedTime() .' seconds. Q: '.$aacQueries;
|
||||
?>
|
||||
<a href="http://www.css3templates.co.uk">Design: css3templates.co.uk</a>. Engine: <a href="credits.php">Znote AAC</a></p>
|
||||
</footer>
|
Loading…
x
Reference in New Issue
Block a user