diff --git a/application/ajaxwebpage.class.inc.php b/application/ajaxwebpage.class.inc.php index 4561b0a36..4ef294052 100644 --- a/application/ajaxwebpage.class.inc.php +++ b/application/ajaxwebpage.class.inc.php @@ -291,6 +291,10 @@ EOF { DBSearch::RecordQueryTrace(); } + if (class_exists('ExecutionKPI')) + { + ExecutionKPI::ReportStats(); + } } /** diff --git a/core/config.class.inc.php b/core/config.class.inc.php index 88c5cf16b..0ed04bc21 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -880,6 +880,14 @@ class Config 'source_of_value' => '', 'show_in_conf_sample' => false, ), + 'log_kpi_slow_queries' => array( + 'type' => 'float', + 'description' => 'Time in seconds to allow KPI logs (0 for all)', + 'default' => 0, + 'value' => 0, + 'source_of_value' => '', + 'show_in_conf_sample' => false, + ), 'log_kpi_memory' => array( 'type' => 'integer', 'description' => 'Level of logging for troubleshooting memory limit issues', diff --git a/core/kpi.class.inc.php b/core/kpi.class.inc.php index c43aa5b2d..200b755ae 100644 --- a/core/kpi.class.inc.php +++ b/core/kpi.class.inc.php @@ -200,15 +200,12 @@ class ExecutionKPI self::Report("

Next page stats

"); + $fSlowQueries = MetaModel::GetConfig()->Get('log_kpi_slow_queries'); + // Report operation details foreach (self::$m_aStats as $sOperation => $aOpStats) { - $sOperationHtml = ''.$sOperation.''; - self::Report("

$sOperationHtml

"); - self::Report(""); - self::Report(""); - self::Report(" "); - self::Report(""); + $bDisplayHeader = true; foreach ($aOpStats as $sArguments => $aEvents) { $sHtmlArguments = '
'.$sArguments.'
'; @@ -248,12 +245,28 @@ class ExecutionKPI $sTotalInter = round($fTotalInter, 3); $sMinInter = round($fMinInter, 3); $sMaxInter = round($fMaxInter, 3); - self::Report(""); - self::Report(" "); - self::Report(""); + if (($fTotalInter >= $fSlowQueries)) + { + if ($bDisplayHeader) + { + $sOperationHtml = ''.$sOperation.''; + self::Report("

$sOperationHtml

"); + self::Report("
Operation details (+ blame caller if log_kpi_duration = 2)CountDurationMinMax
$sHtmlArguments$iCountInter$sTotalInter$sMinInter$sMaxInter
"); + self::Report(""); + self::Report(" "); + self::Report(""); + $bDisplayHeader = false; + } + self::Report(""); + self::Report(" "); + self::Report(""); + } + } + if (!$bDisplayHeader) + { + self::Report("
Operation details (+ blame caller if log_kpi_duration = 2)CountDurationMinMax
$sHtmlArguments$iCountInter$sTotalInter$sMinInter$sMaxInter
"); + self::Report("

Back to page stats

"); } - self::Report(""); - self::Report("

Back to page stats

"); } self::Report(' '); }