Forráskód Böngészése

DebugExecutionTime add methods to fetch execute time

Piotr Labudda 11 éve
szülő
commit
41314b6f5d
1 módosított fájl, 16 hozzáadás és 0 törlés
  1. 16 0
      SE/se-lib/DebugExecutionTime.php

+ 16 - 0
SE/se-lib/DebugExecutionTime.php

@@ -29,6 +29,22 @@ class DebugExecutionTime {
 		}
 	}
 
+	public function getLastExecTime() {
+		if (!$this->_isActive) return null;
+		$logTotal = count($this->_log);
+		if ($logTotal < 2) return null;
+		return $this->_log[$logTotal - 1][1];
+	}
+
+	public function getTotalExecTime() {
+		if (!$this->_isActive) return null;
+		$logTotal = count($this->_log);
+		if ($logTotal < 2) return null;
+		$sumExecTime = 0;
+		foreach ($this->_log as $log) $sumExecTime += $log[1];
+		return $sumExecTime;
+	}
+
 	public function printDebug() {
 		if (!$this->_isActive) return;
 		$sumExecTime = 0;