1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 04:38:27 +01:00

Fix for displaying of debug mode: 'Time Analysis'. Additional markers added to class2.php.

This commit is contained in:
Cameron 2020-12-12 11:38:31 -08:00
parent cf14705535
commit eaa44b075f
2 changed files with 15 additions and 4 deletions

View File

@ -1531,6 +1531,8 @@ if(!defined('THEME_LAYOUT'))
}
// Load library dependencies.
$dbg->logTime('Load Libraries');
//$startTime = microtime(true);
if(deftrue('e_ADMIN_AREA'))
{
e107::getTheme('current', true)->loadLibrary();
@ -1539,9 +1541,8 @@ else
{
e107::getTheme('current')->loadLibrary();
}
//echo "\nRun Time: " . number_format(( microtime(true) - $startTime), 4) . " Seconds\n";
// -----------------------------------------------------------------------
if(!isset($_E107['no_menus']))
{
$dbg->logTime('Init Menus');
@ -1549,6 +1550,7 @@ if(!isset($_E107['no_menus']))
}
// here we USE the theme
$dbg->logTime("Load admin_/theme.php file");
if(e_ADMIN_AREA)
{
$dbg->logTime('Loading Admin Theme');
@ -1571,7 +1573,7 @@ else
e107::scStyle($SC_WRAPPER);
}
}
$dbg->logTime("Init Theme Class");
e107::getRender()->init(); // initialize theme class.
//----------------------------

View File

@ -148,9 +148,13 @@
return null;
}
$timeNow = microtime();
$nMarks = ++$this->nTimeMarks;
// file_put_contents(e_LOG."debugClass.log",$nMarks."\t". $sMarker."\n", FILE_APPEND);
if(!strlen($sMarker))
{
$sMarker = "Mark not set";
@ -515,10 +519,11 @@
$obj = new ArrayObject($this->aTimeMarks);
$it = $obj->getIterator();
// while(list($tKey, $tMarker) = each($this->aTimeMarks))
foreach ($it as $tKey=>$tMarker)
{
file_put_contents(e_LOG."debugPerformance.log",$tKey."\t". $sMarker."\n", FILE_APPEND);
if(!$bRowHeaders)
{
@ -585,10 +590,12 @@
// $nextMarker = current($this->aTimeMarks);
$it->next();
$nextMarker = $it->current();
$it->seek($tKey - 1); // go back one position.
$aNextT = $nextMarker['Time'];
$aThisT = $tMarker['Time'];
$thisDelta = e107::getSingleton('e107_traffic')->TimeDelta($aThisT, $aNextT);
$aSum['Time'] += $thisDelta;
$aSum['DB Time'] += $tMarker['DB Time'];
@ -598,6 +605,8 @@
$tMarker['%Time'] = $totTime ? number_format(100.0 * ($thisDelta / $totTime), 0) : 0;
$tMarker['%Time'] = $this->highlight($tMarker['%Time'], $tMarker['%Time'], 20);
$tMarker['%DB Count'] = number_format(100.0 * $tMarker['DB Count'] / $sql->db_QueryCount(), 0);
$tMarker['%DB Time'] = $db_time ? number_format(100.0 * $tMarker['DB Time'] / $db_time, 0) : 0;
$tMarker['DB Time'] = number_format($tMarker['DB Time'] * 1000.0, 1);