mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +01:00
Merge remote-tracking branch 'origin/support/3.2' into develop
# Conflicts: # sources/Core/Kpi/KpiLogData.php
This commit is contained in:
@@ -9,8 +9,8 @@ namespace Combodo\iTop\Core\Kpi;
|
||||
|
||||
class KpiLogData
|
||||
{
|
||||
public const TYPE_REPORT = 'report';
|
||||
public const TYPE_STATS = 'stats';
|
||||
public const TYPE_REPORT = 'report';
|
||||
public const TYPE_STATS = 'stats';
|
||||
public const TYPE_REQUEST = 'request';
|
||||
|
||||
/** @var string */
|
||||
@@ -34,7 +34,7 @@ class KpiLogData
|
||||
/** @var array */
|
||||
public $aData;
|
||||
// Computed
|
||||
public float $fDuration;
|
||||
public string $sDuration;
|
||||
|
||||
/**
|
||||
* @param string $sType
|
||||
@@ -45,9 +45,10 @@ class KpiLogData
|
||||
* @param string $sExtension
|
||||
* @param int $iInitialMemory
|
||||
* @param int $iCurrentMemory
|
||||
* @param int $iPeakMemory
|
||||
* @param array $aData
|
||||
*/
|
||||
public function __construct($sType, $sOperation, $sArguments, $fStartTime, $fStopTime, $sExtension, $iInitialMemory = 0, $iCurrentMemory = 0, $iPeakMemory = 0, $aData = [])
|
||||
public function __construct($sType, $sOperation, $sArguments, float $fStartTime, float $fStopTime, $sExtension, $iInitialMemory = 0, $iCurrentMemory = 0, $iPeakMemory = 0, $aData = [])
|
||||
{
|
||||
$this->sType = $sType;
|
||||
$this->sOperation = $sOperation;
|
||||
@@ -59,7 +60,7 @@ class KpiLogData
|
||||
$this->iCurrentMemory = $iCurrentMemory;
|
||||
$this->iPeakMemory = $iPeakMemory;
|
||||
$this->aData = $aData;
|
||||
$this->fDuration = sprintf('%01.4f', $this->fStopTime - $this->fStartTime);
|
||||
$this->sDuration = sprintf('%01.3f', $fStopTime - $fStartTime);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,11 +70,12 @@ class KpiLogData
|
||||
*/
|
||||
public static function GetCSVHeader()
|
||||
{
|
||||
return "Type,Operation,Arguments,StartTime,StopTime,Duration,Extension,InitialMemory,CurrentMemory,PeakMemory";
|
||||
return 'Type,Operation,Arguments,StartTime,StopTime,Duration,Extension,InitialMemory,CurrentMemory,PeakMemory';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the CSV line for the values
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function GetCSV()
|
||||
@@ -82,7 +84,8 @@ class KpiLogData
|
||||
$sOperation = $this->RemoveQuotes($this->sOperation);
|
||||
$sArguments = $this->RemoveQuotes($this->sArguments);
|
||||
$sExtension = $this->RemoveQuotes($this->sExtension);
|
||||
return "\"$sType\",\"$sOperation\",\"$sArguments\",$this->fStartTime,$this->fStopTime,$this->fDuration,\"$sExtension\",$this->iInitialMemory,$this->iCurrentMemory,$this->iPeakMemory";
|
||||
|
||||
return "\"$sType\",\"$sOperation\",\"$sArguments\",$this->fStartTime,$this->fStopTime,$this->sDuration,\"$sExtension\",$this->iInitialMemory,$this->iCurrentMemory,$this->iPeakMemory";
|
||||
}
|
||||
|
||||
private function RemoveQuotes(string $sEntry): string
|
||||
@@ -100,6 +103,7 @@ class KpiLogData
|
||||
if ($oOther->fStartTime > $this->fStartTime) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user