1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-11 18:16:21 +02:00

Debug timings.

This commit is contained in:
Cameron
2017-01-21 10:49:04 -08:00
parent 15c586b5dc
commit d7fad829fe
6 changed files with 47 additions and 11 deletions

View File

@ -69,10 +69,10 @@ require_once(e_ADMIN.'boot.php');
require_once(e_ADMIN.'auth.php'); require_once(e_ADMIN.'auth.php');
require_once(e_HANDLER.'upload_handler.php'); require_once(e_HANDLER.'upload_handler.php');
e107::getDb()->db_Mark_Time('(Start Admin Checks)');
new admin_start; new admin_start;
e107::getDb()->db_Mark_Time('(After Admin Checks)');
$mes = e107::getMessage(); $mes = e107::getMessage();
if (!isset($pref['adminstyle'])) $pref['adminstyle'] = 'infopanel'; // Shouldn't be needed - but just in case if (!isset($pref['adminstyle'])) $pref['adminstyle'] = 'infopanel'; // Shouldn't be needed - but just in case
@ -153,8 +153,10 @@ class admin_start
e107::getDb()->db_Mark_Time('Check Paths'); e107::getDb()->db_Mark_Time('Check Paths');
$this->checkPaths(); $this->checkPaths();
e107::getDb()->db_Mark_Time('Check Timezone'); e107::getDb()->db_Mark_Time('Check Timezone');
$this->checkTimezone(); $this->checkTimezone();
e107::getDb()->db_Mark_Time('Check Writable'); e107::getDb()->db_Mark_Time('Check Writable');
$this->checkWritable(); $this->checkWritable();

View File

@ -19,6 +19,9 @@ if (!defined('e107_INIT'))
exit; exit;
} }
e107::getDb()->db_Mark_Time('(Start auth.php)');
define('e_CAPTCHA_FONTCOLOR','#F9A533'); define('e_CAPTCHA_FONTCOLOR','#F9A533');

View File

@ -15,7 +15,7 @@ if (!defined('e107_INIT'))
exit; exit;
} }
e107::getDb()->db_Mark_Time('(Start boot.php)');
header('Content-type: text/html; charset=utf-8', TRUE); header('Content-type: text/html; charset=utf-8', TRUE);
define('ADMINFEED', 'https://e107.org/adminfeed'); define('ADMINFEED', 'https://e107.org/adminfeed');

View File

@ -176,6 +176,7 @@ class e107Update
{ {
$mes = e107::getMessage(); $mes = e107::getMessage();
$tp = e107::getParser(); $tp = e107::getParser();
$sql = e107::getDb();
// foreach($this->core as $func => $data) // foreach($this->core as $func => $data)
@ -258,6 +259,7 @@ class e107Update
{ {
$frm = e107::getForm(); $frm = e107::getForm();
$mes = e107::getMessage(); $mes = e107::getMessage();
$sql = e107::getDb();
$text = ""; $text = "";
@ -373,8 +375,11 @@ function update_check()
foreach($dbupdate as $func => $rmks) // See which core functions need update foreach($dbupdate as $func => $rmks) // See which core functions need update
{ {
if (function_exists('update_'.$func)) if (function_exists('update_'.$func))
{ {
$sql->db_Mark_Time('Check Core Update_'.$func.' ');
if (!call_user_func('update_'.$func, FALSE)) if (!call_user_func('update_'.$func, FALSE))
{ {
$update_needed = TRUE; $update_needed = TRUE;
@ -388,6 +393,7 @@ function update_check()
{ {
if (function_exists('update_'.$func)) if (function_exists('update_'.$func))
{ {
// $sql->db_Mark_Time('Check Core Update_'.$func.' ');
if (!call_user_func('update_'.$func, FALSE)) if (!call_user_func('update_'.$func, FALSE))
{ {
$update_needed = TRUE; $update_needed = TRUE;
@ -588,6 +594,7 @@ function update_core_database($type = '')
//-------------------------------------------- //--------------------------------------------
function update_706_to_800($type='') function update_706_to_800($type='')
{ {
global $pref, $e107info; global $pref, $e107info;
global $sysprefs, $eArrayStorage; global $sysprefs, $eArrayStorage;
@ -1744,6 +1751,7 @@ function core_media_import($cat,$epath)
function update_70x_to_706($type='') function update_70x_to_706($type='')
{ {
global $sql,$ns, $pref, $e107info, $admin_log, $emessage; global $sql,$ns, $pref, $e107info, $admin_log, $emessage;
$just_check = $type == 'do' ? FALSE : TRUE; $just_check = $type == 'do' ? FALSE : TRUE;

View File

@ -352,8 +352,8 @@ class e107_db_debug {
} }
function Show_Performance() function Show_Performance()
{ {
// //
// Stats by Time Marker // Stats by Time Marker
// //
@ -382,6 +382,24 @@ class e107_db_debug {
$aSum['DB Count'] = 0; $aSum['DB Count'] = 0;
$aSum['Memory'] = 0; $aSum['Memory'] = 0;
// Calculate Memory Usage per entry.
$prevMem = 0;
foreach($this->aTimeMarks as $k=>$v)
{
$prevKey = $k-1;
if(!empty($prevKey))
{
$this->aTimeMarks[$prevKey]['Memory Used'] = (intval($v['Memory']) - $prevMem);
}
$prevMem = intval($v['Memory']);
}
while(list($tKey, $tMarker) = each($this->aTimeMarks)) while(list($tKey, $tMarker) = each($this->aTimeMarks))
{ {
if(!$bRowHeaders) if(!$bRowHeaders)
@ -405,27 +423,32 @@ class e107_db_debug {
} }
$aUnits['OB Lev'] = 'lev(buf bytes)'; $aUnits['OB Lev'] = 'lev(buf bytes)';
$aUnits['Memory'] = '(kb)'; $aUnits['Memory'] = '(kb)';
$aUnits['Memory Used'] = '(kb)';
$text .= "<tr><td class='fcaption' style='text-align:right'><b>" . implode("</b>&nbsp;</td><td class='fcaption' style='text-align:right'><b>", $aUnits) . "</b>&nbsp;</td></tr>\n"; $text .= "<tr><td class='fcaption' style='text-align:right'><b>" . implode("</b>&nbsp;</td><td class='fcaption' style='text-align:right'><b>", $aUnits) . "</b>&nbsp;</td></tr>\n";
} }
$tMem = ($tMarker['Memory'] - $aSum['Memory']); // $tMem = ($tMarker['Memory'] - $aSum['Memory']);
$tMem = ($tMarker['Memory']);
if($tMem < 0) // Quick Fix for negative numbers. if($tMem < 0) // Quick Fix for negative numbers.
{ {
$tMem = 0.0000000001; // $tMem = 0.0000000001;
} }
$tMarker['Memory'] = ($tMem ? number_format($tMem / 1024.0, 1) : '?'); // display if known $tMarker['Memory'] = ($tMem ? number_format($tMem / 1024.0, 1) : '?'); // display if known
$tUsage = $tMarker['Memory Used'];
$tMarker['Memory Used'] = number_format($tUsage / 1024.0, 1);
if($tMem > 400000) // Highlight high memory usage. if($tUsage > 400000) // Highlight high memory usage.
{ {
$tMarker['Memory'] = "<span class='label label-danger'>".$tMarker['Memory']."</span>"; $tMarker['Memory Used'] = "<span class='label label-danger'>".$tMarker['Memory Used']."</span>";
} }
$aSum['Memory'] += $tMem; // $aSum['Memory'] += $tMem;
if($tMarker['What'] == 'Stop') if($tMarker['What'] == 'Stop')
{ {

View File

@ -1310,7 +1310,7 @@ class e_parse_shortcode
if (E107_DBG_SC || E107_DBG_TIMEDETAILS) if (E107_DBG_SC || E107_DBG_TIMEDETAILS)
{ {
$sql->db_Mark_Time("(After SC {$code})"); // $sql->db_Mark_Time("(After SC {$code})");
} }
if (($noDebugLog != true) && (E107_DBG_BBSC || E107_DBG_SC || E107_DBG_TIMEDETAILS)) if (($noDebugLog != true) && (E107_DBG_BBSC || E107_DBG_SC || E107_DBG_TIMEDETAILS))