diff --git a/e107_admin/admin.php b/e107_admin/admin.php index 087d4c109..cc20a34d6 100644 --- a/e107_admin/admin.php +++ b/e107_admin/admin.php @@ -69,10 +69,10 @@ require_once(e_ADMIN.'boot.php'); require_once(e_ADMIN.'auth.php'); require_once(e_HANDLER.'upload_handler.php'); - +e107::getDb()->db_Mark_Time('(Start Admin Checks)'); new admin_start; - +e107::getDb()->db_Mark_Time('(After Admin Checks)'); $mes = e107::getMessage(); 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'); $this->checkPaths(); + e107::getDb()->db_Mark_Time('Check Timezone'); $this->checkTimezone(); + e107::getDb()->db_Mark_Time('Check Writable'); $this->checkWritable(); diff --git a/e107_admin/auth.php b/e107_admin/auth.php index fe9f01099..c40890362 100644 --- a/e107_admin/auth.php +++ b/e107_admin/auth.php @@ -19,6 +19,9 @@ if (!defined('e107_INIT')) exit; } + +e107::getDb()->db_Mark_Time('(Start auth.php)'); + define('e_CAPTCHA_FONTCOLOR','#F9A533'); diff --git a/e107_admin/boot.php b/e107_admin/boot.php index 24cd7c280..0724311f1 100644 --- a/e107_admin/boot.php +++ b/e107_admin/boot.php @@ -15,7 +15,7 @@ if (!defined('e107_INIT')) exit; } - +e107::getDb()->db_Mark_Time('(Start boot.php)'); header('Content-type: text/html; charset=utf-8', TRUE); define('ADMINFEED', 'https://e107.org/adminfeed'); diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php index 25ab1ec90..2928caf58 100644 --- a/e107_admin/update_routines.php +++ b/e107_admin/update_routines.php @@ -176,6 +176,7 @@ class e107Update { $mes = e107::getMessage(); $tp = e107::getParser(); + $sql = e107::getDb(); // foreach($this->core as $func => $data) @@ -258,6 +259,7 @@ class e107Update { $frm = e107::getForm(); $mes = e107::getMessage(); + $sql = e107::getDb(); $text = ""; @@ -373,8 +375,11 @@ function update_check() foreach($dbupdate as $func => $rmks) // See which core functions need update { + if (function_exists('update_'.$func)) { + + $sql->db_Mark_Time('Check Core Update_'.$func.' '); if (!call_user_func('update_'.$func, FALSE)) { $update_needed = TRUE; @@ -388,6 +393,7 @@ function update_check() { if (function_exists('update_'.$func)) { + // $sql->db_Mark_Time('Check Core Update_'.$func.' '); if (!call_user_func('update_'.$func, FALSE)) { $update_needed = TRUE; @@ -588,6 +594,7 @@ function update_core_database($type = '') //-------------------------------------------- function update_706_to_800($type='') { + global $pref, $e107info; global $sysprefs, $eArrayStorage; @@ -1744,6 +1751,7 @@ function core_media_import($cat,$epath) function update_70x_to_706($type='') { + global $sql,$ns, $pref, $e107info, $admin_log, $emessage; $just_check = $type == 'do' ? FALSE : TRUE; diff --git a/e107_handlers/db_debug_class.php b/e107_handlers/db_debug_class.php index b0d068d1a..c2a2217f4 100644 --- a/e107_handlers/db_debug_class.php +++ b/e107_handlers/db_debug_class.php @@ -352,8 +352,8 @@ class e107_db_debug { } - function Show_Performance() - { + function Show_Performance() + { // // Stats by Time Marker // @@ -382,6 +382,24 @@ class e107_db_debug { $aSum['DB Count'] = 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)) { if(!$bRowHeaders) @@ -405,27 +423,32 @@ class e107_db_debug { } $aUnits['OB Lev'] = 'lev(buf bytes)'; $aUnits['Memory'] = '(kb)'; + $aUnits['Memory Used'] = '(kb)'; $text .= "" . implode(" ", $aUnits) . " \n"; } - $tMem = ($tMarker['Memory'] - $aSum['Memory']); + // $tMem = ($tMarker['Memory'] - $aSum['Memory']); + + $tMem = ($tMarker['Memory']); 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 + $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'] = "".$tMarker['Memory'].""; + $tMarker['Memory Used'] = "".$tMarker['Memory Used'].""; } - $aSum['Memory'] += $tMem; + // $aSum['Memory'] += $tMem; if($tMarker['What'] == 'Stop') { diff --git a/e107_handlers/shortcode_handler.php b/e107_handlers/shortcode_handler.php index c466106c7..00ad25328 100644 --- a/e107_handlers/shortcode_handler.php +++ b/e107_handlers/shortcode_handler.php @@ -1310,7 +1310,7 @@ class e_parse_shortcode 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))