diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php
index 73d22b03a..ce5cd1d1e 100644
--- a/application/cmdbabstract.class.inc.php
+++ b/application/cmdbabstract.class.inc.php
@@ -24,7 +24,6 @@ use Combodo\iTop\Application\UI\Base\Component\Input\InputUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Input\Select\SelectOptionUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Input\SelectUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\MedallionIcon\MedallionIcon;
-use Combodo\iTop\Application\UI\Base\Component\Panel\Panel;
use Combodo\iTop\Application\UI\Base\Component\Panel\PanelUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Title\Title;
use Combodo\iTop\Application\UI\Base\Component\Title\TitleUIBlockFactory;
@@ -3318,12 +3317,13 @@ HTML
}
// Note: Remove the table if we want fields to occupy the whole width of the container
- $oForm->AddHtml('
| ');
- $oForm->AddHtml($oPage->GetDetails($aDetails));
- $oForm->AddHtml(' |
');
+ $sHtml = '| ';
+ $sHtml .= $oPage->GetDetails($aDetails);
+ $sHtml .= ' |
';
$oAppContext = new ApplicationContext();
- $oForm->AddHtml($oAppContext->GetForForm());
+ $sHtml .= $oAppContext->GetForForm();
+ $oForm->AddHtml($sHtml);
$oCancelButton = ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Cancel'), 'cancel', 'cancel');
$oCancelButton->SetOnClickJsCode("BackToDetails('{$sClass}', '{$this->GetKey()}', '', '{$sOwnershipToken}');");
diff --git a/application/dashlet.class.inc.php b/application/dashlet.class.inc.php
index ee57c4c60..ea5419bdf 100644
--- a/application/dashlet.class.inc.php
+++ b/application/dashlet.class.inc.php
@@ -604,8 +604,7 @@ class DashletUnknown extends Dashlet
$oDashletContainer = new DashletContainer(null, ['dashlet-content']);
- $oDashletContainer->AddHtml('');
- $oDashletContainer->AddHtml(''.$sExplainText.'
');
+ $oDashletContainer->AddHtml(''.$sExplainText.'
');
return $oDashletContainer;
}
@@ -624,8 +623,7 @@ class DashletUnknown extends Dashlet
$oDashletContainer = new DashletContainer(null, ['dashlet-content']);
- $oDashletContainer->AddHtml('');
- $oDashletContainer->AddHtml(''.$sExplainText.'
');
+ $oDashletContainer->AddHtml(''.$sExplainText.'
');
return $oDashletContainer;
}
diff --git a/application/displayblock.class.inc.php b/application/displayblock.class.inc.php
index 18818a7cd..7b7447f95 100644
--- a/application/displayblock.class.inc.php
+++ b/application/displayblock.class.inc.php
@@ -1042,8 +1042,7 @@ JS
$sCountLabel = $aCount['label'];
$oPill = PillFactory::MakeForState($sClass, $sStateValue)
->SetTooltip($sStateLabel)
- ->AddHtml("")
- ->AddHtml("");
+ ->AddHtml("");
if ($sHyperlink != '-') {
$oPill->SetUrl($sHyperlink);
}
diff --git a/application/menunode.class.inc.php b/application/menunode.class.inc.php
index 416f16b33..a6cbd8f9b 100644
--- a/application/menunode.class.inc.php
+++ b/application/menunode.class.inc.php
@@ -58,6 +58,10 @@ class ApplicationMenu
* @var array
*/
static $aMenusIndex = array();
+ /**
+ * @var array
+ */
+ static $aMenusById = [];
/**
* @var string
*/
@@ -166,6 +170,7 @@ class ApplicationMenu
$aBacktrace = debug_backtrace();
$sFile = isset($aBacktrace[2]["file"]) ? $aBacktrace[2]["file"] : $aBacktrace[1]["file"];
self::$aMenusIndex[$index] = array('node' => $oMenuNode, 'children' => array(), 'parent' => $sParentId, 'rank' => $fRank, 'source_file' => $sFile);
+ self::$aMenusById[$oMenuNode->GetMenuId()] = $index;
}
else
{
@@ -506,17 +511,11 @@ EOF
*/
public static function GetMenuIndexById($sTitle)
{
- $index = -1;
- /** @var MenuNode[] $aMenu */
- foreach(self::$aMenusIndex as $aMenu)
- {
- if ($aMenu['node']->GetMenuId() == $sTitle)
- {
- $index = $aMenu['node']->GetIndex();
- break;
- }
+ if (isset(self::$aMenusById[$sTitle])) {
+ return self::$aMenusById[$sTitle];
}
- return $index;
+
+ return -1;
}
/**
diff --git a/core/MyHelpers.class.inc.php b/core/MyHelpers.class.inc.php
index fc05962d1..f5260d987 100644
--- a/core/MyHelpers.class.inc.php
+++ b/core/MyHelpers.class.inc.php
@@ -66,9 +66,8 @@ class MyHelpers
// getmicrotime()
// format sss.mmmuuupppnnn
public static function getmicrotime()
- {
- list($usec, $sec) = explode(" ",microtime());
- return ((float)$usec + (float)$sec);
+ {
+ return microtime(true);
}
/*
diff --git a/core/kpi.class.inc.php b/core/kpi.class.inc.php
index 99e59c792..446cc7aa6 100644
--- a/core/kpi.class.inc.php
+++ b/core/kpi.class.inc.php
@@ -31,10 +31,15 @@ class ExecutionKPI
static protected $m_bBlameCaller = false;
static protected $m_sAllowedUser = '*';
- static protected $m_aStats = array(); // Recurrent operations
- static protected $m_aExecData = array(); // One shot operations
+ static protected $m_aStats = []; // Recurrent operations
+ static protected $m_aExecData = []; // One shot operations
+ /**
+ * @var array[ExecutionKPI]
+ */
+ static protected $m_aExecutionStack = []; // embedded execution stats
protected $m_fStarted = null;
+ protected $m_fChildrenDuration = 0; // Count embedded
protected $m_iInitialMemory = null;
static public function EnableDuration($iLevel)
@@ -284,6 +289,32 @@ class ExecutionKPI
public function __construct()
{
$this->ResetCounters();
+ self::Push($this);
+ }
+
+ /**
+ * Stack executions to remove children duration from stats
+ *
+ * @param \ExecutionKPI $oExecutionKPI
+ */
+ private static function Push(ExecutionKPI $oExecutionKPI)
+ {
+ array_push(self::$m_aExecutionStack, $oExecutionKPI);
+ }
+
+ /**
+ * Pop current child and count its duration in its parent
+ *
+ * @param float|int $fChildDuration
+ */
+ private static function Pop(float $fChildDuration = 0)
+ {
+ array_pop(self::$m_aExecutionStack);
+ // Update the parent's children duration
+ $oPrevExecutionKPI = end(self::$m_aExecutionStack);
+ if ($oPrevExecutionKPI) {
+ $oPrevExecutionKPI->m_fChildrenDuration += $fChildDuration;
+ }
}
// Get the duration since startup, and reset the counter for the next measure
@@ -294,13 +325,12 @@ class ExecutionKPI
$aNewEntry = null;
- if (self::$m_bEnabled_Duration)
- {
+ if (self::$m_bEnabled_Duration) {
$fStopped = MyHelpers::getmicrotime();
$aNewEntry = array(
- 'op' => $sOperationDesc,
+ 'op' => $sOperationDesc,
'time_begin' => $this->m_fStarted - $fItopStarted,
- 'time_end' => $fStopped - $fItopStarted,
+ 'time_end' => $fStopped - $fItopStarted,
);
// Reset for the next operation (if the object is recycled)
$this->m_fStarted = $fStopped;
@@ -332,24 +362,23 @@ class ExecutionKPI
public function ComputeStats($sOperation, $sArguments)
{
- if (self::$m_bEnabled_Duration)
- {
+ $fDuration = 0;
+ if (self::$m_bEnabled_Duration) {
$fStopped = MyHelpers::getmicrotime();
$fDuration = $fStopped - $this->m_fStarted;
- if (self::$m_bBlameCaller)
- {
+ $fSelfDuration = $fDuration - $this->m_fChildrenDuration;
+ if (self::$m_bBlameCaller) {
self::$m_aStats[$sOperation][$sArguments][] = array(
- 'time' => $fDuration,
+ 'time' => $fSelfDuration,
'callers' => MyHelpers::get_callstack(1),
);
- }
- else
- {
+ } else {
self::$m_aStats[$sOperation][$sArguments][] = array(
- 'time' => $fDuration
+ 'time' => $fSelfDuration,
);
}
}
+ self::Pop($fDuration);
}
protected function ResetCounters()
diff --git a/pages/schema.php b/pages/schema.php
index d25711b3d..f1be35ff3 100644
--- a/pages/schema.php
+++ b/pages/schema.php
@@ -843,12 +843,12 @@ function DisplayClassDetails($oPage, $sClass, $sContext)
$oPanel = PanelUIBlockFactory::MakeForClass($sClass, MetaModel::GetName($sClass).' ('.$sClass.')')
->SetIcon(MetaModel::GetClassIcon($sClass, false));
$sClassDescritpion = MetaModel::GetClassDescription($sClass);
- $oEnchancedPanelSubtitle = $oPanel->GetSubTitleBlock();
- $oEnchancedPanelSubtitle->AddHtml($sClassHierarchy.($sClassDescritpion == "" ? "" : ' - '.$sClassDescritpion));
+ $oEnhancedPanelSubtitle = $oPanel->GetSubTitleBlock();
+ $sEnhancedPanelSubtitle = $sClassHierarchy.($sClassDescritpion == "" ? "" : ' - '.$sClassDescritpion);
if (MetaModel::IsAbstract($sClass)) {
- $oEnchancedPanelSubtitle->AddHtml(' - ');
+ $sEnhancedPanelSubtitle .= ' - ';
}
-
+ $oEnhancedPanelSubtitle->AddHtml($sEnhancedPanelSubtitle);
$oPage->AddUiBlock($oPanel);
$oPage->AddTabContainer('details', '', $oPanel);
$oPage->SetCurrentTabContainer('details');
diff --git a/sources/application/TwigBase/Twig/TwigHelper.php b/sources/application/TwigBase/Twig/TwigHelper.php
index 6c52bc7d3..f6becd6cc 100644
--- a/sources/application/TwigBase/Twig/TwigHelper.php
+++ b/sources/application/TwigBase/Twig/TwigHelper.php
@@ -12,6 +12,7 @@ use Combodo\iTop\Application\UI\Base\Component\Html\Html;
use Combodo\iTop\Application\UI\Base\UIBlock;
use Combodo\iTop\Renderer\BlockRenderer;
use CoreTemplateException;
+use ExecutionKPI;
use IssueLog;
use Twig\Environment;
use Twig\Error\Error;
@@ -155,7 +156,12 @@ class TwigHelper
public static function RenderTemplate(Environment $oTwig, array $aParams, string $sName, string $sTemplateFileExtension = self::DEFAULT_FILE_TYPE, bool $bLogMissingFile = true): string
{
try {
- return $oTwig->render($sName.'.'.$sTemplateFileExtension.'.twig', $aParams);
+ $oKPI = new ExecutionKPI();
+ $sFileName = $sName.'.'.$sTemplateFileExtension.'.twig';
+ $sResult = $oTwig->render($sFileName, $aParams);
+ $oKPI->ComputeStats('Render TWIG', $sFileName);
+
+ return $sResult;
}
catch (Error $oTwigException) {
$oTwigPreviousException = $oTwigException->getPrevious();
diff --git a/sources/application/UI/Base/Component/FieldBadge/FieldBadgeUIBlockFactory.php b/sources/application/UI/Base/Component/FieldBadge/FieldBadgeUIBlockFactory.php
index 52801076d..b300e7414 100644
--- a/sources/application/UI/Base/Component/FieldBadge/FieldBadgeUIBlockFactory.php
+++ b/sources/application/UI/Base/Component/FieldBadge/FieldBadgeUIBlockFactory.php
@@ -25,6 +25,7 @@ class FieldBadgeUIBlockFactory extends AbstractUIBlockFactory
public static function MakeForField(string $sValue, ?ormStyle $oStyle)
{
$oBadge = null;
+ $sHtml = '';
if ($oStyle) {
$sStyleClass = $oStyle->GetStyleClass();
$sPrimaryColor = $oStyle->GetMainColor();
@@ -34,27 +35,26 @@ class FieldBadgeUIBlockFactory extends AbstractUIBlockFactory
$oBadge = new FieldBadge(null, $aCSSClasses);
$sDecorationClasses = $oStyle->GetDecorationClasses();
if (!is_null($sDecorationClasses) && !empty($sDecorationClasses)) {
- $oBadge->AddHtml("");
+ $sHtml .= "";
}
- $oBadge->AddHtml("$sValue");
+ $sHtml .= "$sValue";
// Add custom style
// TODO 3.0 To be removed when compilation supports generated CSS
- $oBadge->AddHtml(<<
.$sStyleClass {
color: $sComplementaryColor;
background-color: $sPrimaryColor;
}
-HTML
- );
+HTML;
}
}
if (!$oBadge) {
$oBadge = new FieldBadge();
- $oBadge->AddHtml("$sValue");
+ $sHtml .= "$sValue";
}
-
+ $oBadge->AddHtml($sHtml);
return $oBadge;
}
}
\ No newline at end of file
diff --git a/sources/application/WebPage/AjaxPage.php b/sources/application/WebPage/AjaxPage.php
index acfc02d94..778a269b2 100644
--- a/sources/application/WebPage/AjaxPage.php
+++ b/sources/application/WebPage/AjaxPage.php
@@ -32,6 +32,7 @@ class AjaxPage extends WebPage implements iTabbedPage
*/
function __construct($s_title)
{
+ $oKpi = new ExecutionKPI();
$sPrintable = utils::ReadParam('printable', '0');
$bPrintable = ($sPrintable == '1');
@@ -46,6 +47,7 @@ class AjaxPage extends WebPage implements iTabbedPage
$this->sPromiseId = utils::ReadParam('ajax_promise_id', uniqid('ajax_', true));
utils::InitArchiveMode();
+ $oKpi->ComputeStats(get_class($this).' creation', 'AjaxPage');
}
/**
@@ -199,15 +201,12 @@ class AjaxPage extends WebPage implements iTabbedPage
$aData['aBlockParams'] = $this->GetBlockParams();
- $oKpi->ComputeAndReport(get_class($this).' prepare output');
- $oKpi = new ExecutionKPI();
$oTwigEnv = TwigHelper::GetTwigEnvironment(BlockRenderer::TWIG_BASE_PATH, BlockRenderer::TWIG_ADDITIONAL_PATHS);
// Render final TWIG into global HTML
$sHtml = TwigHelper::RenderTemplate($oTwigEnv, $aData, $this->GetTemplateRelPath());
- $oKpi->ComputeAndReport('TWIG rendering');
+ $oKpi->ComputeAndReport(get_class($this).' output');
// Echo global HTML
- $oKpi = new ExecutionKPI();
echo $sHtml;
$oKpi->ComputeAndReport('Echoing ('.round(strlen($sHtml) / 1024).' Kb)');
ExecutionKPI::ReportStats();
diff --git a/sources/application/WebPage/CSVPage.php b/sources/application/WebPage/CSVPage.php
index cc821bc04..ffcac5737 100644
--- a/sources/application/WebPage/CSVPage.php
+++ b/sources/application/WebPage/CSVPage.php
@@ -29,11 +29,13 @@ class CSVPage extends WebPage
{
function __construct($s_title)
{
+ $oKpi = new ExecutionKPI();
parent::__construct($s_title);
$this->add_header("Content-type: text/plain; charset=".self::PAGES_CHARSET);
$this->no_cache();
$this->add_xframe_options();
//$this->add_header("Content-Transfer-Encoding: binary");
+ $oKpi->ComputeStats(get_class($this).' creation', 'CSVPage');
}
public function output()
diff --git a/sources/application/WebPage/CaptureWebPage.php b/sources/application/WebPage/CaptureWebPage.php
index f94ff73c3..02fa3a819 100644
--- a/sources/application/WebPage/CaptureWebPage.php
+++ b/sources/application/WebPage/CaptureWebPage.php
@@ -28,7 +28,9 @@ class CaptureWebPage extends WebPage
{
function __construct()
{
+ $oKpi = new ExecutionKPI();
parent::__construct('capture web page');
+ $oKpi->ComputeStats(get_class($this).' creation', 'CaptureWebPage');
}
public function GetHtml()
diff --git a/sources/application/WebPage/DownloadPage.php b/sources/application/WebPage/DownloadPage.php
index a08a7457c..c23f394ae 100644
--- a/sources/application/WebPage/DownloadPage.php
+++ b/sources/application/WebPage/DownloadPage.php
@@ -49,8 +49,7 @@ class DownloadPage extends AjaxPage
} else {
$sContent = $this->sContent;
}
- $oKpi->ComputeAndReport(get_class($this).' prepare output');
- $oKpi = new ExecutionKPI();
+ $oKpi->ComputeAndReport(get_class($this).' output');
echo $sContent;
$oKpi->ComputeAndReport('Echoing ('.round(strlen($sContent) / 1024).' Kb)');
ExecutionKPI::ReportStats();
diff --git a/sources/application/WebPage/ErrorPage.php b/sources/application/WebPage/ErrorPage.php
index 51bd3e908..3abdfcf5f 100644
--- a/sources/application/WebPage/ErrorPage.php
+++ b/sources/application/WebPage/ErrorPage.php
@@ -17,12 +17,14 @@ class ErrorPage extends NiceWebPage
{
public function __construct($sTitle)
{
+ $oKpi = new ExecutionKPI();
parent::__construct($sTitle);
$this->add_linked_script("../js/jquery.blockUI.js");
$this->add_linked_script("../setup/setup.js");
$this->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot().'css/font-awesome/css/all.min.css');
$this->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot().'css/font-combodo/font-combodo.css');
$this->add_saas("css/setup.scss");
+ $oKpi->ComputeStats(get_class($this).' creation', 'ErrorPage');
}
public function info($sText)
diff --git a/sources/application/WebPage/JsonPage.php b/sources/application/WebPage/JsonPage.php
index ce578f775..c9c95b179 100644
--- a/sources/application/WebPage/JsonPage.php
+++ b/sources/application/WebPage/JsonPage.php
@@ -26,7 +26,9 @@ class JsonPage extends WebPage
*/
public function __construct()
{
+ $oKpi = new ExecutionKPI();
parent::__construct('');
+ $oKpi->ComputeStats(get_class($this).' creation', 'JsonPage');
}
/**
@@ -89,13 +91,12 @@ class JsonPage extends WebPage
$aScripts = array_merge($this->a_init_scripts, $this->a_scripts, $this->a_ready_scripts);
$aJson = $this->bOutputDataOnly ? $this->aData : [
- 'data' => $this->aData,
+ 'data' => $this->aData,
'scripts' => $aScripts,
];
- $oKpi->ComputeAndReport(get_class($this).' prepare output');
-
- $oKpi = new ExecutionKPI();
$sJSON = json_encode($aJson);
+ $oKpi->ComputeAndReport(get_class($this).' output');
+
echo $sJSON;
$oKpi->ComputeAndReport('Echoing ('.round(strlen($sJSON) / 1024).' Kb)');
ExecutionKPI::ReportStats();
diff --git a/sources/application/WebPage/NiceWebPage.php b/sources/application/WebPage/NiceWebPage.php
index 948fcf2d0..606e7a623 100644
--- a/sources/application/WebPage/NiceWebPage.php
+++ b/sources/application/WebPage/NiceWebPage.php
@@ -27,10 +27,12 @@ class NiceWebPage extends WebPage
public function __construct($s_title, $bPrintable = false)
{
+ $oKpi = new ExecutionKPI();
$this->m_sRootUrl = $this->GetAbsoluteUrlAppRoot();
parent::__construct($s_title, $bPrintable);
$this->LoadTheme();
+ $oKpi->ComputeStats(get_class($this).' creation', 'NiceWebPage');
}
/**
diff --git a/sources/application/WebPage/PDFPage.php b/sources/application/WebPage/PDFPage.php
index f93ccdad6..3f29f8b07 100644
--- a/sources/application/WebPage/PDFPage.php
+++ b/sources/application/WebPage/PDFPage.php
@@ -30,6 +30,7 @@ class PDFPage extends WebPage
public function __construct($s_title, $sPageFormat = 'A4', $sPageOrientation = 'L')
{
+ $oKpi = new ExecutionKPI();
parent::__construct($s_title);
define('K_PATH_FONTS', APPROOT.'lib/combodo/tcpdf/fonts/');
$this->oPdf = new iTopPDF($sPageOrientation, 'mm', $sPageFormat, true, self::PAGES_CHARSET, false);
@@ -54,7 +55,7 @@ class PDFPage extends WebPage
$this->SetContentDisposition('inline', $s_title.'.pdf');
$this->SetDefaultStyle();
-
+ $oKpi->ComputeStats(get_class($this).' creation', 'PDFPage');
}
/**
diff --git a/sources/application/WebPage/UnauthenticatedWebPage.php b/sources/application/WebPage/UnauthenticatedWebPage.php
index 4f8541a30..a7af03cfb 100644
--- a/sources/application/WebPage/UnauthenticatedWebPage.php
+++ b/sources/application/WebPage/UnauthenticatedWebPage.php
@@ -67,6 +67,7 @@ class UnauthenticatedWebPage extends NiceWebPage
*/
public function __construct($s_title, $bPrintable = false)
{
+ $oKpi = new ExecutionKPI();
parent::__construct($s_title, $bPrintable);
$this->sContent = '';
@@ -96,6 +97,7 @@ class UnauthenticatedWebPage extends NiceWebPage
// Default theme
$this->add_saas('css/unauthenticated.scss');
+ $oKpi->ComputeStats(get_class($this).' creation', $s_title);
}
/**
@@ -111,6 +113,7 @@ class UnauthenticatedWebPage extends NiceWebPage
*/
public function output()
{
+ $oKpi = new ExecutionKPI();
// Send headers
foreach ($this->a_headers as $sHeader) {
header($sHeader);
@@ -172,8 +175,9 @@ class UnauthenticatedWebPage extends NiceWebPage
// Render final TWIG into global HTML
$sHtml = TwigHelper::RenderTemplate($oTwigEnv, $aData, $this->GetTemplateRelPath());
+ $oKpi->ComputeAndReport(get_class($this).' output');
echo $sHtml;
-
+ $oKpi->ComputeAndReport('Echoing ('.round(strlen($sHtml) / 1024).' Kb)');
}
/**
diff --git a/sources/application/WebPage/WebPage.php b/sources/application/WebPage/WebPage.php
index 65859a5a7..92d9784c7 100644
--- a/sources/application/WebPage/WebPage.php
+++ b/sources/application/WebPage/WebPage.php
@@ -141,6 +141,7 @@ class WebPage implements Page
*/
public function __construct(string $s_title, bool $bPrintable = false)
{
+ $oKpi = new ExecutionKPI();
$this->s_title = $s_title;
$this->s_content = "";
$this->s_deferred_content = '';
@@ -170,6 +171,7 @@ class WebPage implements Page
$this->SetTemplateRelPath(static::DEFAULT_PAGE_TEMPLATE_REL_PATH);
ob_start(); // Start capturing the output
+ $oKpi->ComputeStats(get_class($this).' creation', 'WebPage');
}
/**
@@ -1205,16 +1207,13 @@ JS;
// Favicon
$aData['aPage']['sFaviconUrl'] = $this->GetFaviconAbsoluteUrl();
- $oKpi->ComputeAndReport(get_class($this).' prepare output');
- $oKpi = new ExecutionKPI();
$oTwigEnv = TwigHelper::GetTwigEnvironment(BlockRenderer::TWIG_BASE_PATH, BlockRenderer::TWIG_ADDITIONAL_PATHS);
// Render final TWIG into global HTML
$sHtml = TwigHelper::RenderTemplate($oTwigEnv, $aData, $this->GetTemplateRelPath());
- $oKpi->ComputeAndReport('TWIG rendering');
+ $oKpi->ComputeAndReport(get_class($this).'output');
// Echo global HTML
- $oKpi = new ExecutionKPI();
echo $sHtml;
$oKpi->ComputeAndReport('Echoing ('.round(strlen($sHtml) / 1024).' Kb)');
diff --git a/sources/application/WebPage/XMLPage.php b/sources/application/WebPage/XMLPage.php
index 0e0b95422..cab121254 100644
--- a/sources/application/WebPage/XMLPage.php
+++ b/sources/application/WebPage/XMLPage.php
@@ -37,6 +37,7 @@ class XMLPage extends WebPage
function __construct($s_title, $bPassThrough = false)
{
+ $oKpi = new ExecutionKPI();
parent::__construct($s_title);
$this->m_bPassThrough = $bPassThrough;
$this->m_bHeaderSent = false;
@@ -44,6 +45,7 @@ class XMLPage extends WebPage
$this->no_cache();
$this->add_xframe_options();
$this->add_header("Content-location: export.xml");
+ $oKpi->ComputeStats(get_class($this).' creation', 'XMLPage');
}
public function output()
@@ -62,8 +64,7 @@ class XMLPage extends WebPage
{
header($s_header);
}
- $oKpi->ComputeAndReport(get_class($this).' prepare output');
- $oKpi = new ExecutionKPI();
+ $oKpi->ComputeAndReport(get_class($this).' output');
echo $this->s_content;
$oKpi->ComputeAndReport('Echoing ('.round(strlen($this->s_content) / 1024).' Kb)');
}
diff --git a/sources/application/WebPage/iTopWebPage.php b/sources/application/WebPage/iTopWebPage.php
index 212b0b9c3..e77964bf1 100644
--- a/sources/application/WebPage/iTopWebPage.php
+++ b/sources/application/WebPage/iTopWebPage.php
@@ -80,6 +80,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
*/
public function __construct($sTitle, $bPrintable = false)
{
+ $oKpi = new ExecutionKPI();
parent::__construct($sTitle, $bPrintable);
$this->m_oTabs = new TabManager();
$this->oCtx = new ContextTag(ContextTag::TAG_CONSOLE);
@@ -112,6 +113,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
$oPrintHeader = $this->OutputPrintable();
$this->AddUiBlock($oPrintHeader);
}
+ $oKpi->ComputeStats(get_class($this).' creation', 'iTopWebPage');
}
/**
@@ -888,18 +890,13 @@ HTML;
header($sHeader);
}
}
- $oKpi->ComputeAndReport(get_class($this).' prepare output');
-
// Render final TWIG into global HTML
- $oKpi = new ExecutionKPI();
$sHtml = TwigHelper::RenderTemplate($oTwigEnv, $aData, $this->GetTemplateRelPath());
-
- $oKpi->ComputeAndReport('TWIG rendering');
-
+ $oKpi->ComputeAndReport(get_class($this).' output');
+
// Echo global HTML
- $oKpi = new ExecutionKPI();
echo $sHtml;
$oKpi->ComputeAndReport('Echoing ('.round(strlen($sHtml) / 1024).' Kb)');
diff --git a/sources/application/WebPage/iTopWizardWebPage.php b/sources/application/WebPage/iTopWizardWebPage.php
index 8ce4521bc..e2660fead 100644
--- a/sources/application/WebPage/iTopWizardWebPage.php
+++ b/sources/application/WebPage/iTopWizardWebPage.php
@@ -33,9 +33,11 @@ class iTopWizardWebPage extends iTopWebPage
var $m_aSteps;
public function __construct($sTitle, $currentOrganization, $iCurrentStep, $aSteps)
{
- parent::__construct($sTitle." - step $iCurrentStep of ".count($aSteps)." - ".$aSteps[$iCurrentStep - 1], $currentOrganization);
+ $oKpi = new ExecutionKPI();
+ parent::__construct($sTitle." - step $iCurrentStep of ".count($aSteps)." - ".$aSteps[$iCurrentStep - 1], $currentOrganization);
$this->m_iCurrentStep = $iCurrentStep;
- $this->m_aSteps = $aSteps;
+ $this->m_aSteps = $aSteps;
+ $oKpi->ComputeStats(get_class($this).' creation', 'iTopWizardWebPage');
}
public function output()